diff --git a/src/common/dsp/SurgeVoice.cpp b/src/common/dsp/SurgeVoice.cpp index d94abb93cca..019913b49d3 100644 --- a/src/common/dsp/SurgeVoice.cpp +++ b/src/common/dsp/SurgeVoice.cpp @@ -228,7 +228,7 @@ SurgeVoice::SurgeVoice(SurgeStorage *storage, SurgeSceneStorage *oscene, pdata * &storage->getPatch().formulamods[state.scene_id][i]); lfo[i].setIsVoice(true); - if (localcopy[scene->lfo[i].shape.param_id_in_scene].i == lt_formula) + if (scene->lfo[i].shape.val.i == lt_formula) { Surge::Formula::setupEvaluatorStateFrom(lfo[i].formulastate, storage->getPatch()); Surge::Formula::setupEvaluatorStateFrom(lfo[i].formulastate, this); @@ -442,20 +442,17 @@ void SurgeVoice::switch_toggled() update_portamento(); float pb = modsources[ms_pitchbend]->get_output(0); if (pb > 0) - pb *= (float)localcopy[scene->pbrange_up.param_id_in_scene].i * - (scene->pbrange_up.extend_range ? 0.01f : 1.f); + pb *= (float)scene->pbrange_up.val.i * (scene->pbrange_up.extend_range ? 0.01f : 1.f); else - pb *= (float)localcopy[scene->pbrange_dn.param_id_in_scene].i * - (scene->pbrange_dn.extend_range ? 0.01f : 1.f); + pb *= (float)scene->pbrange_dn.val.i * (scene->pbrange_dn.extend_range ? 0.01f : 1.f); // scenepbpitch is pitch state but without state.pkey, so that it can be used to add // scene pitch/octave, pitch bend and associated modulations to non-keytracked oscillators state.scenepbpitch = pb; state.pitch = state.pkey + state.scenepbpitch; - modsources[ms_keytrack]->set_output( - 0, (state.pitch - (float)localcopy[scene->keytrack_root.param_id_in_scene].i) * - (1.0f / 12.0f)); + modsources[ms_keytrack]->set_output(0, (state.pitch - (float)scene->keytrack_root.val.i) * + (1.0f / 12.0f)); /* * Since we have updated the keytrack output here we need to re-update the localcopy modulators @@ -490,7 +487,7 @@ void SurgeVoice::switch_toggled() } } - int FM = localcopy[scene->fm_switch.param_id_in_scene].i; + int FM = scene->fm_switch.val.i; switch (FM) { case fm_off: @@ -552,18 +549,18 @@ void SurgeVoice::switch_toggled() // check the filtertype for (int u = 0; u < n_filterunits_per_scene; u++) { - if ((localcopy[scene->filterunit[u].type.param_id_in_scene].i != FBP.FU[u].type) || - (localcopy[scene->filterunit[u].subtype.param_id_in_scene].i != FBP.FU[u].subtype)) + if ((scene->filterunit[u].type.val.i != FBP.FU[u].type) || + (scene->filterunit[u].subtype.val.i != FBP.FU[u].subtype)) { memset(&FBP.FU[u], 0, sizeof(FBP.FU[u])); - FBP.FU[u].type = localcopy[scene->filterunit[u].type.param_id_in_scene].i; - FBP.FU[u].subtype = localcopy[scene->filterunit[u].subtype.param_id_in_scene].i; + FBP.FU[u].type = scene->filterunit[u].type.val.i; + FBP.FU[u].subtype = scene->filterunit[u].subtype.val.i; - if (localcopy[scene->filterblock_configuration.param_id_in_scene].i == fc_wide) + if (scene->filterblock_configuration.val.i == fc_wide) { memset(&FBP.FU[u + 2], 0, sizeof(FBP.FU[u + 2])); - FBP.FU[u + 2].type = localcopy[scene->filterunit[u].type.param_id_in_scene].i; - FBP.FU[u + 2].subtype = localcopy[scene->filterunit[u].subtype.param_id_in_scene].i; + FBP.FU[u + 2].type = scene->filterunit[u].type.val.i; + FBP.FU[u + 2].subtype = scene->filterunit[u].subtype.val.i; } CM[u].Reset(); @@ -645,7 +642,7 @@ void SurgeVoice::update_portamento() int SurgeVoice::routefilter(int r) { - switch (localcopy[scene->filterblock_configuration.param_id_in_scene].i) + switch (scene->filterblock_configuration.val.i) { case fc_serial1: case fc_serial2: @@ -665,7 +662,7 @@ template void SurgeVoice::calc_ctrldata(QuadFilterChainState *Q, in for (int i = 0; i < n_lfos_voice; i++) { - if (localcopy[scene->lfo[i].shape.param_id_in_scene].i == lt_formula) + if (scene->lfo[i].shape.val.i == lt_formula) { Surge::Formula::setupEvaluatorStateFrom(lfo[i].formulastate, storage->getPatch()); Surge::Formula::setupEvaluatorStateFrom(lfo[i].formulastate, this); @@ -717,11 +714,9 @@ template void SurgeVoice::calc_ctrldata(QuadFilterChainState *Q, in float pb = modsources[ms_pitchbend]->get_output(0); if (pb > 0) - pb *= (float)localcopy[scene->pbrange_up.param_id_in_scene].i * - (scene->pbrange_up.extend_range ? 0.01f : 1.f); + pb *= (float)scene->pbrange_up.val.i * (scene->pbrange_up.extend_range ? 0.01f : 1.f); else - pb *= (float)localcopy[scene->pbrange_dn.param_id_in_scene].i * - (scene->pbrange_dn.extend_range ? 0.01f : 1.f); + pb *= (float)scene->pbrange_dn.val.i * (scene->pbrange_dn.extend_range ? 0.01f : 1.f); octaveSize = 12.0f; if (!storage->isStandardTuning && storage->tuningApplicationMode == SurgeStorage::RETUNE_ALL) @@ -732,9 +727,8 @@ template void SurgeVoice::calc_ctrldata(QuadFilterChainState *Q, in state.pitch = state.pkey + state.scenepbpitch; // I didn't change this for octaveSize, I think rightly - modsources[ms_keytrack]->set_output( - 0, (state.pitch - (float)localcopy[scene->keytrack_root.param_id_in_scene].i) * - (1.0f / 12.0f)); + modsources[ms_keytrack]->set_output(0, (state.pitch - (float)scene->keytrack_root.val.i) * + (1.0f / 12.0f)); if (scene->modsource_doprocess[ms_polyaftertouch]) { @@ -781,13 +775,13 @@ template void SurgeVoice::calc_ctrldata(QuadFilterChainState *Q, in amp = amp * noteExpressions[VOLUME]; // since amp is already linear as is the NE // Volume correcting/correction (fc_stereo updated since v1.2.2) - if (localcopy[scene->filterblock_configuration.param_id_in_scene].i == fc_wide) + if (scene->filterblock_configuration.val.i == fc_wide) amp *= 0.6666666f; - else if (localcopy[scene->filterblock_configuration.param_id_in_scene].i == fc_stereo) + else if (scene->filterblock_configuration.val.i == fc_stereo) amp *= 1.3333333f; - if ((localcopy[scene->filterblock_configuration.param_id_in_scene].i == fc_stereo) || - (localcopy[scene->filterblock_configuration.param_id_in_scene].i == fc_wide)) + if ((scene->filterblock_configuration.val.i == fc_stereo) || + (scene->filterblock_configuration.val.i == fc_wide)) { // I am surprised this is not pan1 - as oppsoed to pan_id - so will change it // pan1 -= localcopy[width_id].f; @@ -833,11 +827,11 @@ bool SurgeVoice::process_block(QuadFilterChainState &Q, int Qe) { calc_ctrldata<0>(&Q, Qe); - bool is_wide = localcopy[scene->filterblock_configuration.param_id_in_scene].i == fc_wide; + bool is_wide = scene->filterblock_configuration.val.i == fc_wide; float tblock alignas(16)[BLOCK_SIZE_OS], tblock2 alignas(16)[BLOCK_SIZE_OS]; float *tblockR = is_wide ? tblock2 : tblock; - // float ktrkroot = (float)localcopy[scene->keytrack_root.param_id_in_scene].i; + // float ktrkroot = (float)scene->keytrack_root.val.i; float ktrkroot = 60; float drift = localcopy[scene->drift.param_id_in_scene].f; @@ -859,7 +853,7 @@ bool SurgeVoice::process_block(QuadFilterChainState &Q, int Qe) osc[2]->process_block( noteShiftFromPitchParam( (scene->osc[2].keytrack.val.b ? state.pitch : ktrkroot + state.scenepbpitch) + - octaveSize * localcopy[scene->osc[2].octave.param_id_in_scene].i, + octaveSize * scene->osc[2].octave.val.i, 2), drift, is_wide); @@ -893,7 +887,7 @@ bool SurgeVoice::process_block(QuadFilterChainState &Q, int Qe) osc[1]->process_block( noteShiftFromPitchParam( (scene->osc[1].keytrack.val.b ? state.pitch : ktrkroot + state.scenepbpitch) + - octaveSize * localcopy[scene->osc[1].octave.param_id_in_scene].i, + octaveSize * scene->osc[1].octave.val.i, 1), drift, is_wide, true, storage->db_to_linear(localcopy[scene->fm_depth.param_id_in_scene].f)); @@ -903,7 +897,7 @@ bool SurgeVoice::process_block(QuadFilterChainState &Q, int Qe) osc[1]->process_block( noteShiftFromPitchParam( (scene->osc[1].keytrack.val.b ? state.pitch : ktrkroot + state.scenepbpitch) + - octaveSize * localcopy[scene->osc[1].octave.param_id_in_scene].i, + octaveSize * scene->osc[1].octave.val.i, 1), drift, is_wide); } @@ -939,7 +933,7 @@ bool SurgeVoice::process_block(QuadFilterChainState &Q, int Qe) osc[0]->process_block( noteShiftFromPitchParam( (scene->osc[0].keytrack.val.b ? state.pitch : ktrkroot + state.scenepbpitch) + - octaveSize * localcopy[scene->osc[0].octave.param_id_in_scene].i, + octaveSize * scene->osc[0].octave.val.i, 0), drift, is_wide, true, storage->db_to_linear(localcopy[scene->fm_depth.param_id_in_scene].f)); @@ -949,7 +943,7 @@ bool SurgeVoice::process_block(QuadFilterChainState &Q, int Qe) osc[0]->process_block( noteShiftFromPitchParam( (scene->osc[0].keytrack.val.b ? state.pitch : ktrkroot + state.scenepbpitch) + - octaveSize * localcopy[scene->osc[0].octave.param_id_in_scene].i, + octaveSize * scene->osc[0].octave.val.i, 0), drift, is_wide, true, storage->db_to_linear(localcopy[scene->fm_depth.param_id_in_scene].f)); @@ -959,7 +953,7 @@ bool SurgeVoice::process_block(QuadFilterChainState &Q, int Qe) osc[0]->process_block( noteShiftFromPitchParam( (scene->osc[0].keytrack.val.b ? state.pitch : ktrkroot + state.scenepbpitch) + - octaveSize * localcopy[scene->osc[0].octave.param_id_in_scene].i, + octaveSize * scene->osc[0].octave.val.i, 0), drift, is_wide); } @@ -1204,7 +1198,7 @@ void SurgeVoice::SetQFB(QuadFilterChainState *Q, int e) // Q == 0 means init(ial fbqi = e; float FMix1, FMix2; - switch (localcopy[scene->filterblock_configuration.param_id_in_scene].i) + switch (scene->filterblock_configuration.val.i) { case fc_serial1: case fc_serial2: @@ -1232,8 +1226,7 @@ void SurgeVoice::SetQFB(QuadFilterChainState *Q, int e) // Q == 0 means init(ial // We need to initialize the waveshaper registers for (int c = 0; c < 2; ++c) sst::waveshapers::initializeWaveshaperRegister( - static_cast( - localcopy[scene->wsunit.type.param_id_in_scene].i), + static_cast(scene->wsunit.type.val.i), FBP.WS[c].R); } @@ -1277,7 +1270,7 @@ void SurgeVoice::SetQFB(QuadFilterChainState *Q, int e) // Q == 0 means init(ial Q->FU[2].active[e] = 0xffffffff; Q->FU[3].active[e] = 0xffffffff; - float keytrack = state.pitch - (float)localcopy[scene->keytrack_root.param_id_in_scene].i; + float keytrack = state.pitch - (float)scene->keytrack_root.val.i; float fenv = modsources[ms_filtereg]->get_output(0); float cutoffA = localcopy[id_cfa].f + localcopy[id_kta].f * keytrack + localcopy[id_emoda].f * fenv; @@ -1287,20 +1280,19 @@ void SurgeVoice::SetQFB(QuadFilterChainState *Q, int e) // Q == 0 means init(ial if (scene->f2_cutoff_is_offset.val.b) cutoffB += cutoffA; - CM[0].MakeCoeffs( - cutoffA, localcopy[id_resoa].f, - static_cast(localcopy[scene->filterunit[0].type.param_id_in_scene].i), - static_cast(localcopy[scene->filterunit[0].subtype.param_id_in_scene].i), - storage, scene->filterunit[0].cutoff.extend_range); + CM[0].MakeCoeffs(cutoffA, localcopy[id_resoa].f, + static_cast(scene->filterunit[0].type.val.i), + static_cast(scene->filterunit[0].subtype.val.i), storage, + scene->filterunit[0].cutoff.extend_range); CM[1].MakeCoeffs( cutoffB, scene->f2_link_resonance.val.b ? localcopy[id_resoa].f : localcopy[id_resob].f, - static_cast(localcopy[scene->filterunit[1].type.param_id_in_scene].i), - static_cast(localcopy[scene->filterunit[1].subtype.param_id_in_scene].i), - storage, scene->filterunit[1].cutoff.extend_range); + static_cast(scene->filterunit[1].type.val.i), + static_cast(scene->filterunit[1].subtype.val.i), storage, + scene->filterunit[1].cutoff.extend_range); for (int u = 0; u < n_filterunits_per_scene; u++) { - if (localcopy[scene->filterunit[u].type.param_id_in_scene].i != 0) + if (scene->filterunit[u].type.val.i != 0) { CM[u].updateState(Q->FU[u], e); for (int i = 0; i < n_filter_registers; i++) @@ -1311,7 +1303,7 @@ void SurgeVoice::SetQFB(QuadFilterChainState *Q, int e) // Q == 0 means init(ial Q->FU[u].DB[e] = FBP.Delay[u]; Q->FU[u].WP[e] = FBP.FU[u].WP; - if (localcopy[scene->filterblock_configuration.param_id_in_scene].i == fc_wide) + if (scene->filterblock_configuration.val.i == fc_wide) { CM[u].updateState(Q->FU[u + 2], e); for (int i = 0; i < n_filter_registers; i++) @@ -1333,7 +1325,7 @@ void SurgeVoice::GetQFB() for (int u = 0; u < n_filterunits_per_scene; u++) { - if (localcopy[scene->filterunit[u].type.param_id_in_scene].i != 0) + if (scene->filterunit[u].type.val.i != 0) { for (int i = 0; i < n_filter_registers; i++) { @@ -1346,7 +1338,7 @@ void SurgeVoice::GetQFB() } FBP.FU[u].WP = fbq->FU[u].WP[fbqi]; - if (localcopy[scene->filterblock_configuration.param_id_in_scene].i == fc_wide) + if (scene->filterblock_configuration.val.i == fc_wide) { for (int i = 0; i < n_filter_registers; i++) { @@ -1479,7 +1471,7 @@ void SurgeVoice::retriggerLFOEnvelopes() void SurgeVoice::resetPortamentoFrom(int key, int channel) { - if ((localcopy[scene->polymode.param_id_in_scene].i == pm_mono_st_fp) || + if ((scene->polymode.val.i == pm_mono_st_fp) || (scene->portamento.val.f == scene->portamento.val_min.f)) state.portasrc_key = state.getPitch(storage); else diff --git a/src/common/dsp/modulators/LFOModulationSource.cpp b/src/common/dsp/modulators/LFOModulationSource.cpp index 195a00585f9..9f091ecf724 100644 --- a/src/common/dsp/modulators/LFOModulationSource.cpp +++ b/src/common/dsp/modulators/LFOModulationSource.cpp @@ -113,8 +113,8 @@ float LFOModulationSource::bend3(float x) void LFOModulationSource::msegEnvelopePhaseAdjustment() { // If we have an envelope MSEG length above 1 we want phase to span the duration - if (localcopy[lfo->shape.param_id_in_scene].i == lt_mseg && - ms->editMode == MSEGStorage::ENVELOPE && ms->totalDuration > 1.0) + if (lfo->shape.val.i == lt_mseg && ms->editMode == MSEGStorage::ENVELOPE && + ms->totalDuration > 1.0) { // extend the phase phase *= ms->totalDuration; @@ -130,8 +130,7 @@ void LFOModulationSource::initPhaseFromStartPhase() phase = localcopy[startphase].f; phaseInitialized = true; - if (localcopy[lfo->shape.param_id_in_scene].i == lt_tri && lfo->rate.deactivated && - !lfo->unipolar.val.b) + if (lfo->shape.val.i == lt_tri && lfo->rate.deactivated && !lfo->unipolar.val.b) { phase += 0.25; } @@ -190,7 +189,7 @@ void LFOModulationSource::attack() { phase = lfo->start_phase.val.f; - if (localcopy[lfo->shape.param_id_in_scene].i == lt_stepseq) + if (lfo->shape.val.i == lt_stepseq) { phase = 0.f; } @@ -204,7 +203,7 @@ void LFOModulationSource::attack() float phaseslider; // Use Phase as shuffle-parameter instead - if (localcopy[lfo->shape.param_id_in_scene].i == lt_stepseq) + if (lfo->shape.val.i == lt_stepseq) { phaseslider = 0.f; } @@ -224,7 +223,7 @@ void LFOModulationSource::attack() phaseslider -= 1.f; } - switch (localcopy[lfo->trigmode.param_id_in_scene].i) + switch (lfo->trigmode.val.i) { case lm_keytrigger: phase = phaseslider; @@ -268,8 +267,8 @@ void LFOModulationSource::attack() // And so the total phase is timePassed * rate + phase0 auto startPhase = phaseslider; - if (localcopy[lfo->shape.param_id_in_scene].i == lt_mseg && - ms->editMode == MSEGStorage::ENVELOPE && ms->totalDuration > 1.0) + if (lfo->shape.val.i == lt_mseg && ms->editMode == MSEGStorage::ENVELOPE && + ms->totalDuration > 1.0) { // extend the phase startPhase *= ms->totalDuration; @@ -295,10 +294,10 @@ void LFOModulationSource::attack() }; } - switch (localcopy[lfo->shape.param_id_in_scene].i) + switch (lfo->shape.val.i) { case lt_snh: - if (isFirstAttack || localcopy[lfo->trigmode.param_id_in_scene].i != lm_freerun) + if (isFirstAttack || lfo->trigmode.val.i != lm_freerun) { noise = 0.f; noised1 = 0.f; @@ -372,7 +371,7 @@ void LFOModulationSource::attack() case lt_noise: { - if (isFirstAttack || localcopy[lfo->trigmode.param_id_in_scene].i != lm_freerun) + if (isFirstAttack || lfo->trigmode.val.i != lm_freerun) { auto lid = limit_range(localcopy[ideform].f, -1.f, 1.f); @@ -464,8 +463,7 @@ void LFOModulationSource::release() env_releasestart = env_val; env_phase = 0; } - else if (localcopy[lfo->shape.param_id_in_scene].i == lt_mseg || - localcopy[lfo->shape.param_id_in_scene].i == lt_formula) + else if (lfo->shape.val.i == lt_mseg || lfo->shape.val.i == lt_formula) { env_state = lfoeg_msegrelease; } @@ -494,8 +492,7 @@ void LFOModulationSource::retriggerEnvelope() void LFOModulationSource::process_block() { - if ((!phaseInitialized) || - (localcopy[lfo->trigmode.param_id_in_scene].i == lm_keytrigger && lfo->rate.deactivated)) + if ((!phaseInitialized) || (lfo->trigmode.val.i == lm_keytrigger && lfo->rate.deactivated)) { initPhaseFromStartPhase(); } @@ -503,7 +500,7 @@ void LFOModulationSource::process_block() retrigger_FEG = false; retrigger_AEG = false; - int s = localcopy[lfo->shape.param_id_in_scene].i; + int s = lfo->shape.val.i; float frate = 0; if (!lfo->rate.temposync) @@ -1239,7 +1236,7 @@ void LFOModulationSource::process_block() void LFOModulationSource::completedModulation() { - if (localcopy[lfo->shape.param_id_in_scene].i == lt_formula) + if (lfo->shape.val.i == lt_formula) { Surge::Formula::cleanEvaluatorState(formulastate); } diff --git a/src/common/dsp/oscillators/AliasOscillator.cpp b/src/common/dsp/oscillators/AliasOscillator.cpp index f6a69a09f93..079250ab435 100644 --- a/src/common/dsp/oscillators/AliasOscillator.cpp +++ b/src/common/dsp/oscillators/AliasOscillator.cpp @@ -67,7 +67,7 @@ void AliasOscillator::init(float pitch, bool is_display, bool nonzero_init_drift } } - n_unison = is_display ? 1 : localcopy[oscdata->p[ao_unison_voices].param_id_in_scene].i; + n_unison = is_display ? 1 : oscdata->p[ao_unison_voices].val.i; auto us = Surge::Oscillator::UnisonSetup(n_unison); @@ -411,7 +411,7 @@ void AliasOscillator::process_block(float pitch, float drift, bool stereo, bool const float crush_bits = limit_range(localcopy[oscdata->p[ao_bit_depth].param_id_in_scene].f, 1.f, 8.f); - const ao_waves wavetype = (ao_waves)localcopy[oscdata->p[ao_wave].param_id_in_scene].i; + const ao_waves wavetype = (ao_waves)oscdata->p[ao_wave].val.i; #define P(m) \ case m: \ diff --git a/src/common/dsp/oscillators/ClassicOscillator.cpp b/src/common/dsp/oscillators/ClassicOscillator.cpp index cad3f4dbb30..1fdf0ecafb9 100644 --- a/src/common/dsp/oscillators/ClassicOscillator.cpp +++ b/src/common/dsp/oscillators/ClassicOscillator.cpp @@ -196,8 +196,7 @@ void ClassicOscillator::init(float pitch, bool is_display, bool nonzero_init_dri l_sub.setRate(rate); l_sync.setRate(rate); - n_unison = - limit_range(localcopy[oscdata->p[co_unison_voices].param_id_in_scene].i, 1, MAX_UNISON); + n_unison = limit_range(oscdata->p[co_unison_voices].val.i, 1, MAX_UNISON); if (is_display) { diff --git a/src/common/dsp/oscillators/FM2Oscillator.cpp b/src/common/dsp/oscillators/FM2Oscillator.cpp index 0e77a9261f6..2224e838a56 100644 --- a/src/common/dsp/oscillators/FM2Oscillator.cpp +++ b/src/common/dsp/oscillators/FM2Oscillator.cpp @@ -52,12 +52,12 @@ void FM2Oscillator::process_block(float pitch, float drift, bool stereo, bool FM double omega = min(M_PI, (double)pitch_to_omega(pitch + driftlfo)); double sh = localcopy[oscdata->p[fm2_m12offset].param_id_in_scene].f * storage->dsamplerate_inv; - RM1.set_rate(min(M_PI, (double)pitch_to_omega(pitch + driftlfo) * - (double)localcopy[oscdata->p[fm2_m1ratio].param_id_in_scene].i + - sh)); - RM2.set_rate(min(M_PI, (double)pitch_to_omega(pitch + driftlfo) * - (double)localcopy[oscdata->p[fm2_m2ratio].param_id_in_scene].i - - sh)); + RM1.set_rate( + min(M_PI, + (double)pitch_to_omega(pitch + driftlfo) * (double)oscdata->p[fm2_m1ratio].val.i + sh)); + RM2.set_rate( + min(M_PI, + (double)pitch_to_omega(pitch + driftlfo) * (double)oscdata->p[fm2_m2ratio].val.i - sh)); double d1 = localcopy[oscdata->p[fm2_m1amount].param_id_in_scene].f; double d2 = localcopy[oscdata->p[fm2_m2amount].param_id_in_scene].f; diff --git a/src/common/dsp/oscillators/ModernOscillator.cpp b/src/common/dsp/oscillators/ModernOscillator.cpp index e83773118f2..225e40f3b31 100644 --- a/src/common/dsp/oscillators/ModernOscillator.cpp +++ b/src/common/dsp/oscillators/ModernOscillator.cpp @@ -123,7 +123,7 @@ void ModernOscillator::init(float pitch, bool is_display, bool nonzero_init_drif pwidth.setRate(0.001); // 4x slower sync.setRate(0.001 * BLOCK_SIZE_OS); - n_unison = is_display ? 1 : localcopy[oscdata->p[mo_unison_voices].param_id_in_scene].i; + n_unison = is_display ? 1 : oscdata->p[mo_unison_voices].val.i; auto us = Surge::Oscillator::UnisonSetup(n_unison); diff --git a/src/common/dsp/oscillators/SampleAndHoldOscillator.cpp b/src/common/dsp/oscillators/SampleAndHoldOscillator.cpp index 414129518c9..290b1fc7b83 100644 --- a/src/common/dsp/oscillators/SampleAndHoldOscillator.cpp +++ b/src/common/dsp/oscillators/SampleAndHoldOscillator.cpp @@ -61,8 +61,7 @@ void SampleAndHoldOscillator::init(float pitch, bool is_display, bool nonzero_in l_sub.setRate(rate); l_sync.setRate(rate); - n_unison = - limit_range(localcopy[oscdata->p[shn_unison_voices].param_id_in_scene].i, 1, MAX_UNISON); + n_unison = limit_range(oscdata->p[shn_unison_voices].val.i, 1, MAX_UNISON); if (is_display) { n_unison = 1; diff --git a/src/common/dsp/oscillators/SineOscillator.cpp b/src/common/dsp/oscillators/SineOscillator.cpp index c20152a46f5..66ca590b5b0 100644 --- a/src/common/dsp/oscillators/SineOscillator.cpp +++ b/src/common/dsp/oscillators/SineOscillator.cpp @@ -95,8 +95,8 @@ void SineOscillator::prepare_unison(int voices) void SineOscillator::init(float pitch, bool is_display, bool nonzero_init_drift) { - n_unison = - limit_range(localcopy[oscdata->p[sine_unison_voices].param_id_in_scene].i, 1, MAX_UNISON); + n_unison = limit_range(oscdata->p[sine_unison_voices].val.i, 1, MAX_UNISON); + limit_range(oscdata->p[sine_unison_voices].val.i, 1, MAX_UNISON); if (is_display) { diff --git a/src/common/dsp/oscillators/StringOscillator.cpp b/src/common/dsp/oscillators/StringOscillator.cpp index c6de8fb80ab..d3cea5c5bae 100644 --- a/src/common/dsp/oscillators/StringOscillator.cpp +++ b/src/common/dsp/oscillators/StringOscillator.cpp @@ -180,7 +180,7 @@ void StringOscillator::init(float pitch, bool is_display, bool nzi) driftLFO[i].init(nzi); } - auto mode = (exciter_modes)localcopy[oscdata->p[str_exciter_mode].param_id_in_scene].i; + auto mode = (exciter_modes)oscdata->p[str_exciter_mode].val.i; phase1 = 0.0, phase2 = 0.0; if (!oscdata->retrigger.val.b && !is_display) @@ -487,7 +487,7 @@ void StringOscillator::process_block(float pitch, float drift, bool stereo, bool } \ break; - auto mode = (exciter_modes)localcopy[oscdata->p[str_exciter_mode].param_id_in_scene].i; + auto mode = (exciter_modes)oscdata->p[str_exciter_mode].val.i; auto oss = oscdata->p[str_exciter_level].deform_type & StringOscillator::os_all; switch (mode) diff --git a/src/common/dsp/oscillators/TwistOscillator.cpp b/src/common/dsp/oscillators/TwistOscillator.cpp index bca939db40b..db2b19fc589 100644 --- a/src/common/dsp/oscillators/TwistOscillator.cpp +++ b/src/common/dsp/oscillators/TwistOscillator.cpp @@ -376,7 +376,7 @@ void TwistOscillator::process_block_internal(float pitch, float drift, bool ster auto driftv = driftLFO.next(); patch->note = pitch + drift * driftv; - patch->engine = localcopy[oscdata->p[twist_engine].param_id_in_scene].i; + patch->engine = oscdata->p[twist_engine].val.i; harm.newValue(fvbp(twist_harmonics)); timb.newValue(fvbp(twist_timbre)); diff --git a/src/common/dsp/oscillators/WavetableOscillator.cpp b/src/common/dsp/oscillators/WavetableOscillator.cpp index 607d3c6c0ef..f1fc10afe13 100644 --- a/src/common/dsp/oscillators/WavetableOscillator.cpp +++ b/src/common/dsp/oscillators/WavetableOscillator.cpp @@ -49,8 +49,7 @@ void WavetableOscillator::init(float pitch, bool is_display, bool nonzero_init_d l_vskew.setRate(rate); l_hskew.setRate(rate); - n_unison = - limit_range(localcopy[oscdata->p[wt_unison_voices].param_id_in_scene].i, 1, MAX_UNISON); + n_unison = limit_range(oscdata->p[wt_unison_voices].val.i, 1, MAX_UNISON); if (oscdata->wt.flags & wtf_is_sample) { diff --git a/src/common/dsp/oscillators/WindowOscillator.cpp b/src/common/dsp/oscillators/WindowOscillator.cpp index c5ef8fd5ff8..1a02a384a56 100644 --- a/src/common/dsp/oscillators/WindowOscillator.cpp +++ b/src/common/dsp/oscillators/WindowOscillator.cpp @@ -62,8 +62,7 @@ void WindowOscillator::init(float pitch, bool is_display, bool nonzero_init_drif l_morph.setRate(0.05); update_lagvals(); - NumUnison = limit_range(localcopy[oscdata->p[win_unison_voices].param_id_in_scene].i, 1, - MAX_UNISON - 1); + NumUnison = limit_range(oscdata->p[win_unison_voices].val.i, 1, MAX_UNISON - 1); if (is_display) { @@ -196,8 +195,7 @@ void WindowOscillator::ProcessWindowOscs(bool stereo, bool FM) unsigned int SizeMask = (oscdata->wt.size << 16) - 1; unsigned int SizeMaskWin = (storage->WindowWT.size << 16) - 1; - unsigned char SelWindow = - limit_range(localcopy[oscdata->p[win_window].param_id_in_scene].i, 0, 8); + unsigned char SelWindow = limit_range(oscdata->p[win_window].val.i, 0, 8); int Table = limit_range((int)(float)(oscdata->wt.n_tables * l_morph.v), 0, (int)oscdata->wt.n_tables - 1);