void Note::set_param(const parameter_t &p, fixed_t v) //ACHTUNG: { //wenn das verändert wird, muss auch program_t::set_param verändert werden! switch(p.par) { case ATTACK: envelope[p.osc]->set_attack(v*samp_rate >>SCALE); break; case DECAY: envelope[p.osc]->set_decay(v*samp_rate >>SCALE); break; case SUSTAIN: envelope[p.osc]->set_sustain(v); break; case RELEASE: envelope[p.osc]->set_release(v*samp_rate >>SCALE); break; case HOLD: envelope[p.osc]->set_hold(v!=0); break; case KSR: oscillator[p.osc].ksr=float(v)/ONE; break; case KSL: oscillator[p.osc].ksl=float(v)/ONE; break; case FACTOR: oscillator[p.osc].factor=v; break; case MODULATION: oscillator[p.osc].fm_strength[p.index]=v*pfactor.fm[p.osc][p.index] >>SCALE; break; case OUTPUT: oscillator[p.osc].output=v*pfactor.out[p.osc] >>SCALE; break; case TREMOLO: oscillator[p.osc].tremolo_depth=v; break; case TREM_LFO: oscillator[p.osc].tremolo_lfo=v; break; case VIBRATO: oscillator[p.osc].vibrato_depth=v; break; case VIB_LFO: oscillator[p.osc].vibrato_lfo=v; break; case WAVEFORM: oscillator[p.osc].waveform=v; break; case SYNC: oscillator[p.osc].sync=(v!=0); break; case FILTER_ENABLED: output_note("NOTE: cannot enable filter in playing notes"); break; case FILTER_ENV_AMOUNT: filter_params.env_amount=float(v*pfactor.filter_env)/ONE/ONE; break; case FILTER_ATTACK: if (filter_params.enabled) filter_envelope->set_attack(v*samp_rate/filter_update_frames >>SCALE); else output_note("NOTE: cannot set filter-attack when filter is disabled"); break; case FILTER_DECAY: if (filter_params.enabled) filter_envelope->set_decay(v*samp_rate/filter_update_frames >>SCALE); else output_note("NOTE: cannot set filter-decay when filter is disabled"); break; case FILTER_SUSTAIN: if (filter_params.enabled) filter_envelope->set_sustain(v); else output_note("NOTE: cannot set filter-sustain when filter is disabled"); break; case FILTER_RELEASE: if (filter_params.enabled) filter_envelope->set_release(v*samp_rate/filter_update_frames >>SCALE); else output_note("NOTE: cannot set filter-release when filter is disabled"); break; case FILTER_HOLD: if (filter_params.enabled) filter_envelope->set_hold(v!=0); else output_note("NOTE: cannot set filter-hold when filter is disabled"); break; case FILTER_OFFSET: filter_params.freqfactor_offset=float(v*pfactor.filter_offset)/ONE/ONE; break; case FILTER_RESONANCE: filter_params.resonance=float(v*pfactor.filter_res)/ONE/ONE; break; case FILTER_TREMOLO: filter_params.trem_strength=v; break; case FILTER_TREM_LFO: filter_params.trem_lfo=v; break; case SYNC_FACTOR: sync_factor=v; break; default: throw string("trying to set an unknown parameter"); } }