org.firstinspires.ftc.robotcore.external.android

## Class AndroidSoundPool

- java.lang.Object
- - org.firstinspires.ftc.robotcore.external.android.AndroidSoundPool

-     public class AndroidSoundPool
      extends java.lang.Object

  A class that provides access to the Android SoundPool.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AndroidSoundPool()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Unloads all the sounds and releases the SoundPool.
    `int` | `getLoop()` Returns the number of repeats.
    `float` | `getRate()` Returns the playback rate.
    `float` | `getVolume()` Returns the current volume.
    `void` | `initialize(SoundPoolIntf soundPool)` Initializes the SoundPool.
    `boolean` | `play(java.lang.String soundName)` Plays the sound with the given name.
    `boolean` | `preloadSound(java.lang.String soundName)` Preloads the sound with the given name.
    `void` | `setLoop(int loop)` Sets the number of repeats.
    `void` | `setRate(float rate)` Sets the playback rate.
    `void` | `setVolume(float volume)` Sets the volume.
    `void` | `stop()` Stops the playback.

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

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

- - ### Constructor Detail

    - #### AndroidSoundPool

          public AndroidSoundPool()

  - ### Method Detail

    - #### initialize

          public void initialize(SoundPoolIntf soundPool)

      Initializes the SoundPool.

    - #### preloadSound

          public boolean preloadSound(java.lang.String soundName)

      Preloads the sound with the given name.
      Returns:
        true if sound is successfully preloaded, false otherwise
      Throws:
        `java.lang.IllegalStateException` - if initialized has not been called yet.

    - #### play

          public boolean play(java.lang.String soundName)

      Plays the sound with the given name.
      Returns:
        true if sound is successfully loaded, false otherwise throws IllegalStateException if initialized has not been called yet.

    - #### stop

          public void stop()

      Stops the playback.

    - #### getVolume

          public float getVolume()

      Returns the current volume.

    - #### setVolume

          public void setVolume(float volume)

      Sets the volume. Volume range is 0.0 to 1.0.

    - #### getRate

          public float getRate()

      Returns the playback rate.

    - #### setRate

          public void setRate(float rate)

      Sets the playback rate. Rate range is 0.5 to 2.0. Normal rate is 1.0.

    - #### getLoop

          public int getLoop()

      Returns the number of repeats.

    - #### setLoop

          public void setLoop(int loop)

      Sets the number of repeats. Loop 0 means no repeats. Loop -1 means repeat indefinitely.

    - #### close

          public void close()

      Unloads all the sounds and releases the SoundPool.