Re: AudioDeviceSetProperty(.., kAudioDevicePropertyBufferSize, ..) fails with buffer > 27KB
Re: AudioDeviceSetProperty(.., kAudioDevicePropertyBufferSize, ..) fails with buffer > 27KB
- Subject: Re: AudioDeviceSetProperty(.., kAudioDevicePropertyBufferSize, ..) fails with buffer > 27KB
- From: Jeff Moore <email@hidden>
- Date: Tue, 28 Jul 2009 14:13:49 -0700
First off, kAudioDevicePropertyBufferSize has long since been
deprecated (since at least 10.2, possibly longer). You would do well
to stop using it and start using kAudioDevicePropertyBufferFrameSize
instead. Please see the comments in <CoreAudio/AudioHardware.h> for
more info.
On Jul 28, 2009, at 1:48 PM, noah williamsson wrote:
Since Mac OS X 10.5.7 I'm unable to set the buffer size to 32KB with
AudioDeviceSetProperty(.., kAudioDevicePropertyBufferSize, ..).
The call fails and returns 1852797029.
1852797029 == kAudioHardwareIllegalOperationError
This most likely means that 32k is too large of a buffer size for the
given device. Note that you can get the range using
kAudioDevicePropertyBufferSizeRange (which is also deprecated in favor
of kAudioDevicePropertyBufferFrameSizeRange).
The largest buffer size (in increments of 1024) I've found working
is 27KB(!).
This makes me believe I've screwed something up when I'm initializing
CoreAudio as I've seen others use 32KB for the size of the audio
buffer.
Each audio device has it's own range of supported buffer sizes. For
example, 32k is 4096 frames of audio data when there are two channels
of 32 bit floating point samples. 4096 is a pretty large IO buffer
size that not every device is going to support. If you are talking
about a mono device, that 32k turns into 8192 sample frames. For an 8
channel device, the 32k is 512 frames.
I'm quite new to CoreAudio and would love to hear an explanation of
what I'm doing wrong.
Aside from using deprecated API, the main thing you are doing wrong is
assuming that every audio device is exactly like every other device.
As you are seeing here, this is not true. You definitely need to use
the API that allows you to probe what the device supports before
blindly setting a value.
--
Jeff Moore
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