Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another MSEG Performance Tweak #5046

Merged
merged 1 commit into from
Sep 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,15 @@ void SurgeGUIEditor::idle()
hideMidiLearnOverlay();
}

if (lfoDisplayRepaintCountdown > 0)
{
lfoDisplayRepaintCountdown--;
if (lfoDisplayRepaintCountdown == 0)
{
lfoDisplay->repaint();
}
}

{
bool expected = true;
if (synth->rawLoadNeedsUIDawExtraState.compare_exchange_weak(expected, true) &&
Expand Down Expand Up @@ -5197,6 +5206,12 @@ void SurgeGUIEditor::showMSEGEditor()
auto mse = std::make_unique<Surge::Overlays::MSEGEditor>(&(synth->storage), lfodata, ms,
&msegEditState[current_scene][lfo_id],
currentSkin, bitmapStore);
mse->onModelChanged = [this]() {
if (lfoDisplayRepaintCountdown == 0)
{
lfoDisplayRepaintCountdown = 2;
}
};

std::string title = modsource_names[modsource_editor[current_scene]];
title += " Editor";
Expand Down
1 change: 1 addition & 0 deletions src/gui/SurgeGUIEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ class SurgeGUIEditor : public Surge::GUI::IComponentTagValue::Listener,
Surge::GUI::IComponentTagValue *nonmod_param[n_paramslots] = {};
std::array<std::unique_ptr<Surge::Widgets::ModulationSourceButton>, n_modsources> gui_modsrc;
std::unique_ptr<Surge::Widgets::LFOAndStepDisplay> lfoDisplay;
int lfoDisplayRepaintCountdown{0};

Surge::Widgets::Switch *filtersubtype[2] = {};

Expand Down
11 changes: 5 additions & 6 deletions src/gui/overlays/MSEGEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ struct MSEGCanvas : public juce::Component, public Surge::GUI::SkinConsumingComp
std::function<void(float, float, const juce::Point<float> &)> onDrag;
};

std::function<void()> onModelChanged = []() {};
std::vector<hotzone> hotzones;

static constexpr int drawInsertX = 10, drawInsertY = 10, axisSpaceX = 18, axisSpaceY = 8;
Expand Down Expand Up @@ -2582,12 +2583,8 @@ struct MSEGCanvas : public juce::Component, public Surge::GUI::SkinConsumingComp
applyZoomPanConstraints(activeSegment, specialEndpoint);
if (rchz)
recalcHotZones(mouseDownOrigin); // FIXME
// Do this more heavy handed version
auto c = getParentComponent();
while (c && c->getParentComponent())
c = c->getParentComponent();
if (c)
c->repaint();

onModelChanged();
}

static constexpr int longestMSEG = 128;
Expand Down Expand Up @@ -3164,6 +3161,8 @@ MSEGEditor::MSEGEditor(SurgeStorage *storage, LFOStorage *lfodata, MSEGStorage *
canvas->controlregion = controls.get();
controls->canvas = canvas.get();

canvas->onModelChanged = [this]() { this->onModelChanged(); };

addAndMakeVisible(*controls);
addAndMakeVisible(*canvas);
}
Expand Down
2 changes: 2 additions & 0 deletions src/gui/overlays/MSEGEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ struct MSEGEditor : public juce::Component,
std::unique_ptr<MSEGControlRegion> controls;
std::unique_ptr<MSEGCanvas> canvas;

std::function<void()> onModelChanged = []() {};

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MSEGEditor);
};
} // namespace Overlays
Expand Down