Failing to set kAudioOutputUnitProperty_CurrentDevice to HAL
Failing to set kAudioOutputUnitProperty_CurrentDevice to HAL
- Subject: Failing to set kAudioOutputUnitProperty_CurrentDevice to HAL
- From: Jean-Yves Avenard <email@hidden>
- Date: Tue, 14 Jun 2011 23:38:03 +1000
Hi there.
MacOS 10.6:
I am experiencing an issue in that following playing AC3 digital audio
; changing then to playing plain stereo PCM fails (going in the
opposite direction always works fine).
The error occurs there:
AudioComponent comp = AudioComponentFindNext(NULL, &desc);
if (comp == NULL)
{
Error("AudioComponentFindNext failed");
return false;
}
OSStatus err = AudioComponentInstanceNew(comp, &mComponent);
if (err)
{
Error(QString("AudioComponentInstanceNew returned %1")
.arg(err));
return false;
}
err = AudioUnitSetProperty(mComponent,
kAudioOutputUnitProperty_CurrentDevice,
kAudioUnitScope_Global,
0,
&mDeviceID, sizeof(mDeviceID));
/\/\/\/\ err = -10851
Playing only analog, I can destroy / recreate the AudioUnit as much as
I like. But if previously I was playing an AC3 digital stream, then
kAudioOutputUnitProperty_CurrentDevice fails with error: -10851.
Googling tells me that -10851 is kAudioUnitErr_InvalidPropertyValue).
>From searching, as per
(http://developer.apple.com/library/mac/#technotes/tn2091/_index.html)
usually this error occurs when IO is disabled and mostly seen on input
device which are disabled by default).
And effectively, upon checking IO status with:
UInt32 hasIO = 0;
UInt32 size_hasIO=sizeof(hasIO);
err = AudioUnitGetProperty(mComponent,
kAudioOutputUnitProperty_HasIO,
kAudioUnitScope_Output,
0,
&hasIO, &size_hasIO);
Debug(QString("HasIO = %1").arg(hasIO));
This prints HasIO = 0
So following SPDIF mode (e.g remove hog, re-enabling mixer etc..) ;
the standard device lost IO.
I have tried re-enabling IO:
UInt32 enableIO = 1;
err = AudioUnitSetProperty(mComponent,
kAudioOutputUnitProperty_EnableIO,
kAudioUnitScope_Output,
0,
&enableIO, sizeof(enableIO));
However, kAudioOutputUnitProperty_CurrentDevice still fails (and
checking kAudioOutputUnitProperty_HasIO, still shows that it still do
not have IO, even after attempting to enable it)
Any ideas about what's going on and what I am missing?
I've spent the whole day on this, and I just don't get it :(
Thank you
Jean-Yves
_______________________________________________
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