My SoundManager 클래스는 SoundPool을 오디오 용으로 사용합니다. 멈추라는 소리가 들릴 때까지 1 초에서 2 초 정도 반복되는 소리가납니다. 문제는이 작업이 한 번 실행 된 다음 logcat에서 "SoundPool : AudioTrack을 만드는 중 오류가 발생했습니다"라는 오류를 확인한 후 "AudioTrack : AudioFlinger가 트랙을 만들지 못했습니다. 상태 : -12"입니다. 내 코드는 아래에 있습니다. 어떤 오류 메시지가 나옵니까?Android SoundPool : AudioFlinger 오류
public class SoundManager {
public SoundManager(Context c) {
mContext = c;
sp = new SoundPool(1,AudioManager.STREAM_MUSIC,0);
spSound = sp.load(mContext, R.raw.tone4402, 1);
}
public void Tone3(int timer) {
(new Thread(t3)).start();
}
final Runnable t3 = new Runnable() {
public void run() {
if(isPlaying == false) {
isPlaying = true;
Tone3Run();
}
}
};
public static void Tone3Run() {
//1 sec on, 2 sec off, repeat for 2 minute
Log.d("Sound", "Tone3 Playing");
long startTime = System.currentTimeMillis();
long currentTime;
do
{
currentTime = System.currentTimeMillis();
Log.e("Sound Manager", "Time:" + (currentTime - startTime));
temp = sp.play(spSound, currentVolume, currentVolume, 1, -1, (float)1.0);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
sp.pause(temp);
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
} while(((currentTime - startTime) < 120000) && (boolStop = false));
sp.release();
sp = new SoundPool(1, 4, 0);
spSound = sp.load(mContext, R.raw.tone4402, 1);
isPlaying = false;
}
'-12'는'ENOMEM'이거나 '메모리 부족'입니다. [오류 코드] (http://www.barricane.com/c-error-codes-include-errno) – Tim
머리를 주셔서 감사합니다 문제를 해결할 수있었습니다. – Dogz1