• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: MusicDevice confusion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: MusicDevice confusion (From: Chris Reed <email@hidden>)

  • Prev by Date: Re: MusicDevice confusion
  • Next by Date: Help with crash
  • Previous by thread: Re: MusicDevice confusion
  • Next by thread: FindComponent fails on 10.1.5
  • Index(es):
    • Date
    • Thread