soundPoolを使用すると、最初のサウンドがループし、残りのスローステータス12がコードになります。
public SoundPool soundPool = new SoundPool(5, AudioManager.STREAM_MUSIC, 100);
public HashMap<Integer, Integer> soundsMap;
public int playSound(int sound, int loop) {
if (curs != sound)
{
curs = sound;
AudioManager mgr = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
float streamVolumeCurrent = mgr.getStreamVolume(AudioManager.STREAM_MUSIC);
float streamVolumeMax = mgr.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
float volume = streamVolumeCurrent / streamVolumeMax;
return soundPool.play(soundsMap.get(sound), volume, volume, 1, loop, 1);
}else
{
return 0;
}
}
ループを-1に設定した場合にのみ発生します。これらは非常に小さなファイルです。