Package io.anyline2.util
Class SoundUtil
-
- All Implemented Interfaces:
public class SoundUtilA helper class to deal with short notification sounds.
-
-
Method Summary
Modifier and Type Method Description voidloadSoundFromAssets(String assetFileName)Load the sound from the given asset file name (with relative path within the assets). voidplaySound(String assetFileName)Play the sound previously loaded from the given asset file name. voidreleaseSoundPool()Release the sound pool. -
-
Constructor Detail
-
SoundUtil
SoundUtil(Context context)
Create a SoundUtil helper with the given context.- Parameters:
context- the context
-
-
Method Detail
-
loadSoundFromAssets
void loadSoundFromAssets(String assetFileName)
Load the sound from the given asset file name (with relative path within the assets). Load MUST be called before playSound is called.
- Parameters:
assetFileName- the sound file to load (from assets, with relative path within assets)
-
playSound
void playSound(String assetFileName)
Play the sound previously loaded from the given asset file name. loadSoundFromAssets MUST be called before this.
- Parameters:
assetFileName- the sound file to play (same as previously used with load)
-
releaseSoundPool
void releaseSoundPool()
Release the sound pool. This should be called if the util is no longer used. The SoundUtil can no longer be used and the reference should be set to null.
-
-
-
-