From 678b532dad9627600aac03db08003b23a0c9d833 Mon Sep 17 00:00:00 2001 From: jules Date: Wed, 14 Dec 2011 11:41:16 +0000 Subject: [PATCH] Mac VST-host resource file fix. --- .../format_types/juce_VSTPluginFormat.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp index 3dd39df63b..91ec287408 100644 --- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp @@ -2127,6 +2127,8 @@ int VSTPluginInstance::dispatch (const int opcode, const int index, const int va try { #if JUCE_MAC + const int oldResFile = CurResFile(); + if (module->resFileId != 0) UseResFile (module->resFileId); #endif @@ -2134,7 +2136,12 @@ int VSTPluginInstance::dispatch (const int opcode, const int index, const int va result = effect->dispatcher (effect, opcode, index, value, ptr, opt); #if JUCE_MAC - module->resFileId = CurResFile(); + const int newResFile = CurResFile(); + if (newResFile != oldResFile) // avoid confusing the parent app's resource file with the plug-in's + { + module->resFileId = newResFile; + UseResFile (oldResFile); + } #endif } catch (...)