Package org.robolectric.shadows
Class ShadowSoundPool
java.lang.Object
org.robolectric.shadows.ShadowSoundPool
@Implements(android.media.SoundPool.class) public class ShadowSoundPool extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classShadowSoundPool.PlaybackRecord of a single call toSoundPool.play(int, float, float, int, int, float). -
Constructor Summary
Constructors Constructor Description ShadowSoundPool() -
Method Summary
Modifier and Type Method Description protected int_play(int soundID, float leftVolume, float rightVolume, int priority, int loop, float rate)voidclearPlayed()Clears the sounds played by this SoundPool.List<ShadowSoundPool.Playback>getPathPlaybacks(String path)Return a list of calls toplaymade for the given path.List<ShadowSoundPool.Playback>getResourcePlaybacks(int resId)Return a list of calls toplaymade for the given resource.protected static IAudioServicegetService()protected intload(Context context, int resId, int priority)protected intload(String path, int priority)voidnotifyPathLoaded(String path, boolean success)Notify theSoundPool.OnLoadCompleteListener, if present, that the given path was loaded.voidnotifyResourceLoaded(int resId, boolean success)Notify theSoundPool.OnLoadCompleteListener, if present, that the given resource was loaded.protected intplay(int soundID, float leftVolume, float rightVolume, int priority, int loop, float rate)protected voidsetOnLoadCompleteListener(SoundPool.OnLoadCompleteListener listener)booleanwasPathPlayed(String path)Returnstrueif the given path was played.booleanwasResourcePlayed(int resId)Returnstrueif the given resource was played.
-
Constructor Details
-
ShadowSoundPool
public ShadowSoundPool()
-
-
Method Details
-
getService
-
play
@Implementation(maxSdk=22) protected int play(int soundID, float leftVolume, float rightVolume, int priority, int loop, float rate) -
_play
@Implementation(minSdk=23) protected int _play(int soundID, float leftVolume, float rightVolume, int priority, int loop, float rate) -
load
-
load
-
setOnLoadCompleteListener
@Implementation protected void setOnLoadCompleteListener(SoundPool.OnLoadCompleteListener listener) -
notifyPathLoaded
Notify theSoundPool.OnLoadCompleteListener, if present, that the given path was loaded. -
notifyResourceLoaded
public void notifyResourceLoaded(int resId, boolean success)Notify theSoundPool.OnLoadCompleteListener, if present, that the given resource was loaded. -
wasPathPlayed
Returnstrueif the given path was played. -
wasResourcePlayed
public boolean wasResourcePlayed(int resId)Returnstrueif the given resource was played. -
getPathPlaybacks
Return a list of calls toplaymade for the given path. -
getResourcePlaybacks
Return a list of calls toplaymade for the given resource. -
clearPlayed
public void clearPlayed()Clears the sounds played by this SoundPool.
-