Class AntSoundPlayer
java.lang.Object
org.apache.tools.ant.taskdefs.optional.sound.AntSoundPlayer
- All Implemented Interfaces:
EventListener
,LineListener
,BuildListener
This class is designed to be used by any AntTask that requires audio output.
It implements the BuildListener interface to listen for BuildEvents
and could be easily extended to provide audio output upon any
specific build events occurring.
I have only tested this with .WAV and .AIFF sound file formats. Both seem to work fine.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBuildFailedSound
(File fileFail, int loopsFail, Long durationFail) void
addBuildSuccessfulSound
(File file, int loops, Long duration) void
buildFinished
(BuildEvent event) Fired after the last target has finished.void
buildStarted
(BuildEvent event) Fired before any targets are started.void
messageLogged
(BuildEvent event) Fired whenever a message is logged.void
targetFinished
(BuildEvent event) Fired when a target has finished.void
targetStarted
(BuildEvent event) Fired when a target is started.void
taskFinished
(BuildEvent event) Fired when a task has finished.void
taskStarted
(BuildEvent event) Fired when a task is started.void
This is implemented to listen for any line events and closes the clip if required.
-
Constructor Details
-
AntSoundPlayer
public AntSoundPlayer()
-
-
Method Details
-
addBuildSuccessfulSound
- Parameters:
file
- the location of the audio file to be played when the build is successfulloops
- the number of times the file should be played when the build is successfulduration
- the number of milliseconds the file should be played when the build is successful
-
addBuildFailedSound
- Parameters:
fileFail
- the location of the audio file to be played when the build failsloopsFail
- the number of times the file should be played when the build is failsdurationFail
- the number of milliseconds the file should be played when the build fails
-
update
This is implemented to listen for any line events and closes the clip if required.- Specified by:
update
in interfaceLineListener
- Parameters:
event
- the line event to follow
-
buildStarted
Fired before any targets are started.- Specified by:
buildStarted
in interfaceBuildListener
- Parameters:
event
- ignored
-
buildFinished
Fired after the last target has finished. This event will still be thrown if an error occurred during the build.- Specified by:
buildFinished
in interfaceBuildListener
- Parameters:
event
- the build finished event.- See Also:
-
targetStarted
Fired when a target is started.- Specified by:
targetStarted
in interfaceBuildListener
- Parameters:
event
- ignored.- See Also:
-
targetFinished
Fired when a target has finished. This event will still be thrown if an error occurred during the build.- Specified by:
targetFinished
in interfaceBuildListener
- Parameters:
event
- ignored.- See Also:
-
taskStarted
Fired when a task is started.- Specified by:
taskStarted
in interfaceBuildListener
- Parameters:
event
- ignored.- See Also:
-
taskFinished
Fired when a task has finished. This event will still be throw if an error occurred during the build.- Specified by:
taskFinished
in interfaceBuildListener
- Parameters:
event
- ignored.- See Also:
-
messageLogged
Fired whenever a message is logged.- Specified by:
messageLogged
in interfaceBuildListener
- Parameters:
event
- the build event- See Also:
-