MCPcopy Create free account
hub / github.com/DISTRHO/DPF / restoreClassInfo

Function restoreClassInfo

distrho/src/DistrhoPluginAU.cpp:2644–2792  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2642 }
2643
2644 void restoreClassInfo(const CFDictionaryRef clsInfo)
2645 {
2646 CFDictionaryRef data = nullptr;
2647 DISTRHO_SAFE_ASSERT_RETURN(CFDictionaryGetValueIfPresent(clsInfo,
2648 CFSTR(kAUPresetDataKey),
2649 reinterpret_cast<const void**>(&data)),);
2650 DISTRHO_SAFE_ASSERT_RETURN(CFGetTypeID(data) == CFDictionaryGetTypeID(),);
2651
2652 #if DISTRHO_PLUGIN_WANT_PROGRAMS
2653 CFNumberRef programRef = nullptr;
2654 if (CFDictionaryGetValueIfPresent(data, CFSTR("program"), reinterpret_cast<const void**>(&programRef))
2655 && CFGetTypeID(programRef) == CFNumberGetTypeID())
2656 {
2657 SInt32 program = -1;
2658 if (CFNumberGetValue(programRef, kCFNumberSInt32Type, &program))
2659 {
2660 fCurrentProgram = program;
2661
2662 if (program >= 0)
2663 {
2664 fLastFactoryProgram = program;
2665 fPlugin.loadProgram(fLastFactoryProgram);
2666 notifyPropertyListeners('DPFo', kAudioUnitScope_Global, 0);
2667 }
2668
2669 notifyPropertyListeners(kAudioUnitProperty_PresentPreset, kAudioUnitScope_Global, 0);
2670 }
2671 }
2672 #endif
2673
2674 #if DISTRHO_PLUGIN_WANT_STATE
2675 CFArrayRef statesRef = nullptr;
2676 if (CFDictionaryGetValueIfPresent(data, CFSTR("states"), reinterpret_cast<const void**>(&statesRef))
2677 && CFGetTypeID(statesRef) == CFArrayGetTypeID())
2678 {
2679 const CFIndex numStates = CFArrayGetCount(statesRef);
2680 char* key = nullptr;
2681 char* value = nullptr;
2682 CFIndex keyLen = -1;
2683 CFIndex valueLen = -1;
2684
2685 for (CFIndex i=0; i<numStates; ++i)
2686 {
2687 const CFDictionaryRef state = static_cast<CFDictionaryRef>(CFArrayGetValueAtIndex(statesRef, i));
2688 DISTRHO_SAFE_ASSERT_BREAK(CFGetTypeID(state) == CFDictionaryGetTypeID());
2689 DISTRHO_SAFE_ASSERT_BREAK(CFDictionaryGetCount(state) == 1);
2690
2691 CFStringRef keyRef = nullptr;
2692 CFStringRef valueRef = nullptr;
2693 CFDictionaryGetKeysAndValues(state,
2694 reinterpret_cast<const void**>(&keyRef),
2695 reinterpret_cast<const void**>(&valueRef));
2696 DISTRHO_SAFE_ASSERT_BREAK(keyRef != nullptr && CFGetTypeID(keyRef) == CFStringGetTypeID());
2697 DISTRHO_SAFE_ASSERT_BREAK(valueRef != nullptr && CFGetTypeID(valueRef) == CFStringGetTypeID());
2698
2699 const CFIndex keyRefLen = CFStringGetLength(keyRef);
2700 if (keyLen < keyRefLen)
2701 {

Callers 1

auSetPropertyFunction · 0.85

Calls 4

notifyPropertyListenersFunction · 0.85
loadProgramMethod · 0.80
setStateMethod · 0.45
setParameterValueMethod · 0.45

Tested by

no test coverage detected