Back to project page Hungry-Mouse.
The source code is released under:
MIT License
If you think the Android project Hungry-Mouse listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
//Name: AndroidSound.java //Purpose: provide the interface to play and release sounds /* w w w.j av a 2 s. c om*/ package com.hungry.mouse.framework.implementation; import com.hungry.mouse.framework.Sound; //android libraries stored in SDK platform import android.media.SoundPool;//manages and plays audio resources public class AndroidSound implements Sound { int soundId; SoundPool soundPool; //constructor public AndroidSound(SoundPool soundPool, int soundId) { this.soundId = soundId; this.soundPool = soundPool; } @Override public void play(float volume) { soundPool.play(soundId, volume, volume, 0, 0, 1); } //close system resource when is no more needed @Override public void dispose() { soundPool.unload(soundId); } }