I\'ve got an app on the Android Market and have been using the SoundPool classes for the sound effects. I\'ve noticed that, of all the parts of the Android API, this seems t
It seems AudioFlinger can have up to 1 Mb worth of audio going on at any given time. The heap errors occur if this limit is exceeded. This guess is based on some code I found in AudioFlinger source code:
AudioFlinger::Client::Client(const sp<AudioFlinger>& audioFlinger, pid_t pid)
: RefBase(),
mAudioFlinger(audioFlinger),
mMemoryDealer(new MemoryDealer(1024*1024)),
mPid(pid)
{
// 1 MB of address space is good for 32 tracks, 8 buffers each, 4 KB/buffer
}
And this:
size_t size = sizeof(audio_track_cblk_t);
size_t bufferSize = frameCount*channelCount*sizeof(int16_t);
if (sharedBuffer == 0) {
size += bufferSize;
}
mCblkMemory = client->heap()->allocate(size);
if (mCblkMemory != 0) {
...
} else {
LOGE("not enough memory for AudioTrack size=%u", size);
client->heap()->dump("AudioTrack");
}
Anyone else better informed?