OSStatus AUMIDIBase::DelegateGetProperty()

in Source/AUMIDIBase.cpp [78:123]


OSStatus AUMIDIBase::DelegateGetProperty(
	AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement inElement, void* outData)
{
	(void)inScope;
	(void)inElement;
	(void)outData;

	OSStatus result = noErr;

	switch (inID) { // NOLINT if/else?!
#if AUSDK_HAVE_XML_NAMES
	case kMusicDeviceProperty_MIDIXMLNames:
		AUSDK_Require(inScope == kAudioUnitScope_Global, kAudioUnitErr_InvalidScope);
		AUSDK_Require(inElement == 0, kAudioUnitErr_InvalidElement);
		result = GetXMLNames(static_cast<CFURLRef*>(outData));
		break;
#endif

#if AUSDK_HAVE_MIDI_MAPPING
	case kAudioUnitProperty_AllParameterMIDIMappings: {
		AUSDK_Require(mMIDIMapper, kAudioUnitErr_InvalidProperty);
		AUSDK_Require(inScope == kAudioUnitScope_Global, kAudioUnitErr_InvalidScope);
		AUSDK_Require(inElement == 0, kAudioUnitErr_InvalidElement);
		AUParameterMIDIMapping* maps = (static_cast<AUParameterMIDIMapping*>(outData));
		mMIDIMapper->GetMaps(maps);
		result = noErr;
		break;
	}

	case kAudioUnitProperty_HotMapParameterMIDIMapping: {
		AUSDK_Require(mMIDIMapper, kAudioUnitErr_InvalidProperty);
		AUSDK_Require(inScope == kAudioUnitScope_Global, kAudioUnitErr_InvalidScope);
		AUSDK_Require(inElement == 0, kAudioUnitErr_InvalidElement);
		AUParameterMIDIMapping* map = (static_cast<AUParameterMIDIMapping*>(outData));
		mMIDIMapper->GetHotParameterMap(*map);
		result = noErr;
		break;
	}
#endif

	default:
		result = kAudioUnitErr_InvalidProperty;
		break;
	}
	return result;
}