From 70d0d8ab25a1a9e92aa3016b661b0a9fe1c3c7cb Mon Sep 17 00:00:00 2001 From: gramanas Date: Fri, 8 Sep 2023 11:06:49 +0300 Subject: tmp --- src/synth_engine.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/synth_engine.c') diff --git a/src/synth_engine.c b/src/synth_engine.c index 09c50bb..1e82284 100644 --- a/src/synth_engine.c +++ b/src/synth_engine.c @@ -183,8 +183,10 @@ make_sample(void *synthData, unsigned int sample_rate, int frame) targ_freq = targ_freq + targ_freq * cc_iget(&synth->cc_lfo_amp, frame, FRAMES_PER_BUFFER) * // (1.05946309436/24.0) * - (wvt_next(wvt_tri, (wvt_next(wvt_sound, 2 * cc_iget(&synth->cc_lfo_freq, frame, FRAMES_PER_BUFFER), SAMPLE_RATE, &lfo_index) / 2.0 + 0.5) * cc_iget(&synth->cc_lfo_freq, frame, FRAMES_PER_BUFFER), SAMPLE_RATE, &synth->midi_note[i].lfo_index) / 2.0 + 0.5); + osc_sin(synth->midi_note[i].lfo_index); + //(wvt_next(wvt_tri, (wvt_next(wvt_sound, 2 * cc_iget(&synth->cc_lfo_freq, frame, FRAMES_PER_BUFFER), SAMPLE_RATE, &lfo_index) / 2.0 + 0.5) * cc_iget(&synth->cc_lfo_freq, frame, FRAMES_PER_BUFFER), SAMPLE_RATE, &synth->midi_note[i].lfo_index) / 2.0 + 0.5); + synth->midi_note[i].lfo_index = osc_sin_next(cc_iget(&synth->cc_lfo_freq, frame, FRAMES_PER_BUFFER), synth->midi_note[i].lfo_index); /* float synth_sample = synth->osctri->ops->sample(synth->osctri, synth->midi_note[i].wvt_index); */ /* synth->midi_note[i].wvt_index = synth->osctri->ops->next(synth->osctri, targ_freq, synth->midi_note[i].wvt_index); */ float synth_sample = synth->gen[synth->geni](targ_freq, @@ -261,21 +263,12 @@ get_frame(void *outputBuffer, synth_t *synth, int i) if (!synth->active) { - /* *out++ = 0.0f; */ - /* *out++ = 0.0f; */ - - //add_to_viz(synth, 0.0f); lfo_index = 0; - // return; } if (!notes_active(synth)) { synth->active = 0; - /* *out++ = 0.0f; */ - /* *out++ = 0.0f; */ - //add_to_viz(synth, 0.0f); lfo_index = 0; - // return; } if (!synth->delay) { @@ -295,10 +288,14 @@ get_frame(void *outputBuffer, synth_t *synth, int i) s = clamp(s + synth->del_feedback * tmp, -1, 1); } + add_to_delay(synth, s); *out++ = s; *out++ = s; + if (s > 1 || s < -1) { + printf("!! %f !!\n", s); + } // move time increment_synth(synth); @@ -406,7 +403,7 @@ sound_gen(const void *inputBuffer, void *outputBuffer, get_frame(buffer, synth, i); } // process buffer - if (synth->multi) process(buffer); + //if (synth->multi) process(buffer); // output buffer for( unsigned long i=0; i