Browse Source

AU Client: Use ScopedJuceInitialiser_GUI to ensure the MessageManager exists

This makes the AU Client compatible with other classes also using the
ScopedJuceInitialiser_GUI, specifically the ARADocumentController.
v7.0.12
attila 2 years ago
parent
commit
4f4ddf9733
2 changed files with 8 additions and 14 deletions
  1. +5
    -14
      modules/juce_audio_plugin_client/juce_audio_plugin_client_AU_1.mm
  2. +3
    -0
      modules/juce_events/messages/juce_Initialisation.h

+ 5
- 14
modules/juce_audio_plugin_client/juce_audio_plugin_client_AU_1.mm View File

@@ -89,18 +89,14 @@ template <> struct ContainerDeletePolicy<const __CFString> { static void destr
// make sure the audio processor is initialized before the AUBase class // make sure the audio processor is initialized before the AUBase class
struct AudioProcessorHolder struct AudioProcessorHolder
{ {
AudioProcessorHolder (bool initialiseGUI)
AudioProcessorHolder()
{ {
if (initialiseGUI)
initialiseJuce_GUI();
juceFilter = createPluginFilterOfType (AudioProcessor::wrapperType_AudioUnit);
// audio units do not have a notion of enabled or un-enabled buses // audio units do not have a notion of enabled or un-enabled buses
juceFilter->enableAllBuses(); juceFilter->enableAllBuses();
} }
std::unique_ptr<AudioProcessor> juceFilter;
ScopedJuceInitialiser_GUI scopedInitialiser;
std::unique_ptr<AudioProcessor> juceFilter { createPluginFilterOfType (AudioProcessor::wrapperType_AudioUnit) };
}; };
//============================================================================== //==============================================================================
@@ -111,8 +107,7 @@ class JuceAU final : public AudioProcessorHolder,
{ {
public: public:
JuceAU (AudioUnit component) JuceAU (AudioUnit component)
: AudioProcessorHolder (activePlugins.size() + activeUIs.size() == 0),
MusicDeviceBase (component,
: MusicDeviceBase (component,
(UInt32) AudioUnitHelpers::getBusCountForWrapper (*juceFilter, true), (UInt32) AudioUnitHelpers::getBusCountForWrapper (*juceFilter, true),
(UInt32) AudioUnitHelpers::getBusCountForWrapper (*juceFilter, false)) (UInt32) AudioUnitHelpers::getBusCountForWrapper (*juceFilter, false))
{ {
@@ -173,9 +168,6 @@ public:
jassert (activePlugins.contains (this)); jassert (activePlugins.contains (this));
activePlugins.removeFirstMatchingValue (this); activePlugins.removeFirstMatchingValue (this);
if (activePlugins.size() + activeUIs.size() == 0)
shutdownJuce_GUI();
} }
//============================================================================== //==============================================================================
@@ -1723,6 +1715,7 @@ public:
} }
private: private:
ScopedJuceInitialiser_GUI scopedInitialiser;
Rectangle<int> lastBounds; Rectangle<int> lastBounds;
JUCE_DECLARE_NON_COPYABLE (EditorCompHolder) JUCE_DECLARE_NON_COPYABLE (EditorCompHolder)
@@ -1823,8 +1816,6 @@ public:
// there's some kind of component currently modal, but the host // there's some kind of component currently modal, but the host
// is trying to delete our plugin.. // is trying to delete our plugin..
jassert (Component::getCurrentlyModalComponent() == nullptr); jassert (Component::getCurrentlyModalComponent() == nullptr);
shutdownJuce_GUI();
} }
} }
}; };


+ 3
- 0
modules/juce_events/messages/juce_Initialisation.h View File

@@ -74,6 +74,9 @@ public:
/** The destructor simply calls shutdownJuce_GUI(). */ /** The destructor simply calls shutdownJuce_GUI(). */
~ScopedJuceInitialiser_GUI(); ~ScopedJuceInitialiser_GUI();
JUCE_DECLARE_NON_COPYABLE (ScopedJuceInitialiser_GUI)
JUCE_DECLARE_NON_MOVEABLE (ScopedJuceInitialiser_GUI)
}; };


Loading…
Cancel
Save