summaryrefslogtreecommitdiff
path: root/note_compiler/templates/set_param.1
blob: e99f4819d01674245b2942efd6798508b3d36fdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
	if ( ((p.par==ATTACK) || (p.par==DECAY) || (p.par==SUSTAIN) || 
	     (p.par==RELEASE) || (p.par==HOLD)) && sel_env==NULL )
	{
		output_note("NOTE: cannot change parameter for envelope"+IntToStr(p.osc)+" because it's disabled");
		return;
	}
		
	if ( ((p.par==FREQ_ATTACK) || (p.par==FREQ_DECAY) || (p.par==FREQ_SUSTAIN) || 
	     (p.par==FREQ_RELEASE) || (p.par==FREQ_HOLD)) && sel_factor_env==NULL )
	{
		output_note("NOTE: cannot change parameter for freq-envelope"+IntToStr(p.osc)+" because it's disabled");
		return;
	}
		
	switch(p.par)
	{
		case ATTACK: sel_env->set_attack(v*samp_rate >>SCALE); break;
		case DECAY: sel_env->set_decay(v*samp_rate >>SCALE); break;
		case SUSTAIN: sel_env->set_sustain(v); break;
		case RELEASE: sel_env->set_release(v*samp_rate >>SCALE); break;
		case HOLD: sel_env->set_hold(v!=0); break;

		case FREQ_ATTACK: sel_factor_env->set_attack(v*samp_rate >>SCALE); break;
		case FREQ_DECAY: sel_factor_env->set_decay(v*samp_rate >>SCALE); break;
		case FREQ_SUSTAIN: sel_factor_env->set_sustain(v); break;
		case FREQ_RELEASE: sel_factor_env->set_release(v*samp_rate >>SCALE); break;
		case FREQ_HOLD: sel_factor_env->set_hold((v!=0)); break;
		case FREQ_ENV_AMOUNT: sel_orig_osc->freq_env_amount=double(v)/ONE; apply_pfactor(); break;

		case KSR: sel_osc->ksr=float(v)/ONE; break;
		case KSL: sel_osc->ksl=float(v)/ONE; break;

		case FACTOR: sel_orig_osc->factor=v; sel_osc->factor=v*freqfactor_factor[p.osc]; break;
		case TREMOLO: sel_osc->tremolo_depth=v; break;
		case TREM_LFO: sel_osc->tremolo_lfo=v; break;
		case VIBRATO: sel_osc->vibrato_depth=v; break;
		case VIB_LFO: sel_osc->vibrato_lfo=v; break;
		case WAVEFORM: sel_osc->waveform=v; break;
		case SYNC: sel_osc->sync=(v!=0); break;
		case MODULATION: sel_orig_osc->fm_strength[p.index]=v; apply_pfactor(); break;
    case OUTPUT: sel_orig_osc->output=v; apply_pfactor(); break;