Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public SoundPlayer(Context context) {
- this.context = context;
- AudioManager audioManager = (AudioManager) context.getSystemService(Service.AUDIO_SERVICE);
- soundPool = new SoundPool(3, AudioManager.STREAM_MUSIC, 0);
- clickId = soundPool.load(context, R.raw.bubbleclick, -1);
- errId = soundPool.load(context, R.raw.bubbleclickerror, 1);
- countId = soundPool.load(context, R.raw.countdowntick, 1);
- float actualVolume = (float) audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
- float maxVolume = (float) audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
- volume = actualVolume / maxVolume;
- }
- public void playBubbleClick() {
- if (!isMuted()) {
- soundPool.play(clickId, volume, volume, 1, 0, 1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement