• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Sample rate property listener
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sample rate property listener


  • Subject: Re: Sample rate property listener
  • From: Doug Wyatt <email@hidden>
  • Date: Fri, 2 Jun 2006 10:35:36 -0700

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


  • Follow-Ups:
    • Re: Sample rate property listener
      • From: email@hidden
References: 
 >Sample rate property listener (From: email@hidden)

  • Prev by Date: Re: Converting AudioTimeStamp between two devices
  • Next by Date: Re: Sample rate property listener
  • Previous by thread: Sample rate property listener
  • Next by thread: Re: Sample rate property listener
  • Index(es):
    • Date
    • Thread