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.3 KiB

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