Hey folks,
Say you have an audio call back:
void compute_audio(const AudioTimeStamp *time, UInt32 numFrames,
AudioBufferList *inAudio,AudioBufferList *audio)
{
//do your DSP …
}
If nothing unusual is going on, and you set the preferred IO Buffer duration to
5 msec, then numFrames
would be 256.
Also, importantly, lets say you are NOT allowing microphone input.
Now lets say you start playing a track iTunes.
You will see buffer size increases to 1024 - meaning there will
be more latency, which is bad for my app as it is used for real-time
performance, not merely playback.
Now, let’s say that you DO allow microphone input.
Now repeat the experimentL Start playing a track iTunes. You will see buffer
size is 256, which is you wanted in the first place.
The problem is I specifically I do NOT support microphone input in this app,
and I don’t want to the user to think
there is microphone input.
I did my testing on an iPad2 and iPadPro
Is there any way I can configure core audio so I get the 256 frames I want even
if microphone input is not enabled?
This seems like a bug.
You can easily reproduce this with “The Engine Sample”:
https://github.com/TheAmazingAudioEngine/TheAmazingAudioEngine
Just print out numFrames
Thanks for any insight
- Nick
Here are my mods to The Engine Sample to illustrate the problem (my changes in
RED):
// Create an instance of the audio controller, set it up and start it
running
self.audioController = [[AEAudioController alloc]
initWithAudioDescription:AEAudioStreamBasicDescriptionNonInterleavedFloatStereo
inputEnabled:NO];
_audioController.preferredBufferDuration = 0.005;
_audioController.useMeasurementMode = YES;
[_audioController start:NULL];
self.oscillator = [AEBlockChannel channelWithBlock:^(const
AudioTimeStamp *time,
UInt32
frames,
AudioBufferList
*audio) {
static int passes = 0;
if (++passes % 100 == 0) {
printf("frame size=%d\n", (int)frames);
}
for ( int i=0; i<frames; i++ ) {
// Quick sin-esque oscillator
float x = oscillatorPosition;
x *= x; x -= 1.0; x *= x; // x now in the range 0...1
x *= INT16_MAX;
x -= INT16_MAX / 2;
oscillatorPosition += oscillatorRate;
if ( oscillatorPosition > 1.0 ) oscillatorPosition -= 2.0;
((SInt16*)audio->mBuffers[0].mData)[i] = x;
((SInt16*)audio->mBuffers[1].mData)[i] = x;
}
}];
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com
This email sent to [email protected]