안드로이드 개발 질문/답변
(글 수 45,052)
버튼 눌러서 sound 출력하는 app을 만들려고 합니다..
아래 처럼 작성 했는데요..
load 가 안되네요..
문제 될만한 내용이 없는 짧은 코드인데.. 작동이 안되니.. 참;;
로딩 중.
12-11 23:35:59.960: ERROR/SoundPool(523): Sample channel count (0) out of range
이런 에러가 나오네요.. 어떤 에러인지 혹시..
public class Test extends Activity {
/** Called when the activity is first created. */
private SoundPool soundPool;
private int sound_1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
soundPool = new SoundPool(8, AudioManager.STREAM_MUSIC, 0);
sound_1 = soundPool.load(getApplicationContext(), R.raw.sound_1, 1);
Button button_kick;
button_kick = (Button)findViewById(R.id.sound);
button_kick.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0) {
soundPool.play(sound_1, 1f, 1f, 0, 0, 1f);
}
});
}
}
아래 처럼 작성 했는데요..
load 가 안되네요..
문제 될만한 내용이 없는 짧은 코드인데.. 작동이 안되니.. 참;;
로딩 중.
12-11 23:35:59.960: ERROR/SoundPool(523): Sample channel count (0) out of range
이런 에러가 나오네요.. 어떤 에러인지 혹시..
public class Test extends Activity {
/** Called when the activity is first created. */
private SoundPool soundPool;
private int sound_1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
soundPool = new SoundPool(8, AudioManager.STREAM_MUSIC, 0);
sound_1 = soundPool.load(getApplicationContext(), R.raw.sound_1, 1);
Button button_kick;
button_kick = (Button)findViewById(R.id.sound);
button_kick.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0) {
soundPool.play(sound_1, 1f, 1f, 0, 0, 1f);
}
});
}
}
이리저리 뒤져보니..
mp3는 재생이 안되고, wav나 acc 등의 포맷 중에 짧은거 (6초 이하 정도)
만 재생이 된다고 합니다.