soundpool 및 MediaPlayer 재생시 아래와 같이코드를 짰는데요 문제는 처음에는 잘 되다가
해당페이지를 껏다 켯다 반복하면 소리가 안나오더라구요
E/AudioTrack: AudioFlinger could not create track, status: -12
E/SoundPool: Error creating AudioTrack
오류는 저렇게 뜨고요 찾아봐도 status: -12 에 대해서는 안나온는데 조언좀 부탁드려요
final int [] sounds;
final SoundPool soundz = new SoundPool(100, AudioManager.STREAM_MUSIC, 100);//음악파일개수//스트림타입STREAM_MUSIC //음질 기본값 0//
sounds = new int[10];
sounds[0] = soundz.load(this, R.raw.keysound, 1);// 현재 화면의 제어권자// 음악 파일 // 우선순위
sounds[1] = soundz.load(this, R.raw.item5sound, 1);
sounds[2] = soundz.load(this, R.raw.item23sound, 1);
class userThread extends Thread{
public void run(){
switch (soundnum){
//키보드소리 1
case 0: soundz.play(sounds[0], 0.5f,0.5f,0,0,1);break;
case 1: soundz.play(sounds[1], 0.5f,0.5f,0,0,1); break;//아이템 5
case 2: soundz.play(sounds[2], 0.5f,0.5f,0,0,1); break;//아이템 23
}
}
}
if(musiconoff.equals("1")){soundnum =0;
Thread th = new userThread();
th.start();
}