commit 897be881aea49d498a2c9a6c2a1a05ccc40bed9e
parent e3d56ce55e3b15c50fe00d9ff457ba7876261b13
Author: 790 <790@users.noreply.github.com>
Date: Sat, 15 Jan 2022 17:04:34 +0000
maybe fix mac crash again
Diffstat:
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/source/jucePlugin/ui/Virus_Parts.cpp b/source/jucePlugin/ui/Virus_Parts.cpp
@@ -120,16 +120,21 @@ Parts::Parts(VirusParameterBinding & _parameterBinding, Virus::Controller& _cont
m_btMultiMode.setBounds(m_btMultiSingleMode.getBounds().translated(m_btMultiSingleMode.getWidth()+4, 0));
m_controller.getParameter(Virus::Param_PlayMode, 0)->onValueChanged = [this] { updatePlayModeButtons(); };
- updatePlayModeButtons();
+ //updatePlayModeButtons();
startTimerHz(5);
}
Parts::~Parts() {
+ stopTimer();
m_controller.getParameter(Virus::Param_PlayMode, 0)->onValueChanged = nullptr;
}
void Parts::updatePlayModeButtons()
{
- const auto _mode = m_controller.getParameter(Virus::Param_PlayMode, 0)->getValue();
+ const auto modeParam = m_controller.getParameter(Virus::Param_PlayMode, 0);
+ if (modeParam == nullptr) {
+ return;
+ }
+ const auto _mode = (int)modeParam->getValue();
if (_mode == virusLib::PlayModeSingle)
{
m_btSingleMode.setToggleState(true, juce::dontSendNotification);
@@ -142,6 +147,17 @@ void Parts::updatePlayModeButtons()
{
m_btMultiMode.setToggleState(true, juce::dontSendNotification);
}
+ const auto multiMode = m_controller.isMultiMode();
+ //updatePlayModeButtons();
+ for (auto pt = 0; pt < 16; pt++)
+ {
+ bool singlePartOrInMulti = pt == 0 || multiMode;
+ m_presetNames[pt].setVisible(singlePartOrInMulti);
+ m_prevPatch[pt].setVisible(singlePartOrInMulti);
+ m_nextPatch[pt].setVisible(singlePartOrInMulti);
+ if (singlePartOrInMulti)
+ m_presetNames[pt].setButtonText(m_controller.getCurrentPartPresetName(pt));
+ }
}
void Parts::changePart(uint8_t _part)
{
@@ -163,15 +179,4 @@ void Parts::setPlayMode(uint8_t _mode) {
void Parts::timerCallback()
{
// ugly (polling!) way for refreshing presets names as this is temporary ui
- const auto multiMode = m_controller.isMultiMode();
- for (auto pt = 0; pt < 16; pt++)
- {
- bool singlePartOrInMulti = pt == 0 || multiMode;
- m_presetNames[pt].setVisible(singlePartOrInMulti);
- m_prevPatch[pt].setVisible(singlePartOrInMulti);
- m_nextPatch[pt].setVisible(singlePartOrInMulti);
- if (singlePartOrInMulti)
- m_presetNames[pt].setButtonText(m_controller.getCurrentPartPresetName(pt));
- }
-
}