• 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
AudioUnitHosting menu patch
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AudioUnitHosting menu patch


  • Subject: AudioUnitHosting menu patch
  • From: Marc Poirier <email@hidden>
  • Date: Sun, 10 Aug 2003 13:22:18 -0500 (CDT)

Hi. I was having a hard time with AudioUnitHosting's menu and all of my
dozens of AUs with non-printable sub-type codes, so I changed the menu to
list the component name string rather than the component description
codes. For anyone interested in making the same change, I figured I might
as well share my changes:


void AudioUnitHosting::BuildMenuList (XControl& theControl)
{
MenuRef menu = GetControlPopupMenuHandle (theControl.MacControl());

// clean the old items out
DeleteMenuItems (menu, 1, GetControlMaximum (theControl.MacControl()));

for (int i = 0; i < mNumUnits; ++i)
{
// Marc-style menu item
bool menuItemWasAdded = false;
Component auComponent = FindNextComponent(NULL, &(mCompDescs[i]));
if (auComponent != NULL)
{
ComponentDescription desc2;
Handle nameHandle = NewHandle(sizeof(void*));
OSErr err0r = GetComponentInfo(auComponent, &desc2, nameHandle, NULL, NULL);
if (err0r == noErr)
{
if (nameHandle != NULL)
{
ConstStr255Param nameString = (ConstStr255Param) (*nameHandle);
if (nameString != NULL)
{
AppendMenuItemText(menu, nameString);
menuItemWasAdded = true;
}
}
}
DisposeHandle(nameHandle);
}

// if Marc-style fails, do the original way
if (!menuItemWasAdded)
{
// make a pascal style string, count byte at zero
char menuStr[32];
char* p = menuStr;
p++;
p += sprintf (p, "%4.4s - ", (char*)&(mCompDescs[i].componentType));
p += sprintf (p, "%4.4s - ", (char*)&(mCompDescs[i].componentManufacturer));
p += sprintf (p, "%4.4s", (char*)&(mCompDescs[i].componentSubType));
menuStr[0] = (p - menuStr - 1);
AppendMenuItemText (menu, (ConstStr255Param)menuStr);
}
}

SetControlMaximum (theControl.MacControl(), mNumUnits);
}
_______________________________________________
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.

  • Prev by Date: Re: Open source mixer AU proposal
  • Next by Date: Re: AudioUnitHosting menu patch
  • Previous by thread: Matrix Mixer (was: Open source mixer AU proposal)
  • Next by thread: Re: AudioUnitHosting menu patch
  • Index(es):
    • Date
    • Thread