gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commit 2d1cba6f55276d908949262264f49dfca9d9d832
parent 501d7bf36b2ba725957b16d76cc35239ffb666d6
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Wed, 30 Oct 2024 23:11:05 +0100

fix endless recursion if an embedded skin cannot be loaded / try all included skins as fallbacks before failing

Diffstat:
Msource/jucePluginEditorLib/pluginEditorState.cpp | 9+++++++--
Msource/jucePluginEditorLib/pluginEditorState.h | 2+-
2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/source/jucePluginEditorLib/pluginEditorState.cpp b/source/jucePluginEditorLib/pluginEditorState.cpp @@ -86,7 +86,7 @@ std::string PluginEditorState::getSkinFolder() const return synthLib::validatePath(pluginLib::Tools::getPublicDataFolder(m_processor.getProperties().vendor, m_processor.getProperties().name) + "skins/"); } -void PluginEditorState::loadSkin(const Skin& _skin) +bool PluginEditorState::loadSkin(const Skin& _skin, const uint32_t _fallbackIndex/* = 0*/) { m_currentSkin = _skin; writeSkinToConfig(_skin); @@ -126,6 +126,8 @@ void PluginEditorState::loadSkin(const Skin& _skin) if(!m_instanceConfig.empty()) getEditor()->setPerInstanceConfig(m_instanceConfig); + + return true; } catch(const std::runtime_error& _err) { @@ -136,7 +138,10 @@ void PluginEditorState::loadSkin(const Skin& _skin) m_parameterBinding.clear(); m_editor.reset(); - loadSkin(m_includedSkins[0]); + if(_fallbackIndex >= m_includedSkins.size()) + return false; + + return loadSkin(m_includedSkins[_fallbackIndex], _fallbackIndex + 1); } } diff --git a/source/jucePluginEditorLib/pluginEditorState.h b/source/jucePluginEditorLib/pluginEditorState.h @@ -72,7 +72,7 @@ namespace jucePluginEditorLib Editor* getEditor() const; private: - void loadSkin(const Skin& _skin); + bool loadSkin(const Skin& _skin, uint32_t _fallbackIndex = 0); void setGuiScale(int _scale) const; std::unique_ptr<juce::Component> m_editor;