git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277955 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -56,8 +56,8 @@ public class AntSoundPlayer implements LineListener, BuildListener { | |||
| private int loopsFail = 0; | |||
| private Long durationFail = null; | |||
| /** Constructor for AntSoundPlayer. */ | |||
| public AntSoundPlayer() { | |||
| } | |||
| /** | |||
| @@ -139,6 +139,7 @@ public class AntSoundPlayer implements LineListener, BuildListener { | |||
| clip.loop(loops); | |||
| while (clip.isRunning()) { | |||
| // Empty block | |||
| } | |||
| } | |||
| @@ -147,12 +148,14 @@ public class AntSoundPlayer implements LineListener, BuildListener { | |||
| try { | |||
| Thread.sleep(duration); | |||
| } catch (InterruptedException e) { | |||
| // Ignore Exception | |||
| } | |||
| } | |||
| /** | |||
| * This is implemented to listen for any line events and closes the | |||
| * clip if required. | |||
| * @param event the line event to follow | |||
| */ | |||
| public void update(LineEvent event) { | |||
| if (event.getType().equals(LineEvent.Type.STOP)) { | |||
| @@ -171,6 +174,7 @@ public class AntSoundPlayer implements LineListener, BuildListener { | |||
| /** | |||
| * Fired before any targets are started. | |||
| * @param event ignored | |||
| */ | |||
| public void buildStarted(BuildEvent event) { | |||
| } | |||
| @@ -226,7 +230,7 @@ public class AntSoundPlayer implements LineListener, BuildListener { | |||
| /** | |||
| * Fired whenever a message is logged. | |||
| * | |||
| * @param event the build event | |||
| * @see BuildEvent#getMessage() | |||
| * @see BuildEvent#getPriority() | |||
| */ | |||
| @@ -49,6 +49,7 @@ public class SoundTask extends Task { | |||
| /** | |||
| * add a sound when the build succeeds | |||
| * @return a BuildAlert to be configured | |||
| */ | |||
| public BuildAlert createSuccess() { | |||
| success = new BuildAlert(); | |||
| @@ -57,18 +58,26 @@ public class SoundTask extends Task { | |||
| /** | |||
| * add a sound when the build fails | |||
| * @return a BuildAlert to be configured | |||
| */ | |||
| public BuildAlert createFail() { | |||
| fail = new BuildAlert(); | |||
| return fail; | |||
| } | |||
| /** Constructor for SoundTask. */ | |||
| public SoundTask() { | |||
| } | |||
| /** | |||
| * Initialize the task. | |||
| */ | |||
| public void init() { | |||
| } | |||
| /** | |||
| * Execute the task. | |||
| */ | |||
| public void execute() { | |||
| AntSoundPlayer soundPlayer = new AntSoundPlayer(); | |||
| @@ -102,6 +111,7 @@ public class SoundTask extends Task { | |||
| /** | |||
| * Sets the duration in milliseconds the file should be played; optional. | |||
| * @param duration the duration in millisconds | |||
| */ | |||
| public void setDuration(Long duration) { | |||
| this.duration = duration; | |||
| @@ -127,6 +137,7 @@ public class SoundTask extends Task { | |||
| /** | |||
| * Gets the location of the file to get the audio. | |||
| * @return the file location | |||
| */ | |||
| public File getSource() { | |||
| File nofile = null; | |||
| @@ -170,6 +181,7 @@ public class SoundTask extends Task { | |||
| /** | |||
| * Gets the duration in milliseconds the file should be played. | |||
| * @return the duration in milliseconds | |||
| */ | |||
| public Long getDuration() { | |||
| return this.duration; | |||