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

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