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

Apply param changes when presets change #1177

Merged
merged 1 commit into from
Sep 17, 2019
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
6 changes: 6 additions & 0 deletions src/common/SurgeSynthesizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2137,6 +2137,9 @@ DWORD WINAPI loadPatchInBackgroundThread(LPVOID lpParam)
synth->patchid_queue = -1;
synth->allNotesOff();
synth->loadPatch(patchid);
#if TARGET_LV2
synth->getParent()->patchChanged();
#endif
synth->halt_engine = false;
return 0;
}
Expand All @@ -2149,6 +2152,9 @@ void SurgeSynthesizer::processThreadunsafeOperations()
if (patchid_queue >= 0)
{
loadPatch(patchid_queue);
#if TARGET_LV2
getParent()->patchChanged();
#endif
patchid_queue = -1;
}

Expand Down
14 changes: 14 additions & 0 deletions src/lv2/SurgeLv2Wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ void SurgeLv2Wrapper::setParameterAutomated(int externalparam, float value)
_editor->setParameterAutomated(externalparam, value);
}

void SurgeLv2Wrapper::patchChanged(void)
{
if( _editor == nullptr ) return;

SurgeSynthesizer *s = _synthesizer.get();

for (unsigned int i = 0; i < n_total_params; i++)
{
unsigned index = s->remapExternalApiToInternalId(i);
float value = s->getParameter01(index);
_editor->setParameterAutomated(i, value);
}
}

LV2_Handle SurgeLv2Wrapper::instantiate(const LV2_Descriptor* descriptor,
double sample_rate,
const char* bundle_path,
Expand Down
1 change: 1 addition & 0 deletions src/lv2/SurgeLv2Wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class SurgeLv2Wrapper
// PluginLayer
void updateDisplay();
void setParameterAutomated(int externalparam, float value);
void patchChanged(void);

private:
static LV2_Handle instantiate(const LV2_Descriptor* descriptor,
Expand Down