• 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: How to set buffer size for Audio Output Unit?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to set buffer size for Audio Output Unit?


  • Subject: Re: How to set buffer size for Audio Output Unit?
  • From: Doug Wyatt <email@hidden>
  • Date: Fri, 31 Aug 2001 07:15:16 -0700

On Friday, August 31, 2001, at 05:16 , Christof Faller wrote:
Would it be a big deal for Apple to provide such a buffer-size setting
capability with
AudioOutputUnits for future version of CoreAudio? I believe that would
greatly
benefit low-latency real-time applications on MacOS X.

One thing you can do now is ask the output unit for the underlying AudioDevice it is talking to, and change its buffer size via the lower-level API:

AudioDeviceID theDevice = NULL;
UInt32 size = sizeof(theDevice);
error = AudioUnitGetProperty( theOutputUnit,
kAudioOutputUnitProperty_CurrentDevice,
kAudioUnitScope_Global,
0,
&device,
&size);

if (device != NULL) {
AudioTimeStamp ts;
ts.mFlags = 0;
UInt32 bufferSize = 256;
error = AudioDeviceSetProperty( device,
&ts, // I think NULL may work here too
0,
0,
kAudioDevicePropertyBufferFrameSize,
sizeof(UInt32),
&bufferSize);
}

kAudioDevicePropertyBufferFrameSize is in bytes; you can also use kAudioDevicePropertyBufferFrameSize which is a number of frames (unless that's new for 10.1, I can't remember offhand).

In either case, this will control the number of frames that the output device will be asked to render per wakeup, and it will call you for the same number of frames (adjusted if there is sample rate conversion).

hth,
Doug

--
Doug Wyatt
work: email@hidden (CoreAudio)
personal: email@hidden http://www.sonosphere.com

"There is real magic in enthusiasm.
It spells the difference between mediocrity and accomplishment."
-- Norman Vincent Peale


  • Follow-Ups:
    • Re: How to set buffer size for Audio Output Unit?
      • From: Christof Faller <email@hidden>
    • Re: How to set buffer size for Audio Output Unit?
      • From: Jeff Moore <email@hidden>
References: 
 >Re: How to set buffer size for Audio Output Unit? (From: Christof Faller <email@hidden>)

  • Prev by Date: AudioDeviceStop
  • Next by Date: Re: AudioDeviceStop
  • Previous by thread: Re: How to set buffer size for Audio Output Unit?
  • Next by thread: Re: How to set buffer size for Audio Output Unit?
  • Index(es):
    • Date
    • Thread