Skip to content

Commit b3596e6

Browse files
DarkRTAfalkTX
authored andcommitted
Vitalium: Notify host of changed parameters on patch load.
1 parent 31afd94 commit b3596e6

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

ports-juce6.0/vitalium/source/common/synth_base.cpp

+28
Original file line numberDiff line numberDiff line change
@@ -339,17 +339,45 @@ void SynthBase::loadTuningFile(const File& file) {
339339

340340
void SynthBase::loadInitPreset() {
341341
pauseProcessing(true);
342+
343+
std::map<std::string, float> old_values;
344+
for (const auto &i: controls_) {
345+
old_values.insert(std::pair<std::string, float>(i.first, i.second->value()));
346+
}
347+
342348
engine_->allSoundsOff();
343349
initEngine();
344350
LoadSave::initSaveInfo(save_info_);
351+
352+
for (auto i = controls_.begin(); i != controls_.end(); i++) {
353+
if (old_values.count(i->first) && old_values[i->first] != i->second->value()
354+
&& i->first != "bypass") {
355+
setValueNotifyHost(i->first, i->second->value());
356+
}
357+
}
358+
345359
pauseProcessing(false);
346360
}
347361

348362
bool SynthBase::loadFromJson(const json& data) {
349363
pauseProcessing(true);
364+
365+
std::map<std::string, float> old_values;
366+
for (const auto &i: controls_) {
367+
old_values.insert(std::pair<std::string, float>(i.first, i.second->value()));
368+
}
369+
350370
engine_->allSoundsOff();
351371
try {
352372
bool result = LoadSave::jsonToState(this, save_info_, data);
373+
374+
for (auto i = controls_.begin(); i != controls_.end(); i++) {
375+
if (old_values.count(i->first) && old_values[i->first] != i->second->value()
376+
&& i->first != "bypass") {
377+
setValueNotifyHost(i->first, i->second->value());
378+
}
379+
}
380+
353381
pauseProcessing(false);
354382
return result;
355383
}

0 commit comments

Comments
 (0)