Re: MusicDevice confusion
Re: MusicDevice confusion
- Subject: Re: MusicDevice confusion
- From: "Chris Reed" <email@hidden>
- Date: Sat, 22 Mar 2003 17:01:26 -0600
>
> I tried to verify this by calling
>
> GetComponentInfo() on comp, but it returns the component name in a
>
> passed argument of type Handle, and I don't know what kind of handle
>
> they mean so I couldn't resolve it into a name. It was also not
>
> possible to access the deviceNameLength and deviceName fields of the
>
> ComponentDescription struct that GetComponentInfo() can optionally
>
> return. Blarg.
>
>
The Handle contains the text of the component name.
>
>
Here's some code to print the name (bad code, but you get the idea):
Oops. I always forget that the string in the handle is a Pascal-string,
not straight text :-)
>
>
Handle name;
>
char nameBuffer[100];
>
int length = GetHandleSize(name);
>
>
HLock(name);
>
memcpy(nameBuffer, *name, length);
This should be:
memcpy(nameBuffer, (*name)[1], length-1);
>
nameBuffer[length] = 0;
>
>
printf("Component name: %s\n", nameBuffer);
>
>
Be sure to pass in a handle of size 0 (created with NewHandle) to the
>
GetComponentInfo() function.
cheers
-chris
_______________________________________________
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.