summaryrefslogtreecommitdiffstats
path: root/src/synth_engine_v2.c
diff options
context:
space:
mode:
authoranastasisg <anastasis@learnworlds.com>2025-11-28 15:25:16 +0200
committeranastasisg <anastasis@learnworlds.com>2025-11-28 15:25:16 +0200
commitd394d6e056788bfb3764463cd04d796f74924e15 (patch)
treec28947dbac6eec56046ab717d5ade8dca09af94d /src/synth_engine_v2.c
parent5f3058f662b7222ea47a49ea2a450aa0491b5496 (diff)
downloadsynth-project-d394d6e056788bfb3764463cd04d796f74924e15.tar.gz
synth-project-d394d6e056788bfb3764463cd04d796f74924e15.tar.bz2
synth-project-d394d6e056788bfb3764463cd04d796f74924e15.zip
add lfo-on-pitch toggle
Diffstat (limited to 'src/synth_engine_v2.c')
-rw-r--r--src/synth_engine_v2.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/synth_engine_v2.c b/src/synth_engine_v2.c
index 41cbcf4..538a840 100644
--- a/src/synth_engine_v2.c
+++ b/src/synth_engine_v2.c
@@ -274,7 +274,10 @@ make_sample(synth_t * synth, unsigned int sample_rate, int frame)
float targ_freq = note->freq * CC_GET(pitch);
float lfo_value = osc_sin(note->lfo_index);
- targ_freq = targ_freq + targ_freq * CC_GET(lfo_amp) * lfo_value; //can switch to glfo
+ if (synth->lfo_on_pitch) {
+ targ_freq = targ_freq +
+ targ_freq * CC_GET(lfo_amp) * lfo_value; // can switch to glfo
+ }
note->lfo_index = osc_sin_next(CC_GET(lfo_freq), note->lfo_index);
@@ -524,7 +527,7 @@ init_synth(void)
CC(synth->cc_cutoff, "cutoff", 50, 22000, 30, 5000);
//CC(synth->cc_resonance, "resonance", 1, 10, .02, 1);
CC(synth->cc_resonance, "resonance", 0.01, 10, .02, 0.5);
- CC(synth->cc_lfo_freq, "lfo_freq", 1, 1000, 2, 1);
+ CC(synth->cc_lfo_freq, "lfo_freq", 0.1, 10, .01, 1);
CC(synth->cc_lfo_amp, "lfo_amp", 0, 1, .01f, 0);
CC(synth->cc_pitch, "pitch", -3, 4, 0.01f, 1);
CC(synth->cc_adsr_a, "attack", 0, 3, 0.01f, 0.00);
@@ -559,6 +562,7 @@ init_synth(void)
synth->f_adsr.r = 0.4;
synth->f_adsr.elapsed = 0;
+ synth->lfo_on_pitch = 0;
synth->lfo_on_cutoff = 0;
synth->lfo_index = 0.0f;