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