# Class SoundEffect

java.lang.Object
com.codename1.gaming.SoundEffect

public final class SoundEffect extends Object

A short, reusable sound clip loaded into a `SoundPool`.

Obtain one with `SoundPool#load(String)` or `SoundPool#load(java.io.InputStream, String)`, then play it any number of times -- overlapping plays mix together up to the pool's voice limit. A sound effect belongs to the pool that created it and must not be used with a different pool.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `SoundPool`
  `getPool()`
  The pool that owns this effect.
  `boolean`
  `isLoaded()`
  True until `#unload()` is called.
  `int`
  `play()`
  Plays the effect once at full volume, returning a voice id or -1 if the pool is exhausted.
  `int`
  `play(float volume, float pan, float rate, int loop)`
  Plays the effect with explicit parameters.
  `void`
  `unload()`
  Releases this effect's buffers from the pool.

  ### Methods inherited from class Object

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

- ## Method Details

  - ### getPool

    public SoundPool getPool()
    The pool that owns this effect.

  - ### isLoaded

    public boolean isLoaded()
    True until `#unload()` is called.

  - ### play

    public int play()
    Plays the effect once at full volume, returning a voice id or -1 if the pool is exhausted. Equivalent to `pool.play(this)`.

  - ### play

    public int play(float volume, float pan, float rate, int loop)
    Plays the effect with explicit parameters. See `SoundPool#play(SoundEffect, float, float, float, int)`.

  - ### unload

    public void unload()
    Releases this effect's buffers from the pool. The effect must not be played afterwards.