SoundTask (Apache Ant API)
Date: 2016-08-23

org.apache.tools.ant.taskdefs.optional.sound

## Class SoundTask

- java.lang.Object
- - org.apache.tools.ant.ProjectComponent
  - - org.apache.tools.ant.Task
    - - org.apache.tools.ant.taskdefs.optional.sound.SoundTask

- All Implemented Interfaces:
    java.lang.Cloneable

      public class SoundTask
      extends Task

  Plays a sound file at the end of the build, according to whether the build failed or succeeded. There are three attributes to be set: `source`: the location of the audio file to be played `duration`: play the sound file continuously until "duration" milliseconds has expired `loops`: the number of times the sound file should be played until stopped I have only tested this with .WAV and .AIFF sound file formats. Both seem to work fine. plans for the future: - use the midi api to define sounds (or drum beat etc) in xml and have Ant play them back

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `SoundTask.BuildAlert` A class to be extended by any BuildAlert's that require the output of sound.

  - ### Field Summary

    - ### Fields inherited from class org.apache.tools.ant.Task

      `target, taskName, taskType, wrapper`

    - ### Fields inherited from class org.apache.tools.ant.ProjectComponent

      `description, location, project`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SoundTask()` Constructor for SoundTask.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `SoundTask.BuildAlert` | `createFail()` add a sound when the build fails
    `SoundTask.BuildAlert` | `createSuccess()` add a sound when the build succeeds
    `void` | `execute()` Execute the task.
    `void` | `init()` Initialize the task.

    - ### Methods inherited from class org.apache.tools.ant.Task

      `bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType`

    - ### Methods inherited from class org.apache.tools.ant.ProjectComponent

      `clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SoundTask

          public SoundTask()

      Constructor for SoundTask.

  - ### Method Detail

    - #### createSuccess

          public SoundTask.BuildAlert createSuccess()

      add a sound when the build succeeds
      Returns:
        a BuildAlert to be configured

    - #### createFail

          public SoundTask.BuildAlert createFail()

      add a sound when the build fails
      Returns:
        a BuildAlert to be configured

    - #### init

          public void init()

      Initialize the task.
      Overrides:
        `init` in class `Task`

    - #### execute

          public void execute()

      Execute the task.
      Overrides:
        `execute` in class `Task`