안드로이드 개발 정보
(글 수 1,067)
효과음 사용시 무거운 MediaPlayer 가 아닌 SoundPool 사용을 권장하는 가이드 블로그가 있어서 링크합니다.
자세히 설명이 되어 있는데 영어라 좀 알아먹기 힘들군요 ㅎㅎ
본문 예제샘플
http://www.droidnova.com/blog/wp-content/uploads/2009/10/SoundTutorial.zip
2010.04.12 16:51:06
말이 권장이지 MediaPlayer로 효과음 구현시 여러 소리가 나오다보면
실제 기기에서는 어떨지 모르지만 에뮬에서는 버벅거림이 심해서 못쓰겠더군요...
2010.04.12 21:42:12
추가로 아래 코드처럼 volume을 잡아줘야 정상적인 볼륨 레벨이 적용됩니다.~
current volume이 max1의 float 변수로 오질 않더라구요.
public void playSound(int index) { float streamCurrent = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC); float streamMax = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC); float streamVolume = streamCurrent / streamMax; mSoundPool.play(mSoundPoolMap.get(index), streamVolume, streamVolume, 1, 0, 1f); }
얼핏 보면 별것 아닌것처럼 여길수 있지만, 이런 쪽도 빠짐없이 체크해야될 부분이죠^^