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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Ant User Manual</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. <h3>Parameters</h3>
  18. <p>(none)</p>
  19. <h3>Nested Elements</h3>
  20. <h4>success</h4>
  21. <p>Specifies the sound to be played if the build succeeded.</p>
  22. <h4>fail</h4>
  23. <p>Specifies the sound to be played if the build failed.</p>
  24. <h3>Nested Element Parameters</h3>
  25. <p>
  26. The following attributes may be used on the <code>&lt;success&gt;</code>
  27. and <code>&lt;fail&gt;</code> elements:</p>
  28. <table border="1" cellpadding="2" cellspacing="0">
  29. <tr>
  30. <td valign="top"><b>Attribute</b></td>
  31. <td valign="top"><b>Description</b></td>
  32. <td align="center" valign="top"><b>Required</b></td>
  33. </tr>
  34. <tr>
  35. <td valign="top">source</td>
  36. <td valign="top">the path to a sound-file directory, or the name of a
  37. specific sound-file, to be played.
  38. </td>
  39. <td valign="top" align="center">Yes</td>
  40. </tr>
  41. <tr>
  42. <td valign="top">loops</td>
  43. <td valign="top">the number of extra times to play the sound-file;
  44. default is <code>0</code>.
  45. </td>
  46. <td valign="top" align="center">No</td>
  47. </tr>
  48. <tr>
  49. <td valign="top">duration</td>
  50. <td valign="top">the amount of time (in milliseconds) to play
  51. the sound-file.
  52. </td>
  53. <td valign="top" align="center">No</td>
  54. </tr>
  55. </table>
  56. <h3>Examples</h3>
  57. <blockquote>
  58. <pre>
  59. &lt;target name=&quot;fun&quot; if=&quot;fun&quot; unless=&quot;fun.done&quot;&gt;
  60. &lt;sound&gt;
  61. &lt;success source=&quot;${user.home}/sounds/bell.wav&quot;/&gt;
  62. &lt;fail source=&quot;${user.home}/sounds/ohno.wav&quot; loops=&quot;2&quot;/&gt;
  63. &lt;/sound&gt;
  64. &lt;property name=&quot;fun.done&quot; value=&quot;true&quot;/&gt;
  65. &lt;/target&gt;
  66. </pre>
  67. </blockquote>
  68. plays the <code>bell.wav</code> sound-file if the build succeeded, or
  69. the <code>ohno.wav</code> sound-file if the build failed, three times,
  70. if the <code>fun</code> property is set to <code>true</code>.
  71. If the target
  72. is a dependency of an &quot;initialization&quot; target that other
  73. targets depend on, the
  74. <code>fun.done</code> property prevents the target from being executed
  75. more than once.
  76. <blockquote>
  77. <pre>
  78. &lt;target name=&quot;fun&quot; if=&quot;fun&quot; unless=&quot;fun.done&quot;&gt;
  79. &lt;sound>
  80. &lt;success source=&quot;//intranet/sounds/success&quot;/&gt;
  81. &lt;fail source=&quot;//intranet/sounds/failure&quot;/&gt;
  82. &lt;/sound&gt;
  83. &lt;property name=&quot;fun.done&quot; value=&quot;true&quot;/&gt;
  84. &lt;/target&gt;
  85. </pre>
  86. </blockquote>
  87. randomly selects a sound-file to play when the build succeeds or fails.
  88. <hr>
  89. <p align="center">Copyright &copy; 2000,2001 Apache Software Foundation. All rights
  90. Reserved.</p>
  91. </body>
  92. </html>