Skip to content

Commit

Permalink
Vitalium: Notify host of changed parameters on patch load.
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkRTA authored and falkTX committed May 1, 2024
1 parent 31afd94 commit b3596e6
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions ports-juce6.0/vitalium/source/common/synth_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,17 +339,45 @@ void SynthBase::loadTuningFile(const File& file) {

void SynthBase::loadInitPreset() {
pauseProcessing(true);

std::map<std::string, float> old_values;
for (const auto &i: controls_) {
old_values.insert(std::pair<std::string, float>(i.first, i.second->value()));
}

engine_->allSoundsOff();
initEngine();
LoadSave::initSaveInfo(save_info_);

for (auto i = controls_.begin(); i != controls_.end(); i++) {
if (old_values.count(i->first) && old_values[i->first] != i->second->value()
&& i->first != "bypass") {
setValueNotifyHost(i->first, i->second->value());
}
}

pauseProcessing(false);
}

bool SynthBase::loadFromJson(const json& data) {
pauseProcessing(true);

std::map<std::string, float> old_values;
for (const auto &i: controls_) {
old_values.insert(std::pair<std::string, float>(i.first, i.second->value()));
}

engine_->allSoundsOff();
try {
bool result = LoadSave::jsonToState(this, save_info_, data);

for (auto i = controls_.begin(); i != controls_.end(); i++) {
if (old_values.count(i->first) && old_values[i->first] != i->second->value()
&& i->first != "bypass") {
setValueNotifyHost(i->first, i->second->value());
}
}

pauseProcessing(false);
return result;
}
Expand Down

0 comments on commit b3596e6

Please sign in to comment.