2006-09-11 04:19:00 +00:00
|
|
|
<!--
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
2001-02-13 12:32:01 +00:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Language" content="en-us">
|
2005-04-29 18:58:16 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
2002-02-03 22:11:39 +00:00
|
|
|
<title>Sound Task</title>
|
2001-02-13 12:32:01 +00:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h2 id="sound">Sound</h2>
|
2001-02-13 12:32:01 +00:00
|
|
|
<h3>Description</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Plays a sound file at the end of the build, according to whether the build failed or
|
|
|
|
succeeded. You can specify either a specific sound file to play, or, if a directory is specified,
|
|
|
|
the <code><sound></code> task will randomly select a file to play. <strong>Note</strong>: At
|
|
|
|
this point, the random selection is based on all the files in the directory, not just those ending
|
|
|
|
in appropriate suffixes for sound files, so be sure you only have sound files in the directory you
|
|
|
|
specify.</p>
|
|
|
|
<p>More precisely <code><sound></code> registers a hook that is triggered when the build
|
|
|
|
finishes. Therefore you have to place this task as top level or inside a target which is always
|
|
|
|
executed.</p>
|
|
|
|
<p>Unless you are running on Java 1.3 or later, you need the Java Media Framework on the classpath
|
2018-03-10 20:17:33 +01:00
|
|
|
(<code class="code">javax.sound</code>).</p>
|
2001-10-10 15:30:35 +00:00
|
|
|
|
2018-03-05 17:35:30 +01:00
|
|
|
<h3>Parameters specified as nested elements</h3>
|
2001-10-10 15:30:35 +00:00
|
|
|
<h4>success</h4>
|
|
|
|
<p>Specifies the sound to be played if the build succeeded.</p>
|
2018-03-05 21:01:42 +01:00
|
|
|
|
2001-10-10 15:30:35 +00:00
|
|
|
<h4>fail</h4>
|
|
|
|
<p>Specifies the sound to be played if the build failed.</p>
|
|
|
|
|
2018-03-05 21:01:42 +01:00
|
|
|
<h4>Nested element parameters</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>The following attributes may be used on the <code><success></code>
|
2001-10-10 15:30:35 +00:00
|
|
|
and <code><fail></code> elements:</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2001-02-13 12:32:01 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<th>Attribute</th>
|
|
|
|
<th>Description</th>
|
|
|
|
<th>Required</th>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
2001-10-10 15:30:35 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>source</td>
|
|
|
|
<td>the path to a sound file directory, or the name of a specific sound file, to be played. If
|
|
|
|
this file does not exist, an error message will be logged.</td>
|
|
|
|
<td>Yes</td>
|
2001-10-10 15:30:35 +00:00
|
|
|
</tr>
|
2001-02-13 12:32:01 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>loops</td>
|
|
|
|
<td>the number of extra times to play the sound file.</td>
|
2018-03-02 08:23:45 +01:00
|
|
|
<td>No; default is <q>0</q></td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>duration</td>
|
|
|
|
<td>the amount of time (in milliseconds) to play the sound file.</td>
|
|
|
|
<td>No</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<h3>Examples</h3>
|
2018-02-09 06:54:03 +01:00
|
|
|
|
2001-02-13 12:32:01 +00:00
|
|
|
<pre>
|
|
|
|
<target name="fun" if="fun" unless="fun.done">
|
2001-10-10 15:30:35 +00:00
|
|
|
<sound>
|
2001-02-13 12:32:01 +00:00
|
|
|
<success source="${user.home}/sounds/bell.wav"/>
|
2001-10-10 15:30:35 +00:00
|
|
|
<fail source="${user.home}/sounds/ohno.wav" loops="2"/>
|
2001-02-13 12:32:01 +00:00
|
|
|
</sound>
|
|
|
|
<property name="fun.done" value="true"/>
|
2018-02-28 07:58:59 +01:00
|
|
|
</target></pre>
|
|
|
|
<p>plays the <samp>bell.wav</samp> sound file if the build succeeded, or the <samp>ohno.wav</samp>
|
|
|
|
sound file if the build failed, three times, if the <code>fun</code> property is set to <q>true</q>.
|
|
|
|
If the target is a dependency of an "initialization" target that other targets depend on,
|
|
|
|
the <code>fun.done</code> property prevents the target from being executed more than once.</p>
|
2001-02-13 12:32:01 +00:00
|
|
|
<pre>
|
|
|
|
<target name="fun" if="fun" unless="fun.done">
|
2002-09-03 15:24:08 +00:00
|
|
|
<sound>
|
2001-02-13 12:32:01 +00:00
|
|
|
<success source="//intranet/sounds/success"/>
|
|
|
|
<fail source="//intranet/sounds/failure"/>
|
|
|
|
</sound>
|
|
|
|
<property name="fun.done" value="true"/>
|
|
|
|
</target>
|
|
|
|
</pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>randomly selects a sound file to play when the build succeeds or fails.</p>
|
2001-02-13 12:32:01 +00:00
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|