java left logo
java middle logo
java right logo
 

Home arrow Other API Tips
 
 
Main Menu
Home
Java Tutorials
Book Reviews
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Java Network
Java Forums
Java Blog




Most Visited Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews
Top Rated Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews


Statistics
Registered Users: 4085
Java SE Tips: 614
Java ME Tips: 202
Java EE Tips: 183
Other API Tips: 779
Java Applications: 298
Java Libraries: 209
Java Games: 16
Book Reviews:
 
 
 
How to use Sound task E-mail
User Rating: / 6
PoorBest 

Sound

Description

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 <sound> task will randomly select a file to play. Note: 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.

Unless you are running on Java 1.3 or later, you need the Java Media Framework on the classpath (javax.sound).

Nested Elements

success

Specifies the sound to be played if the build succeeded.

fail

Specifies the sound to be played if the build failed.

Nested Element Parameters

The following attributes may be used on the <success> and <fail> elements:

Attribute Description Required
source the path to a sound-file directory, or the name of a specific sound-file, to be played. Yes
loops the number of extra times to play the sound-file; default is 0. No
duration the amount of time (in milliseconds) to play the sound-file. No

Examples


<target name="fun" if="fun" unless="fun.done">
  <sound>
    <success source="${user.home}/sounds/bell.wav"/>

    <fail source="${user.home}/sounds/ohno.wav" loops="2"/>
  </sound>
  <property name="fun.done" value="true"/>

</target>
plays the bell.wav sound-file if the build succeeded, or the ohno.wav sound-file if the build failed, three times, if the fun property is set to true. If the target is a dependency of an "initialization" target that other targets depend on, the fun.done property prevents the target from being executed more than once.
<target name="fun" if="fun" unless="fun.done">
  <sound>

    <success source="//intranet/sounds/success"/>
    <fail source="//intranet/sounds/failure"/>
  </sound>
  <property name="fun.done" value="true"/>

</target>
randomly selects a sound-file to play when the build succeeds or fails.

Source: Apache Ant


 Related Tips

 
< Prev   Next >

Page 1 of 0 ( 0 comments )

You can share your information about this topic using the form below!

Please do not post your questions with this form! Thanks.


Name (required)


E-Mail (required)

Your email will not be displayed on the site - only to our administrator
Homepage(optional)



Comment Enable HTML code : Yes No



 
       
         
     
 
 
 
   
 
 
java bottom left
java bottom middle
java bottom right
RSS 0.91 FeedRSS 1.0 FeedRSS 2.0 FeedATOM FeedOPML Feed

Home - About Us - Privacy Policy
Copyright 2005 - 2008 www.java-tips.org
Java is a trademark of Sun Microsystems, Inc.