Re: Getting the Source Names
Re: Getting the Source Names
- Subject: Re: Getting the Source Names
- From: Jeff Moore <email@hidden>
- Date: Thu, 10 Apr 2003 12:04:58 -0700
I use code like the following to retrieve the name of a data source
given it's ID:
CFStringRef HLAudioDevice::CopyDataSourceNameForID(Boolean inIsInput,
UInt32 inID) const
{
CFStringRef theAnswer = NULL;
AudioValueTranslation theTranslation = { &inID, sizeof(UInt32),
&theAnswer, sizeof(CFStringRef) };
UInt32 theSize = sizeof(AudioValueTranslation);
OSStatus theError = AudioDeviceGetProperty(mAudioDeviceID, 0,
inIsInput, kAudioDevicePropertyDataSourceNameForIDCFString, & theSize,
&theTranslation);
ThrowIfError(theError, CAException(theError), "HLAudioDevice::
CopyDataSourceNameForID: got an error getting the value of a property");
return theAnswer;
}
On Thursday, April 10, 2003, at 11:12 AM, Robert Penland wrote:
Can anybody tell me what the proper parameter list is for getting the
data
source names using kAudioDevicePropertyDataSourceNameForIDCFString in a
AudioDeviceGetProperty call? What little documentation that I have
found
says that the input parameter should be the source ID (which you get
with
another call) and the output parameter should be a CFStringRef. The
code I
am using is as follows:
CFMutableStringRef theEntryName;
theEntryName = CFStringCreateMutable(NULL,
255);
UInt32 numEntries;
// this finds out the size of the DataSource
ID array
err =
AudioDeviceGetPropertyInfo(theBuiltInID,0,true,kAudioDevicePropertyData
Sourc
es,&thePropSize,&isWritable);
numEntries = thePropSize/sizeof(UInt32);
UInt32 *theEntries;
theEntries = (UInt32 *) malloc(thePropSize);
// this gets the array of DataSource ID's
err =
AudioDeviceGetProperty(theBuiltInID,0,true,kAudioDevicePropertyDataSour
ces,&
thePropSize,theEntries);
for(j=0;j < numEntries;j++)
{
err =
AudioDeviceGetProperty(theBuiltInID,0,true,kAudioDevicePropertyDataSour
ceNam
eForIDCFString,theEntries[j],theEntryName);
}
Everything works and returns values that I would expect up until the
kAudioDevicePropertyDataSourceNameForIDCFString call, where I get a
EXC_BAD_ACCESS error.
I've tried passing pointer to parameters as well, with the same
results.
Any ideas.
Thanks,
Rob
_______________________________________________
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.