본문 바로가기

프로그래밍/Android

SoundPool Constructor deprecated 해결

 

API Level 21부터 deprecated 되었다.

 

왜 deprecated 되었는지는 stackFlow에 어떤 분이 답변을 달아주셨다.

https://stackoverflow.com/questions/39184157/android-why-is-the-constructor-for-soundpool-deprecated

 

기존 SouncPool 생성자에는 maxStreams, streamType, srcQuality가 들어갔다.

 

하지만, maxStreams는 이제 명시적으로 설정할 필요가 없고, streamType을 쓰는 것보다 AudioAttributes를 사용하면 더 많은 세팅값을 줄 수 있고, srcQuality 매개변수는 없어졌기 때문에 SoundPool 생성자를 쓰는 것보다 SoundPool.Builder를 쓰는 것이 더 낫다...!