I'm using OpenSL ES and my android app has need for multiple channels, so I create multiple player-objects (plus one player-object for each of mp3-files I need to play). This works fine for one application, but when I ran another app I've created, it will fail to play any sound and log files say
E/AudioFlinger( 119): no more track names available
E/AudioTrack( 6884): AudioFlinger could not create track, status: -12
E/libOpenSLES( 6884): AudioTrack::initCheck status 4294967284
W/libOpenSLES( 6884): Leaving Object::Realize (SL_RESULT_CONTENT_UNSUPPORTED)
Okay, I've read that this means I'm out of free objects and I should release some objects.
However, according to http://mobilepearls.com/labs/native-android-api/opensles/
OpenSL ES for Android supports a single engine per application, and up to 32 objects
So is that 32 objects per application, or is it globally 32 objects? If so, I'm forced to Destroy() (and recreate) Player-objects every time my app becomes inactive (onPause/onStop)?
It appears to be 32 objects per device. So it's better to Destroy
them whenever not needed (onStop
, onDestroy
)