package com.uoc.educationalVG.framework.impl;

import android.media.SoundPool;

import com.uoc.educationalVG.framework.Sound;

public class AndroidSound implements Sound {
	int soundId;
	SoundPool soundPool;

	public AndroidSound(SoundPool soundPool, int soundId) {
		this.soundId = soundId;
		this.soundPool = soundPool;
	}

	/**
	 * Stores the SoundPool and the ID of the loaded sound effect for later
	 * playback and disposal
	 */
	@Override
	public void play(float volume) {
		soundPool.play(soundId, volume, volume, 0, 0, 1);
	}

	@Override
	public void dispose() {
		soundPool.unload(soundId);
	}

}
