File tree 1 file changed +28
-0
lines changed
ports-juce6.0/vitalium/source/common
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -339,17 +339,45 @@ void SynthBase::loadTuningFile(const File& file) {
339
339
340
340
void SynthBase::loadInitPreset () {
341
341
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
+
342
348
engine_->allSoundsOff ();
343
349
initEngine ();
344
350
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
+
345
359
pauseProcessing (false );
346
360
}
347
361
348
362
bool SynthBase::loadFromJson (const json& data) {
349
363
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
+
350
370
engine_->allSoundsOff ();
351
371
try {
352
372
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
+
353
381
pauseProcessing (false );
354
382
return result;
355
383
}
You can’t perform that action at this time.
0 commit comments