Re: Limitations on DefaultOutput unit format converter?
Re: Limitations on DefaultOutput unit format converter?
- Subject: Re: Limitations on DefaultOutput unit format converter?
- From: Christopher Liscio <email@hidden>
- Date: Fri, 16 Oct 2009 17:19:13 -0400
Bill, Doug,
It appears this problem was also occurring in my other code that
discovered this issue swapping out the GenericOutput unit.
So what I've done is the following, in both cases: (apologies if the
code doesn't come across)
UInt32 maxFrames;
UInt32 mfSize = sizeof(maxFrames);
NSXThrowError( AudioUnitGetProperty( outputUnit,
kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global, 0,
&maxFrames, &mfSize ) );
Float64 israte, osrate;
UInt32 srSize = sizeof(israte);
NSXThrowError( AudioUnitGetProperty( outputUnit,
kAudioUnitProperty_SampleRate, kAudioUnitScope_Input, 0, &israte,
&srSize ) );
srSize = sizeof(osrate);
NSXThrowError( AudioUnitGetProperty( outputUnit,
kAudioUnitProperty_SampleRate, kAudioUnitScope_Output, 0, &osrate,
&srSize ) );
DEBUG( @"israte %f, osrate %f", israte, osrate );
maxFrames = maxFrames * MAX( 1.0, ceil( israte / osrate ) );
DEBUG( @"Adjusting maxFrames to %d", maxFrames );
// Set the maximum frames on the other audio units to jive with the
output unit's conversion rate
If you guys see any trouble in my logic above, please let me know.
Thanks for the great help, as usual!
Chris Liscio
http://supermegaultragroovy.com
Learn _your_ music with Capo: http://capoapp.com
On Oct 16, 2009, at 4:18 PM, Christopher Liscio wrote:
Bill,
On Oct 16, 2009, at 3:56 PM, William Stewart wrote:
I think what you are seeing is a max frames error.
...
Awesome. You are correct. However, ...
to fix this on the varispeed AU, you should set MaxFramesPerSlice
to be big enough to handle the IO request the output unit will make
on it (in the case above, I would set this to 2280)
...how would I programmatically determine what the proper value is
here?
I was under the assumption that I queried the output device for its
MaxFramesPerSlice and it'd give me a value that'd make sense given
the sample rate multiplier. I was using this Q&A article as my basis:
http://developer.apple.com/mac/library/qa/qa2007/qa1533.html
...that, combined with the fact that the DefaultOutputUnit basically
wraps an AUConverter (among other things).
Do I instead want to query the input/output rates, and use their
difference as a multiplier to choose the value?
(Can you tell I hate magic numbers?)
I don't know why the 176.4kHz case is failing though, but if you
fix the above, I suspect that will work as well.
Your suspicion is correct. It fixed the problem here as well.
Thanks,
Chris Liscio
http://supermegaultragroovy.com
Learn _your_ music with Capo: http://capoapp.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden