일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- 한글
- Portfolio
- ubuntu
- 해석
- 개발
- kakao
- techEmpower
- MySQL
- caddy
- 개발자
- 구글
- mariadb
- php
- C lanuage
- server
- java
- android
- 안드로이드
- NGINX
- 번역
- centOS7
- 컴퓨터과학총론
- C
- it
- H2O
- javascript
- unity
- error
- 자바
- 프래그먼트
- Today
- Total
개발모음집
Unable to retrieve AudioTrack pointer for write() 에러 본문
매트로놈 어플
오디오 트랙을 켰다껐다 반복하니 아래와 같은 에러가 발생
id.crafter E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #3
Process:, PID: 6995
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.IllegalStateException: Unable to retrieve AudioTrack pointer for write()
at android.media.AudioTrack.native_write_byte(Native Method)
at android.media.AudioTrack.write(AudioTrack.java:1761)
at android.media.AudioTrack.write(AudioTrack.java:1704)
at.AudioGenerator.writeSound(AudioGenerator.java:72)
at metronome.Metronome.play(Metronome.java:66)
at MetronomeAsyncTask.doInBackground(TmFragment.java:527)
at MetronomeAsyncTask.doInBackground(TmFragment.java:512)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
해결방안은 여기서
https://stackoverflow.com/questions/23324943/unable-to-retrieve-audiotrack-pointer-for-write
public void destroyAudioTrack() { // 오디오 끄는 역할
if (audioTrack != null && audioTrack.getState() != AudioTrack.STATE_UNINITIALIZED) {
if (audioTrack.getPlayState() != AudioTrack.PLAYSTATE_STOPPED) {
try {
audioTrack.stop(); // 오디오 재생 종료
} catch (IllegalStateException e) {
e.printStackTrace();
}
audioTrack.release(); // 오디오 트랙이 잡은 모든 리소스를 해제시킨다.
}
}
}
}
'Android' 카테고리의 다른 글
액티비티를 다이얼로그처럼 보이게 하기 (테마변경후 에러, 테마 Dialog로 변경후 액션바 없애기) (5) | 2017.06.20 |
---|---|
Error:Conflict with dependency 'com.google.code.findbugs:jsr305' in project ':app'. (0) | 2017.06.19 |
asnktask cancle시 ui 멈춤 (0) | 2017.06.09 |
AudioRecode 에러 (0) | 2017.06.08 |
TarsosDsp 공부 (0) | 2017.06.06 |