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 56862f8f6429a6dc8dcdccb1dd93cbd23320927d
parent 6605630ee951bc186a714c233a84f0bee07ecd69
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Fri, 20 May 2022 22:31:25 +0200

fix device model updated too early caused crash

Diffstat:
Msource/jucePlugin/ui3/VirusEditor.cpp | 35+++++++++++++++++++++++------------
Msource/jucePlugin/ui3/VirusEditor.h | 4++++
2 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/source/jucePlugin/ui3/VirusEditor.cpp b/source/jucePlugin/ui3/VirusEditor.cpp @@ -83,18 +83,9 @@ namespace genericVirusUI versionNumber->setText(g_pluginVersionString, juce::dontSendNotification); } - if(auto* deviceModel = findComponentT<juce::Label>("DeviceModel", false)) - { - std::string m; - switch(getController().getVirusModel()) - { - case virusLib::A: m = "A"; break; - case virusLib::B: m = "B"; break; - case virusLib::C: m = "C"; break; - case virusLib::TI: m = "TI"; break; - } - deviceModel->setText(m, juce::dontSendNotification); - } + m_deviceModel = findComponentT<juce::Label>("DeviceModel", false); + + updateDeviceModel(); auto* presetSave = findComponentT<juce::Button>("PresetSave", false); if(presetSave) @@ -241,6 +232,7 @@ namespace genericVirusUI m_parts->onProgramChange(); updatePresetName(); updatePlayModeButtons(); + updateDeviceModel(); } void VirusEditor::onPlayModeChanged() @@ -378,6 +370,25 @@ namespace genericVirusUI m_playModeToggle->setToggleState(getController().isMultiMode(), juce::dontSendNotification); } + void VirusEditor::updateDeviceModel() + { + if(!m_deviceModel) + return; + + std::string m; + + switch(getController().getVirusModel()) + { + case virusLib::A: m = "A"; break; + case virusLib::B: m = "B"; break; + case virusLib::C: m = "C"; break; + case virusLib::TI: m = "TI"; break; + } + + m_deviceModel->setText(m, juce::dontSendNotification); + m_deviceModel = nullptr; // only update once + } + void VirusEditor::savePreset() { const auto path = getController().getConfig()->getValue("virus_bank_dir", ""); diff --git a/source/jucePlugin/ui3/VirusEditor.h b/source/jucePlugin/ui3/VirusEditor.h @@ -48,6 +48,8 @@ namespace genericVirusUI void updatePresetName() const; void updatePlayModeButtons() const; + void updateDeviceModel(); + void savePreset(); void loadPreset(); @@ -74,6 +76,8 @@ namespace genericVirusUI juce::Button* m_playModeMulti = nullptr; juce::Button* m_playModeToggle = nullptr; + juce::Label* m_deviceModel = nullptr; + juce::TooltipWindow m_tooltipWindow; std::unique_ptr<juce::FileChooser> m_fileChooser;