Skip to content

Commit

Permalink
Fix a LIVE feedback bug (#6657)
Browse files Browse the repository at this point in the history
Live sends me VST3 param events when dragging with a value
different from my slider, which causes a feedback loop.
Supress those write events when editing.

Addresses #6648
  • Loading branch information
baconpaul authored Oct 22, 2022
1 parent ebe4e03 commit 8429811
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/surge-xt/SurgeSynthEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,13 +438,17 @@ void SurgeSynthEditor::filesDropped(const juce::StringArray &files, int x, int y

void SurgeSynthEditor::beginParameterEdit(Parameter *p)
{
// std::cout << "BEGIN EDIT " << p->get_name() << std::endl;
auto par = processor.paramsByID[processor.surge->idForParameter(p)];
par->inEditGesture = true;
par->beginChangeGesture();
}

void SurgeSynthEditor::endParameterEdit(Parameter *p)
{
// std::cout << "END EDIT " << p->get_name() << std::endl;
auto par = processor.paramsByID[processor.surge->idForParameter(p)];
par->inEditGesture = false;
par->endChangeGesture();
}

Expand Down
16 changes: 15 additions & 1 deletion src/surge-xt/SurgeSynthProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ struct SurgeParamToJuceParamAdapter : SurgeBaseParam
setValueNotifyingHost(getValue());
}

std::atomic<bool> inEditGesture{false};

juce::String getName(int i) const override
{
juce::String res = SurgeParamToJuceInfo::getParameterName(s, p);
Expand All @@ -104,9 +106,21 @@ struct SurgeParamToJuceParamAdapter : SurgeBaseParam
float getDefaultValue() const override { return 0.0; /* FIXME */ }
void setValue(float f) override
{
if (f != getValue())
auto matches = (f == getValue());
if (!matches && !inEditGesture)
{
s->setParameter01(s->idForParameter(p), f, true);
}
/*
* In LIVE 11.1 and 11.2 this will fire and matches will be false
else if (inEditGesture)
{
std::cout << ">>> VST3 SUPRESSED >>> " << f << " " << (matches ? "match" : "DIFFERENT")
<< std::endl;
}
*/
}

int getNumSteps() const override { return RangedAudioParameter::getNumSteps(); }
float getValueForText(const juce::String &text) const override
{
Expand Down

0 comments on commit 8429811

Please sign in to comment.