summaryrefslogtreecommitdiffstats
path: root/src/synth_engine.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/synth_engine.c')
-rw-r--r--src/synth_engine.c19
1 files changed, 8 insertions, 11 deletions
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<framesPerBuffer * 2; i += 2 ) {