void CAHALAudioDevice::GetAvailableDataSources(AudioObjectPropertyScope inScope, UInt32 inChannel, UInt32& ioNumberSources, UInt32* outSources) const { CAPropertyAddress theAddress(kAudioDevicePropertyDataSources, inScope, inChannel); UInt32 theNumberSources = std::min(GetNumberAvailableDataSources(inScope, inChannel), ioNumberSources); UInt32 theSize = theNumberSources * SizeOf32(UInt32); GetPropertyData(theAddress, 0, NULL, theSize, outSources); ioNumberSources = theSize / SizeOf32(UInt32); }
void CAAudioHardwareStream::GetAvailableDataSources(UInt32& ioNumberSources, UInt32* outSources) const { UInt32 theNumberSources = std::min(GetNumberAvailableDataSources(), ioNumberSources); UInt32 theSize = theNumberSources * sizeof(UInt32); GetPropertyData(0, kAudioDevicePropertyDataSources, theSize, outSources); ioNumberSources = theSize / sizeof(UInt32); UInt32* theFirstItem = &(outSources[0]); UInt32* theLastItem = theFirstItem + ioNumberSources; std::sort(theFirstItem, theLastItem); }
UInt32 CAAudioHardwareStream::GetAvailableDataSourceByIndex(UInt32 inIndex) const { AudioStreamID theAnswer = 0; UInt32 theNumberSources = GetNumberAvailableDataSources(); if((theNumberSources > 0) && (inIndex < theNumberSources)) { CAAutoArrayDelete<UInt32> theSourceList(theNumberSources); GetAvailableDataSources(theNumberSources, theSourceList); theAnswer = theSourceList[inIndex]; } return theAnswer; }
UInt32 CAHALAudioDevice::GetAvailableDataSourceByIndex(AudioObjectPropertyScope inScope, UInt32 inChannel, UInt32 inIndex) const { AudioStreamID theAnswer = 0; UInt32 theNumberSources = GetNumberAvailableDataSources(inScope, inChannel); if((theNumberSources > 0) && (inIndex < theNumberSources)) { CAAutoArrayDelete<UInt32> theSourceList(theNumberSources); GetAvailableDataSources(inScope, inChannel, theNumberSources, theSourceList); theAnswer = theSourceList[inIndex]; } return theAnswer; }