Problems when changing sample rate on a aggregate device (OSX 10.5.1)
Problems when changing sample rate on a aggregate device (OSX 10.5.1)
- Subject: Problems when changing sample rate on a aggregate device (OSX 10.5.1)
- From: Stéphane Letz <email@hidden>
- Date: Mon, 3 Dec 2007 17:18:03 +0100
Hi,
We have code that use the AUHAL and possibly uses an aggregate device.
We sometime want to change the sample rate of the aggregate device. We
do that with the following code:
fDeviceID is the underling aggregate device, "samplerate" is the new
wanted SR.
1)
// Check input sample rate
outSize = sizeof(AudioStreamBasicDescription);
err = AudioDeviceGetProperty(fDeviceID, 0, true,
kAudioDevicePropertyStreamFormat, &outSize, &sampleRate);
if (err != noErr) {
.....
}
// Possibly change it
if (samplerate != (unsigned long)sampleRate.mSampleRate) {
sampleRate.mSampleRate = (Float64)samplerate;
err = AudioDeviceSetProperty(fDeviceID, NULL, 0, true,
kAudioDevicePropertyStreamFormat, outSize, &sampleRate);
if (err != noErr) {
.....
}
}
2)
// Check ouput sample rate
outSize = sizeof(AudioStreamBasicDescription);
err = AudioDeviceGetProperty(fDeviceID, 0, false,
kAudioDevicePropertyStreamFormat, &outSize, &sampleRate);
if (err != noErr) {
.....
}
// Possibly change it
if (samplerate != (unsigned long)sampleRate.mSampleRate) {
sampleRate.mSampleRate = (Float64)samplerate;
err = AudioDeviceSetProperty(fDeviceID, NULL, 0, false,
kAudioDevicePropertyStreamFormat, outSize, &sampleRate);
if (err != noErr) {
.....
}
}
When actually changing the SR value, 1) succeed but 2) fails already
in " Check ouput sample rate" part: we get an
"kAudioHardwareUnknownPropertyError" error.
Is this a bug? Is this way of doing obsolete?
Thanks
Stephane Letz
_______________________________________________
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