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 4.0 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <!--
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. <html>
  16. <head>
  17. <meta http-equiv="Content-Language" content="en-us">
  18. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  19. <title>Sound Task</title>
  20. </head>
  21. <body>
  22. <h2><a name="sound">Sound</a></h2>
  23. <h3>Description</h3>
  24. <p>Plays a sound-file at the end of the build, according to whether
  25. the build failed or succeeded. You can specify either a specific
  26. sound-file to play, or, if a directory is specified, the
  27. <code>&lt;sound&gt;</code> task will randomly select a file to play.
  28. Note: At this point, the random selection is based on all the files
  29. in the directory, not just those ending in appropriate suffixes
  30. for sound-files, so be sure you only have sound-files in the
  31. directory you specify.</p>
  32. <p>
  33. Unless you are running on Java 1.3 or later, you need the Java Media Framework
  34. on the classpath (javax.sound).
  35. </p>
  36. <h3>Nested Elements</h3>
  37. <h4>success</h4>
  38. <p>Specifies the sound to be played if the build succeeded.</p>
  39. <h4>fail</h4>
  40. <p>Specifies the sound to be played if the build failed.</p>
  41. <h3>Nested Element Parameters</h3>
  42. <p>
  43. The following attributes may be used on the <code>&lt;success&gt;</code>
  44. and <code>&lt;fail&gt;</code> elements:</p>
  45. <table border="1" cellpadding="2" cellspacing="0">
  46. <tr>
  47. <td valign="top"><b>Attribute</b></td>
  48. <td valign="top"><b>Description</b></td>
  49. <td align="center" valign="top"><b>Required</b></td>
  50. </tr>
  51. <tr>
  52. <td valign="top">source</td>
  53. <td valign="top">the path to a sound-file directory, or the name of a
  54. specific sound-file, to be played.
  55. </td>
  56. <td valign="top" align="center">Yes</td>
  57. </tr>
  58. <tr>
  59. <td valign="top">loops</td>
  60. <td valign="top">the number of extra times to play the sound-file;
  61. default is <code>0</code>.
  62. </td>
  63. <td valign="top" align="center">No</td>
  64. </tr>
  65. <tr>
  66. <td valign="top">duration</td>
  67. <td valign="top">the amount of time (in milliseconds) to play
  68. the sound-file.
  69. </td>
  70. <td valign="top" align="center">No</td>
  71. </tr>
  72. </table>
  73. <h3>Examples</h3>
  74. <blockquote>
  75. <pre>
  76. &lt;target name=&quot;fun&quot; if=&quot;fun&quot; unless=&quot;fun.done&quot;&gt;
  77. &lt;sound&gt;
  78. &lt;success source=&quot;${user.home}/sounds/bell.wav&quot;/&gt;
  79. &lt;fail source=&quot;${user.home}/sounds/ohno.wav&quot; loops=&quot;2&quot;/&gt;
  80. &lt;/sound&gt;
  81. &lt;property name=&quot;fun.done&quot; value=&quot;true&quot;/&gt;
  82. &lt;/target&gt;
  83. </pre>
  84. </blockquote>
  85. plays the <code>bell.wav</code> sound-file if the build succeeded, or
  86. the <code>ohno.wav</code> sound-file if the build failed, three times,
  87. if the <code>fun</code> property is set to <code>true</code>.
  88. If the target
  89. is a dependency of an &quot;initialization&quot; target that other
  90. targets depend on, the
  91. <code>fun.done</code> property prevents the target from being executed
  92. more than once.
  93. <blockquote>
  94. <pre>
  95. &lt;target name=&quot;fun&quot; if=&quot;fun&quot; unless=&quot;fun.done&quot;&gt;
  96. &lt;sound&gt;
  97. &lt;success source=&quot;//intranet/sounds/success&quot;/&gt;
  98. &lt;fail source=&quot;//intranet/sounds/failure&quot;/&gt;
  99. &lt;/sound&gt;
  100. &lt;property name=&quot;fun.done&quot; value=&quot;true&quot;/&gt;
  101. &lt;/target&gt;
  102. </pre>
  103. </blockquote>
  104. randomly selects a sound-file to play when the build succeeds or fails.
  105. </body>
  106. </html>