| 1191 | } |
| 1192 | |
| 1193 | OSStatus auSetProperty(const AudioUnitPropertyID inProp, |
| 1194 | const AudioUnitScope inScope, |
| 1195 | const AudioUnitElement inElement, |
| 1196 | const void* const inData, |
| 1197 | const UInt32 inDataSize) |
| 1198 | { |
| 1199 | switch (inProp) |
| 1200 | { |
| 1201 | case kAudioUnitProperty_ClassInfo: |
| 1202 | DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Global, inScope, kAudioUnitErr_InvalidScope); |
| 1203 | DISTRHO_SAFE_ASSERT_UINT_RETURN(inElement == 0, inElement, kAudioUnitErr_InvalidElement); |
| 1204 | DISTRHO_SAFE_ASSERT_UINT_RETURN(inDataSize == sizeof(CFPropertyListRef), inDataSize, kAudioUnitErr_InvalidPropertyValue); |
| 1205 | { |
| 1206 | const CFPropertyListRef propList = *static_cast<const CFPropertyListRef*>(inData); |
| 1207 | DISTRHO_SAFE_ASSERT_RETURN(CFGetTypeID(propList) == CFDictionaryGetTypeID(), kAudioUnitErr_InvalidPropertyValue); |
| 1208 | |
| 1209 | restoreClassInfo(static_cast<CFDictionaryRef>(propList)); |
| 1210 | } |
| 1211 | return noErr; |
| 1212 | |
| 1213 | case kAudioUnitProperty_MakeConnection: |
| 1214 | DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Input, inScope, kAudioUnitErr_InvalidScope); |
| 1215 | DISTRHO_SAFE_ASSERT_UINT_RETURN(inElement == 0, inElement, kAudioUnitErr_InvalidElement); |
| 1216 | DISTRHO_SAFE_ASSERT_UINT_RETURN(inDataSize == sizeof(AudioUnitConnection), inDataSize, kAudioUnitErr_InvalidPropertyValue); |
| 1217 | #if DISTRHO_PLUGIN_NUM_INPUTS != 0 |
| 1218 | { |
| 1219 | const AudioUnitConnection conn = *static_cast<const AudioUnitConnection*>(inData); |
| 1220 | |
| 1221 | if (conn.sourceAudioUnit == nullptr) |
| 1222 | { |
| 1223 | fInputConnectionBus = 0; |
| 1224 | fInputConnectionUnit = nullptr; |
| 1225 | return noErr; |
| 1226 | } |
| 1227 | |
| 1228 | AudioStreamBasicDescription desc; |
| 1229 | std::memset(&desc, 0, sizeof(desc)); |
| 1230 | UInt32 dataSize = sizeof(AudioStreamBasicDescription); |
| 1231 | if (AudioUnitGetProperty(conn.sourceAudioUnit, |
| 1232 | kAudioUnitProperty_StreamFormat, |
| 1233 | kAudioUnitScope_Output, |
| 1234 | conn.sourceOutputNumber, &desc, &dataSize) != noErr) |
| 1235 | return kAudioUnitErr_InvalidPropertyValue; |
| 1236 | |
| 1237 | DISTRHO_SAFE_ASSERT_INT_RETURN(desc.mFormatID == kAudioFormatLinearPCM, |
| 1238 | desc.mFormatID, kAudioUnitErr_FormatNotSupported); |
| 1239 | DISTRHO_SAFE_ASSERT_INT_RETURN(desc.mBitsPerChannel == 32, |
| 1240 | desc.mBitsPerChannel, kAudioUnitErr_FormatNotSupported); |
| 1241 | DISTRHO_SAFE_ASSERT_INT_RETURN(desc.mBytesPerFrame == sizeof(float), |
| 1242 | desc.mBytesPerFrame, kAudioUnitErr_FormatNotSupported); |
| 1243 | DISTRHO_SAFE_ASSERT_INT_RETURN(desc.mBytesPerPacket == sizeof(float), |
| 1244 | desc.mBytesPerPacket, kAudioUnitErr_FormatNotSupported); |
| 1245 | DISTRHO_SAFE_ASSERT_INT_RETURN(desc.mFramesPerPacket == 1, |
| 1246 | desc.mFramesPerPacket, kAudioUnitErr_FormatNotSupported); |
| 1247 | DISTRHO_SAFE_ASSERT_INT_RETURN(desc.mFormatFlags == kWantedAudioFormat, |
| 1248 | desc.mFormatFlags, kAudioUnitErr_FormatNotSupported); |
| 1249 | #ifdef DISTRHO_PLUGIN_EXTRA_IO |
| 1250 | DISTRHO_SAFE_ASSERT_UINT_RETURN(desc.mChannelsPerFrame == fNumInputs, |
nothing calls this directly
no test coverage detected