bool MasterSynthesizer::setState(const SynthesizerState& ss) { bool result = true; for (const SynthesizerGroup& g : ss) { if (g.name() == "master") { for (const IdValue& v : g) { switch (v.id) { case 0: setEffect(0, indexOfEffect(0, v.data)); break; case 1: setEffect(1, indexOfEffect(1, v.data)); break; case 2: { float f = v.data.toDouble(); setGain(f); } break; case 3: setMasterTuning(v.data.toDouble()); break; case 4: setDynamicsMethod(v.data.toInt()); break; case 5: setCcToUseIndex(v.data.toInt()); break; default: qDebug("MasterSynthesizer::setState: unknown master id <%d>", v.id); } } } else { Synthesizer* s = synthesizer(g.name()); if (s) { bool r = s->setState(g); result = result && r; } else { if (effect(0) && effect(0)->name() == g.name()) effect(0)->setState(g); else if (effect(1) && effect(1)->name() == g.name()) effect(1)->setState(g); else qDebug("MasterSynthesizer::setState: unknown <%s>", qPrintable(g.name())); } } } return result; }
void MasterSynthesizer::setState(const SynthesizerState& ss) { for (const SynthesizerGroup& g : ss) { if (g.name() == "master") { for (const IdValue& v : g) { switch (v.id) { case 0: setEffect(0, indexOfEffect(0, v.data)); break; case 1: setEffect(1, indexOfEffect(1, v.data)); break; case 2: { float f = v.data.toDouble(); setGain(f); } break; case 3: setMasterTuning(v.data.toDouble()); break; default: qDebug("MasterSynthesizer::setState: unknown master id <%d>", v.id); } } } else { Synthesizer* s = synthesizer(g.name()); if (s) s->setState(g); else { if (effect(0) && effect(0)->name() == g.name()) effect(0)->setState(g); else if (effect(1) && effect(1)->name() == g.name()) effect(1)->setState(g); else qDebug("MasterSynthesizer::setState: unknown <%s>", qPrintable(g.name())); } } } }