main/alles.c
void hold_and_modify(uint8_t voice) {
    // Copy all the modifier variables
    msynth[voice].amp = synth[voice].amp;
    msynth[voice].duty = synth[voice].duty;
    msynth[voice].freq = synth[voice].freq;

    // Modify the synth params by scale -- ADSR scale is (original * scale)
    float scale = compute_adsr_scale(voice);
    if(synth[voice].adsr_target & TARGET_AMP) msynth[voice].amp = msynth[voice].amp * scale;
    if(synth[voice].adsr_target & TARGET_DUTY) msynth[voice].duty = msynth[voice].duty * scale;
    if(synth[voice].adsr_target & TARGET_FREQ) msynth[voice].freq = msynth[voice].freq * scale;
    if(synth[voice].adsr_target & TARGET_FILTER_FREQ) mglobal.filter_freq = (mglobal.filter_freq * scale);
    if(synth[voice].adsr_target & TARGET_RESONANCE) mglobal.resonance = mglobal.resonance * scale;

    // And the LFO -- LFO scale is (original + (original * scale))
    scale = compute_lfo_scale(voice);
    if(synth[voice].lfo_target & TARGET_AMP) msynth[voice].amp = msynth[voice].amp + (msynth[voice].amp * scale);
    if(synth[voice].lfo_target & TARGET_DUTY) msynth[voice].duty = msynth[voice].duty + (msynth[voice].duty * scale);
    if(synth[voice].lfo_target & TARGET_FREQ) msynth[voice].freq = msynth[voice].freq + (msynth[voice].freq * scale);
    if(synth[voice].lfo_target & TARGET_FILTER_FREQ) mglobal.filter_freq = mglobal.filter_freq + (mglobal.filter_freq * scale);
    if(synth[voice].lfo_target & TARGET_RESONANCE) mglobal.resonance = mglobal.resonance + (mglobal.resonance * scale);
}
// Apply an LFO & ADSR, if any, to the voice
Apply an LFO & ADSR, if any, to the voice
Apply an LFO & ADSR if any to the voice
void hold_and_modify(uint8_t voice) {
    msynth[voice].amp = synth[voice].amp;
    msynth[voice].duty = synth[voice].duty;
    msynth[voice].freq = synth[voice].freq;
    float scale = compute_adsr_scale(voice);
    if(synth[voice].adsr_target & TARGET_AMP) msynth[voice].amp = msynth[voice].amp * scale;
    if(synth[voice].adsr_target & TARGET_DUTY) msynth[voice].duty = msynth[voice].duty * scale;
    if(synth[voice].adsr_target & TARGET_FREQ) msynth[voice].freq = msynth[voice].freq * scale;
    if(synth[voice].adsr_target & TARGET_FILTER_FREQ) mglobal.filter_freq = (mglobal.filter_freq * scale);
    if(synth[voice].adsr_target & TARGET_RESONANCE) mglobal.resonance = mglobal.resonance * scale;
    scale = compute_lfo_scale(voice);
    if(synth[voice].lfo_target & TARGET_AMP) msynth[voice].amp = msynth[voice].amp + (msynth[voice].amp * scale);
    if(synth[voice].lfo_target & TARGET_DUTY) msynth[voice].duty = msynth[voice].duty + (msynth[voice].duty * scale);
    if(synth[voice].lfo_target & TARGET_FREQ) msynth[voice].freq = msynth[voice].freq + (msynth[voice].freq * scale);
    if(synth[voice].lfo_target & TARGET_FILTER_FREQ) mglobal.filter_freq = mglobal.filter_freq + (mglobal.filter_freq * scale);
    if(synth[voice].lfo_target & TARGET_RESONANCE) mglobal.resonance = mglobal.resonance + (mglobal.resonance * scale);
}
void hold_and_modify ( uint8_t voice ) { msynth [ voice ] . amp = synth [ voice ] . amp ; msynth [ voice ] . duty = synth [ voice ] . duty ; msynth [ voice ] . freq = synth [ voice ] . freq ; float scale = compute_adsr_scale ( voice ) ; if ( synth [ voice ] . adsr_target & TARGET_AMP ) msynth [ voice ] . amp = msynth [ voice ] . amp * scale ; if ( synth [ voice ] . adsr_target & TARGET_DUTY ) msynth [ voice ] . duty = msynth [ voice ] . duty * scale ; if ( synth [ voice ] . adsr_target & TARGET_FREQ ) msynth [ voice ] . freq = msynth [ voice ] . freq * scale ; if ( synth [ voice ] . adsr_target & TARGET_FILTER_FREQ ) mglobal . filter_freq = ( mglobal . filter_freq * scale ) ; if ( synth [ voice ] . adsr_target & TARGET_RESONANCE ) mglobal . resonance = mglobal . resonance * scale ; scale = compute_lfo_scale ( voice ) ; if ( synth [ voice ] . lfo_target & TARGET_AMP ) msynth [ voice ] . amp = msynth [ voice ] . amp + ( msynth [ voice ] . amp * scale ) ; if ( synth [ voice ] . lfo_target & TARGET_DUTY ) msynth [ voice ] . duty = msynth [ voice ] . duty + ( msynth [ voice ] . duty * scale ) ; if ( synth [ voice ] . lfo_target & TARGET_FREQ ) msynth [ voice ] . freq = msynth [ voice ] . freq + ( msynth [ voice ] . freq * scale ) ; if ( synth [ voice ] . lfo_target & TARGET_FILTER_FREQ ) mglobal . filter_freq = mglobal . filter_freq + ( mglobal . filter_freq * scale ) ; if ( synth [ voice ] . lfo_target & TARGET_RESONANCE ) mglobal . resonance = mglobal . resonance + ( mglobal . resonance * scale ) ; }
Apply an LFO & ADSR, if any, to the voice
Apply an LFO & ADSR if any to the voice
// Copy all the modifier variables // Modify the synth params by scale -- ADSR scale is (original * scale) // And the LFO -- LFO scale is (original + (original * scale))