@Implements(android.media.SoundPool.class) public class ShadowSoundPool extends Object
Modifier and Type | Class | Description |
---|---|---|
static class |
ShadowSoundPool.Playback |
Record of a single call to
SoundPool.play(int, float, float, int, int, float) . |
Constructor | Description |
---|---|
ShadowSoundPool() |
Modifier and Type | Method | Description |
---|---|---|
protected int |
_play(int soundID,
float leftVolume,
float rightVolume,
int priority,
int loop,
float rate) |
|
void |
clearPlayed() |
Clears the sounds played by this SoundPool.
|
List<ShadowSoundPool.Playback> |
getPathPlaybacks(String path) |
Return a list of calls to
play made for the given path. |
List<ShadowSoundPool.Playback> |
getResourcePlaybacks(int resId) |
Return a list of calls to
play made for the given resource. |
protected static IAudioService |
getService() |
|
protected int |
load(Context context,
int resId,
int priority) |
|
protected int |
load(String path,
int priority) |
|
void |
notifyPathLoaded(String path,
boolean success) |
Notify the
SoundPool.OnLoadCompleteListener , if present, that the given path was loaded. |
void |
notifyResourceLoaded(int resId,
boolean success) |
Notify the
SoundPool.OnLoadCompleteListener , if present, that the given resource was loaded. |
protected int |
play(int soundID,
float leftVolume,
float rightVolume,
int priority,
int loop,
float rate) |
|
protected void |
setOnLoadCompleteListener(SoundPool.OnLoadCompleteListener listener) |
|
boolean |
wasPathPlayed(String path) |
Returns
true if the given path was played. |
boolean |
wasResourcePlayed(int resId) |
Returns
true if the given resource was played. |
@Implementation(minSdk=24, maxSdk=25) protected static IAudioService getService()
@Implementation(maxSdk=22) protected int play(int soundID, float leftVolume, float rightVolume, int priority, int loop, float rate)
@Implementation(minSdk=23) protected int _play(int soundID, float leftVolume, float rightVolume, int priority, int loop, float rate)
@Implementation protected int load(String path, int priority)
@Implementation protected int load(Context context, int resId, int priority)
@Implementation protected void setOnLoadCompleteListener(SoundPool.OnLoadCompleteListener listener)
public void notifyPathLoaded(String path, boolean success)
SoundPool.OnLoadCompleteListener
, if present, that the given path was loaded.public void notifyResourceLoaded(int resId, boolean success)
SoundPool.OnLoadCompleteListener
, if present, that the given resource was loaded.public boolean wasPathPlayed(String path)
true
if the given path was played.public boolean wasResourcePlayed(int resId)
true
if the given resource was played.public List<ShadowSoundPool.Playback> getPathPlaybacks(String path)
play
made for the given path.public List<ShadowSoundPool.Playback> getResourcePlaybacks(int resId)
play
made for the given resource.public void clearPlayed()