Testing a device for output
Testing a device for output
- Subject: Testing a device for output
- From: Art Gillespie <email@hidden>
- Date: Fri, 18 Nov 2005 12:12:34 -0700
For my current requirements, I only need to enumerate devices that
support output. In my first-pass implementation, I'm testing each of
the enumerated devices returned by kAudioHardwarePropertyDevices for
'output support' by counting the number of outputs in the device's
kAudioDevicePropertyStreamConfiguration (function implementation
below). Is this the sanest way to go about it, or am I missing a
simple mask or different property selector? Thanks.
Art
--
bool doesAudioDeviceDoOutput ( AudioDeviceID inID )
{
AudioObjectPropertyAddress addr;
addr.mSelector = kAudioDevicePropertyStreamConfiguration;
addr.mScope = kAudioDevicePropertyScopeOutput;
addr.mElement = kAudioObjectPropertyElementWildcard;
UInt32 theSize = 0;
GFLASSERT ( AudioObjectGetPropertyDataSize( inID,
&addr,
0,
0,
&theSize ) == noErr );
AudioBufferList* bufList = static_cast<AudioBufferList*>
gfl_alloc(theSize);
OSStatus err = noErr;
GFLASSERT(AudioObjectHasProperty(inID,
&addr));
err = AudioObjectGetPropertyData ( inID,
&addr,
0,
0,
&theSize,
bufList );
if ( bufList->mNumberBuffers == 0 )
{
//no outputs
gfl_free(bufList);
return false;
}
uint32 i;
for ( i = 0; i < bufList->mNumberBuffers; i++ )
{
if ( bufList->mBuffers[i].mNumberChannels == 0 )
{
//zero channels
gfl_free(bufList);
return false;
}
}
gfl_free(bufList);
return true;
}
_______________________________________________
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