You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

sound.html 3.2 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Sound Task</title>
  5. </head>
  6. <body>
  7. <h2><a name="sound">Sound</a></h2>
  8. <h3>Description</h3>
  9. <p>Plays a sound-file at the end of the build, according to whether
  10. the build failed or succeeded. You can specify either a specific
  11. sound-file to play, or, if a directory is specified, the
  12. <code>&lt;sound&gt;</code> task will randomly select a file to play.
  13. Note: At this point, the random selection is based on all the files
  14. in the directory, not just those ending in appropriate suffixes
  15. for sound-files, so be sure you only have sound-files in the
  16. directory you specify.</p>
  17. <p>
  18. Unless you are running on Java 1.3 or later, you need the Java Media Framework
  19. on the classpath (javax.sound).
  20. </p>
  21. <h3>Nested Elements</h3>
  22. <h4>success</h4>
  23. <p>Specifies the sound to be played if the build succeeded.</p>
  24. <h4>fail</h4>
  25. <p>Specifies the sound to be played if the build failed.</p>
  26. <h3>Nested Element Parameters</h3>
  27. <p>
  28. The following attributes may be used on the <code>&lt;success&gt;</code>
  29. and <code>&lt;fail&gt;</code> elements:</p>
  30. <table border="1" cellpadding="2" cellspacing="0">
  31. <tr>
  32. <td valign="top"><b>Attribute</b></td>
  33. <td valign="top"><b>Description</b></td>
  34. <td align="center" valign="top"><b>Required</b></td>
  35. </tr>
  36. <tr>
  37. <td valign="top">source</td>
  38. <td valign="top">the path to a sound-file directory, or the name of a
  39. specific sound-file, to be played.
  40. </td>
  41. <td valign="top" align="center">Yes</td>
  42. </tr>
  43. <tr>
  44. <td valign="top">loops</td>
  45. <td valign="top">the number of extra times to play the sound-file;
  46. default is <code>0</code>.
  47. </td>
  48. <td valign="top" align="center">No</td>
  49. </tr>
  50. <tr>
  51. <td valign="top">duration</td>
  52. <td valign="top">the amount of time (in milliseconds) to play
  53. the sound-file.
  54. </td>
  55. <td valign="top" align="center">No</td>
  56. </tr>
  57. </table>
  58. <h3>Examples</h3>
  59. <blockquote>
  60. <pre>
  61. &lt;target name=&quot;fun&quot; if=&quot;fun&quot; unless=&quot;fun.done&quot;&gt;
  62. &lt;sound&gt;
  63. &lt;success source=&quot;${user.home}/sounds/bell.wav&quot;/&gt;
  64. &lt;fail source=&quot;${user.home}/sounds/ohno.wav&quot; loops=&quot;2&quot;/&gt;
  65. &lt;/sound&gt;
  66. &lt;property name=&quot;fun.done&quot; value=&quot;true&quot;/&gt;
  67. &lt;/target&gt;
  68. </pre>
  69. </blockquote>
  70. plays the <code>bell.wav</code> sound-file if the build succeeded, or
  71. the <code>ohno.wav</code> sound-file if the build failed, three times,
  72. if the <code>fun</code> property is set to <code>true</code>.
  73. If the target
  74. is a dependency of an &quot;initialization&quot; target that other
  75. targets depend on, the
  76. <code>fun.done</code> property prevents the target from being executed
  77. more than once.
  78. <blockquote>
  79. <pre>
  80. &lt;target name=&quot;fun&quot; if=&quot;fun&quot; unless=&quot;fun.done&quot;&gt;
  81. &lt;sound&gt;
  82. &lt;success source=&quot;//intranet/sounds/success&quot;/&gt;
  83. &lt;fail source=&quot;//intranet/sounds/failure&quot;/&gt;
  84. &lt;/sound&gt;
  85. &lt;property name=&quot;fun.done&quot; value=&quot;true&quot;/&gt;
  86. &lt;/target&gt;
  87. </pre>
  88. </blockquote>
  89. randomly selects a sound-file to play when the build succeeds or fails.
  90. <hr>
  91. <p align="center">Copyright &copy; 2001-2002,2004 The Apache Software Foundation. All rights
  92. Reserved.</p>
  93. </body>
  94. </html>