BbaDdo :: SoundPoool - maxStreams 설정

 

 

 

 

SoundPoool -  MaxStreams 설정

 

In addition to low-latency playback, SoundPool can also manage the number of audio streams being rendered at once. When the SoundPool object is constructed, the maxStreams parameter sets the maximum number of streams that can be played at a time from this single SoundPool. SoundPool tracks the number of active streams. If the maximum number of streams is exceeded, SoundPool will automatically stop a previously playing stream based first on priority and then by age within that priority. Limiting the maximum number of streams helps to cap CPU loading and reducing the likelihood that audio mixing will impact visuals or UI performance.

 

 

사운드 풀의 스트림 최대수는 동시에 출력되는 음악파일의 숫자인데

만일 플레이되려는 스트림수가 최대수 보다 클 경우에는 자동적으로

최초순위에 있는 스트림을 정지시키고 새로운 스트림을 플레이 하게 만든다.

스트림 최대수를 정하는 이유는 cpu 로딩 부담을 줄이고 플레이화면의 포퍼먼스를

해치지 않도록 하기 위함이다.

 

즉, 스트림 최대수는 가능한 최소로 줄이고

maxStreams 값을 초과한 상태에서 SoundPool.play() 메서드에 의한 에러 메서지는

무시해도 된다는 이야기인가?

 

surfaceview 상에서 막대한 양의 소리가 동시에 출력되는 경우라면 에러메서지가

넘쳐나게 된다. 최대한 줄이고 무시하라는 이야기?... 그러나 결국 다운된다.

차라리 현재 플레이되는 스트림갯수를 리턴하는 메서드가 있으면

제어할 수 있을텐데... 없다. 현재로서는 모름.

 

가장 좋은 방법은 maxStreams 값을 최소화 하고

충돌되는 반복 횟수를 로직으로 가능한 줄여나가는 것.

 

Cocos2d-x 의 경우에는 Cocos2dxSound.java 파일에서 이 값을 설정할 수 있다.

 

출처 : http://developer.android.com/reference/android/media/SoundPool.html


카운터

Total : / Today : / Yesterday :
get rsstistory!