GabePlaysDrums
New member
I was looking at the source code for the Audio Library's pooled memory allocator in AudioStream.cpp, and I noticed that the number of blocks is clamped to 192.
I have a couple of questions about how things work:
1. Can I have a pool larger than 192 blocks, or will the allocator only use the first 192 blocks in the array?
2. If larger pools are supported, how does the allocator determine when all blocks have been used? Can it overflow into other memory?
I have a couple of questions about how things work:
1. Can I have a pool larger than 192 blocks, or will the allocator only use the first 192 blocks in the array?
2. If larger pools are supported, how does the allocator determine when all blocks have been used? Can it overflow into other memory?
Code:
// Set up the pool of audio data blocks
// placing them all onto the free list
void AudioStream::initialize_memory(audio_block_t *data, unsigned int num)
{
unsigned int i;
//Serial.println("AudioStream initialize_memory");
//delay(10);
[B]if (num > 192) num = 192;[/B]
__disable_irq();
memory_pool = data;
for (i=0; i < 6; i++) {
memory_pool_available_mask[i] = 0;
}
for (i=0; i < num; i++) {
memory_pool_available_mask[i >> 5] |= (1 << (i & 0x1F));
}
for (i=0; i < num; i++) {
data[i].memory_pool_index = i;
}
__enable_irq();
}