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.
public SoundPool(int maxStreams, int streamType, int srcQuality) deprecated source| deprecated | use Builder |
|---|
public void setOnLoadCompleteListener(OnLoadCompleteListener listener) sourcepublic int load(String path, int priority) sourcepublic int load(Context context, int resId, int priority) sourcepublic int load(AssetFileDescriptor afd, int priority) sourcepublic int load(FileDescriptor fd, long offset, long length, int priority) sourcepublic synchronized boolean unload(int soundId) sourcepublic synchronized int play(int soundId, float leftVolume, float rightVolume, int priority, int loop, float rate) sourceA stream's ID, 0 when the sound is not loaded
public void pause(int streamId) sourcepublic void resume(int streamId) sourcepublic synchronized void autoPause() sourcepublic synchronized void autoResume() sourcepublic synchronized void stop(int streamId) sourcepublic void setVolume(int streamId, float leftVolume, float rightVolume) sourcepublic void setPriority(int streamId, int priority) empty body sourcepublic void setLoop(int streamId, int loop) sourcepublic void setRate(int streamId, float rate) sourcepublic synchronized void release() sourceMade 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.