AAE2: 17 is max number of AEAudioFilePlayerModules??
Hi,
I'm hoping to be able to increase the upper limit on the amount of players before getting the continuous "Couldn't push a buffer. Add a breakpoint on AEBufferStackPushFailed to debug." messages, which correspond to no new audio being added to the output.
Right now this happens at 17 players. Is there any way to make this number higher?
My render block code is below.
Thanks,
Chris
renderer.block = ^(const AERenderContext *context)
{
int count = 0;
AEArrayToken playerToken = AEArrayGetToken(_playerValues);
int playerCount = AEArrayGetCount(playerToken);
for(int i = 0 ; i < playerCount ; i++)
{
__unsafe_unretained AEAudioFilePlayerModule * player = (__bridge AEAudioFilePlayerModule *)(AEArrayGetItem(playerToken, i));
if(player)
{
AEModuleProcess(player, context);
count++;
}
}
AEBufferStackMix(context->stack, count);
AERenderContextOutput(context, 1);
}
Comments
Note that the audio files are of variable length and are being recorded as .m4a's with AEAudioFileRecorderModule
The main issue is the structure of your loop - you're pushing a new buffer for each player, but that's not necessary; if you move AEBufferStackMix(context->stack, 2) into the body of your per-track loop, then it'll only ever need a maximum of 2 buffers.
Or, better yet, use AEMixerModule instead, which has all that sorted, along with mixing parameters.
Thank you ! I'll check out the mixer module. Does this mean there isn't a definite track limit?
I've been able to get up to 50 before running out of memory.
Pretty much, yes: the only constraint upon number of modules is the memory required for the actual module instances -- which is class-dependent, of course; the audio file player will take bit for buffers and such.