Re: Sample rate property listener
Re: Sample rate property listener
- Subject: Re: Sample rate property listener
- From: email@hidden
- Date: Fri, 02 Jun 2006 14:51:44 -0400
Hi Doug,
Thanks very much for the help!
I also don't know why my tester (who has an RME Fireface 800 interface)
is hearing pitch changes when I am not.
In any case, with your recommendations, my listener is getting called,
and I can change sample rates on my synth to match the output device.
I'll send a new version of my program to the tester, and see if his
pitch problems go away...
- Rick
Doug Wyatt wrote:
On Jun 1, 2006, at 15:39 , email@hidden wrote:
In my host, I want to adjust my synth's sample rate to match the
output device's sample rate.
I added a listener to the (AUHAL) output audio unit:
AudioUnitAddPropertyListener(mOutputUnit, kAudioUnitProperty_SampleRate,
DeviceSampleRateListener, this);
I figured that it would be easier to set up the listener once, and
even if a different device is assigned to the output AU, I would not
have to tear down and recreate the listener.
In any case, I cannot figure out how to test my listener. Changing
the sample rate of my output device in Audio MIDI setup does not seem
to call the listener proc. And also the playback pitch seems fine
after I change the sample rate in AMS. Yet one of my testers with
different output hardware reports that for him, changing the SR in
AMS does affect the pitch of the synth.
I'm puzzled about why things are different for you and your tester, but
that's secondary.
The output unit is based on AUConverterBase, providing format
conversion between the input and output, so the notion of it having a
single sample rate is flawed. So it never does anything with
kAudioUnitProperty_SampleRate.
You should be able to listen for kAudioUnitProperty_StreamFormat and
watch for changes on element 0, output scope, which mirrors the
hardware. When the hardware sample rate changes, the output unit will
set up rate conversion (if necessary) between your input sample rate
and the new hardware rate, but when you get the format-change
notification, you can change your input format (sample rate) to match,
to get rid of the rate converter.
Cheers
Doug
--
Doug Wyatt
Core Audio, Apple
_______________________________________________
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