SoundPool

Class of android.media · SoundPool.java · Android's reference

public class SoundPool

Short sounds, loaded once and played many times, through the runtime's audio (snx.android.media.Audio). A load reads the source and decodes it on the pool's thread, then tells the listener (status 0, or 1 when the source holds no audio that decodes) on the looper of the thread that made the pool, as Android does. Each play is a stream: at most maxStreams play at once, the oldest stopped for a new one.

Nested types

Constructors

public SoundPool(int maxStreams, int streamType, int srcQuality) deprecated source
deprecateduse Builder

Methods

public void setOnLoadCompleteListener(OnLoadCompleteListener listener) source
public int load(String path, int priority) source
public int load(Context context, int resId, int priority) source
public int load(AssetFileDescriptor afd, int priority) source
public int load(FileDescriptor fd, long offset, long length, int priority) source
public synchronized boolean unload(int soundId) source
public synchronized int play(int soundId, float leftVolume, float rightVolume, int priority, int loop, float rate) source

A stream's ID, 0 when the sound is not loaded

public void pause(int streamId) source
public void resume(int streamId) source
public synchronized void autoPause() source
public synchronized void autoResume() source
public synchronized void stop(int streamId) source
public void setVolume(int streamId, float leftVolume, float rightVolume) source
public void setPriority(int streamId, int priority) empty body source
public void setLoop(int streamId, int loop) source
public void setRate(int streamId, float rate) source
public synchronized void release() source

Made from ScarletNX's Sail at 166ad3910f80. The framework is ScarletNX's (GPL-3.0-or-later); the parts that follow the Android Open Source Project's sources (Apache-2.0) say so in their files.