What is the limit to cause a kAudio_TooManyFilesOpenError?

I am building an iOS app, that creates MANY instances of AVAudioUnitSampler, all which all load the same sound bank.


Right now it is crashing when it tries to load the sound bank into a second instance.


When it loads the Sample Bank the second time, my app throws a error -42 or kAudio_TooManyFilesOpenError].


Is there any way one can find the limit to how many files CoreAudio can have open [so I can work around the limit] and/or is there anyway to change that limit?


Since, I have a feeling the limit is hard an fast, I am open to suggestions if anyone knows a way to share a Sample Bank between mutliple instances of AVAudioUnitSampler.


Thanks in advance.


Stan

Replies

The open-file-descriptor count is a system value, and cannot be modified by an app.


Given that the number is in the hundreds (or near), may I ask why you need so many AVAudioUnitSamplers?


Just on a hunch, do you know that you can create a AVAudioUnitMIDIInstrument node which uses the MIDISynth AU (16-channel) rather than the Sampler?


AudioComponentDescription desc = { kAudioUnitType_MusicDevice, kAudioUnitSubType_MIDISynth, kAudioUnitManufacturer_Apple, 0, 0 };

AVAudioUnitMIDIInstrument my16ChannelSynth = [[AVAudioUnitMIDIInstrument alloc] initWithAudioComponentDescription:desc];


-DS