From 085b08611b02a38253bbe33e28e724431edd5c2f Mon Sep 17 00:00:00 2001 From: jules Date: Thu, 21 Jun 2012 09:37:02 +0100 Subject: [PATCH] Allowed overriding of the dictionary key used in AU state storage. --- modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm b/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm index c5c55a5099..49b123eba9 100644 --- a/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm +++ b/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm @@ -94,6 +94,11 @@ static const int numChannelConfigs = sizeof (channelConfigs) / sizeof (*channelC #define JuceAUBaseClass AUMIDIEffectBase #endif +// This macro can be set if you need to override this internal name for some reason.. +#ifndef JUCE_STATE_DICTIONARY_KEY + #define JUCE_STATE_DICTIONARY_KEY CFSTR("jucePluginState") +#endif + //============================================================================== /** Somewhere in the codebase of your plugin, you need to implement this function and make it create an instance of the filter subclass that you're building. @@ -297,7 +302,7 @@ public: if (state.getSize() > 0) { CFDataRef ourState = CFDataCreate (kCFAllocatorDefault, (const UInt8*) state.getData(), state.getSize()); - CFDictionarySetValue (dict, CFSTR("jucePluginState"), ourState); + CFDictionarySetValue (dict, JUCE_STATE_DICTIONARY_KEY, ourState); CFRelease (ourState); } } @@ -317,7 +322,7 @@ public: CFDictionaryRef dict = (CFDictionaryRef) inData; CFDataRef data = 0; - if (CFDictionaryGetValueIfPresent (dict, CFSTR("jucePluginState"), (const void**) &data)) + if (CFDictionaryGetValueIfPresent (dict, JUCE_STATE_DICTIONARY_KEY, (const void**) &data)) { if (data != 0) {