mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
StandaloneFilterWindow: Update implementation of getInstance to avoid iterating through desktop windows
This commit is contained in:
parent
ec4dfe1556
commit
a7e9edb2e9
1 changed files with 12 additions and 18 deletions
|
|
@ -91,6 +91,10 @@ public:
|
||||||
channelConfiguration (channels),
|
channelConfiguration (channels),
|
||||||
autoOpenMidiDevices (shouldAutoOpenMidiDevices)
|
autoOpenMidiDevices (shouldAutoOpenMidiDevices)
|
||||||
{
|
{
|
||||||
|
// Only one StandalonePluginHolder may be created at a time
|
||||||
|
jassert (currentInstance == nullptr);
|
||||||
|
currentInstance = this;
|
||||||
|
|
||||||
shouldMuteInput.addListener (this);
|
shouldMuteInput.addListener (this);
|
||||||
shouldMuteInput = ! isInterAppAudioConnected();
|
shouldMuteInput = ! isInterAppAudioConnected();
|
||||||
|
|
||||||
|
|
@ -128,6 +132,8 @@ public:
|
||||||
|
|
||||||
handleDeletePlugin();
|
handleDeletePlugin();
|
||||||
shutDownAudioDevices();
|
shutDownAudioDevices();
|
||||||
|
|
||||||
|
currentInstance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
@ -409,7 +415,10 @@ public:
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
static StandalonePluginHolder* getInstance();
|
static StandalonePluginHolder* getInstance()
|
||||||
|
{
|
||||||
|
return currentInstance;
|
||||||
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
OptionalScopedPointer<PropertySet> settings;
|
OptionalScopedPointer<PropertySet> settings;
|
||||||
|
|
@ -432,6 +441,8 @@ public:
|
||||||
ScopedMessageBox messageBox;
|
ScopedMessageBox messageBox;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
inline static StandalonePluginHolder* currentInstance = nullptr;
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
void handleCreatePlugin()
|
void handleCreatePlugin()
|
||||||
{
|
{
|
||||||
|
|
@ -1160,21 +1171,4 @@ private:
|
||||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StandaloneFilterWindow)
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StandaloneFilterWindow)
|
||||||
};
|
};
|
||||||
|
|
||||||
inline StandalonePluginHolder* StandalonePluginHolder::getInstance()
|
|
||||||
{
|
|
||||||
#if JucePlugin_Enable_IAA || JucePlugin_Build_Standalone
|
|
||||||
if (PluginHostType::getPluginLoadedAs() == AudioProcessor::wrapperType_Standalone)
|
|
||||||
{
|
|
||||||
auto& desktop = Desktop::getInstance();
|
|
||||||
const int numTopLevelWindows = desktop.getNumComponents();
|
|
||||||
|
|
||||||
for (int i = 0; i < numTopLevelWindows; ++i)
|
|
||||||
if (auto window = dynamic_cast<StandaloneFilterWindow*> (desktop.getComponent (i)))
|
|
||||||
return window->getPluginHolder();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace juce
|
} // namespace juce
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue