Browse Source

Vitalium: Notify host of changed parameters on patch load.

pull/133/head
parent
commit
b3596e6a69
1 changed files with 28 additions and 0 deletions
  1. +28
    -0
      ports-juce6.0/vitalium/source/common/synth_base.cpp

+ 28
- 0
ports-juce6.0/vitalium/source/common/synth_base.cpp View File

@@ -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;
}


Loading…
Cancel
Save