SoundPool (SDK 4.0.x), any value other than zero causes a crash

I wonder if anyone can help. I use

Android 4.0.x Developer Kit

Win 7 64-bit platform

using the code specified at http://www.droidnova.com/creating-sound-effects-in-android-part-1,570.html

testing the SoundPool examples presented on the web page and my own testing using SoundPool

I am using Eclipse Version: Indigo Service Release 1 Build ID: 20110916-0149

This is problem

Upon call

SoundPool.play (int soundID, float leftVolume, float rightVolume, int priority, int loop, float rate)

when the 'int loop' is 0 (zero), then everything will be fine and the sound will play perfectly once.

However, any other value for the int loop and you get this error

Sound.Test.namespace AudioFlinger could not create a track, status: -12

Sound.Test.namespace Error creating soundtrack

This happens in the emulator as well as on my Samsung galaxy Nexus phone

I play a small sound clip, it is in the ogg file format, 140K long

I used all types of file formats, wav, mp3 and just like in any file format I use, so this is not an audio file. I need to loop a small audio file indefinitely, setting the int loop to -1 (or any other value) causes a crash.

It drives me crazy because I spent a day and a half on it.

Does anyone know what is going on?

thank you very much,

+4
source share

Source: https://habr.com/ru/post/1388346/


All Articles