Re: IOAudioControl::setCoreAudioPropertyID()
Re: IOAudioControl::setCoreAudioPropertyID()
- Subject: Re: IOAudioControl::setCoreAudioPropertyID()
- From: Jeff Moore <email@hidden>
- Date: Mon, 25 Nov 2002 16:54:29 -0800
The HAL doesn't support that feature of the IOAudio family yet. You'll
need to write a plug-in to translate your custom control into a
property.
On Monday, November 25, 2002, at 02:38 PM, Emmett James wrote:
I have an audio driver for a PCI card and a related app. The card
has a few features that need to be controlled from the app, e.g.
a phantom power on/off switch. I am trying to use some standard
IOAudioSelectorControl and IOAudioToggleControls for this, using the
setCoreAudioPropertyID() method. However, the app cannot find the
properties. Below are code snippets from the app, and the driver.
--------
In the driver, create the control:
fPhantomPower1 = IOAudioSelectorControl::create(0, // init val
AnalogIn1_Left, // channel number
"Mic1 Phantom", // name
kControlId_PhantomPower1, // control ID
kFooSubTypePhantomPower, // subType
kIOAudioControlUsageCoreAudioProperty);
if (fPhantomPower1 != 0)
{
fPhantomPower1->addAvailableSelection(0, "Off");
fPhantomPower1->addAvailableSelection(1, "On");
fPhantomPower1->setCoreAudioPropertyID(kFooPropertyIdPhantom1);
fPhantomPower1-
>setValueChangeHandler((IOAudioControl::IntValueChangeHandler)
SelChangeHandler, this);
fAudioEngine->addDefaultAudioControl(fPhantomPower1);
fPhantomPower1->release();
}
-----------------
In the app:
Getting:
// Get the new phantom power status
UInt32 on = 0;
UInt32 size = sizeof(UInt32);
OSStatus err = AudioDeviceGetProperty(fDeviceId, 1,
kAudioPropertyWildcardSection, kFooPropertyIdPhantom1, &size,
&on);
if (noErr != err)
NSLog(@"Error while getting phantom power: '%.4s'", &err);
Setting:
// Set phantom power on the card
UInt32 on = [fPhantomPower state] == NSOnState ? 1 : 0;
UInt32 size = sizeof(UInt32);
OSStatus err = AudioDeviceSetProperty(fDeviceId, NULL, 1,
kAudioPropertyWildcardSection, kFooPropertyIdPhantom1, size, &on);
if (noErr != err)
NSLog(@"Error while setting phantom power: '%.4s'", &err);
Both of these functions return kAudioHardwareUnknownPropertyError
('who?') when called. I've also tried setting the channel parameter to
kAudioPropertyWildcardChannel, the isInput parameter to YES and NO, and
all combinations thereof. I get the same error in all cases.
BTW, the app talks fine to standard Apple controls such as Volume
controls.
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
--
Jeff Moore
Core Audio
Apple
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.