UInt32 CAAUMIDIMap::NumberOfMaps (const CFDictionaryRef inData) { CACFDictionary dict (inData, false); if (dict.HasKey (kParamMIDIStr)) { CFArrayRef cfArray; dict.GetArray (kParamMIDIStr, cfArray); CACFArray array (cfArray, false); return array.GetNumberItems(); } return 0; }
static void HP_PreferredChannels_ConstructLayoutFromDictionary(const CACFDictionary& inLayoutDictionary, AudioChannelLayout& outLayout) { // get the tag, bitmap inLayoutDictionary.GetUInt32(CFSTR("channel layout tag"), outLayout.mChannelLayoutTag); inLayoutDictionary.GetUInt32(CFSTR("channel bitmap"), outLayout.mChannelBitmap); // get the number of channels specified in the dictionary UInt32 theNumberChannelsInDictionary = 0; inLayoutDictionary.GetUInt32(CFSTR("number channels"), theNumberChannelsInDictionary); // get the descriptions if they are present and required CFArrayRef __theDescriptions; if((outLayout.mChannelLayoutTag == kAudioChannelLayoutTag_UseChannelDescriptions) && inLayoutDictionary.GetArray(CFSTR("channel descriptions"), __theDescriptions)) { // don't release this array because it came straight out of the dictionary CACFArray theDescriptions(__theDescriptions, false); // get the number of items in the array UInt32 theNumberItems = theDescriptions.GetNumberItems(); // iterate through the array and fill out the struct for(UInt32 theItemIndex = 0; (theItemIndex < theNumberItems) && (theItemIndex < outLayout.mNumberChannelDescriptions); ++theItemIndex) { // get the description CFDictionaryRef __theDescription; if(theDescriptions.GetDictionary(theItemIndex, __theDescription)) { // don't release this dictionary because it came straight out of the array CACFDictionary theDescription(__theDescription, false); // get the channel label and flags theDescription.GetUInt32(CFSTR("channel label"), outLayout.mChannelDescriptions[theItemIndex].mChannelLabel); theDescription.GetUInt32(CFSTR("channel flags"), outLayout.mChannelDescriptions[theItemIndex].mChannelFlags); // get the coordinates CFArrayRef __theCoordinates; if(theDescription.GetArray(CFSTR("coordinates"), __theCoordinates)) { // don't release this array because it came straight out of the dictionary CACFArray theCoordinates(__theCoordinates, false); // iterate through the array and get the coordinates UInt32 theNumberCoordinates = theCoordinates.GetNumberItems(); for(UInt32 theCoordinateIndex = 0; (theCoordinateIndex < 3) && (theCoordinateIndex < theNumberCoordinates); ++theCoordinateIndex) { theCoordinates.GetFloat32(theCoordinateIndex, outLayout.mChannelDescriptions[theItemIndex].mCoordinates[theCoordinateIndex]); } } } } } }