diff options
author | Florian Jung <flo@thinkpad.(none)> | 2011-01-14 13:38:54 +0100 |
---|---|---|
committer | Florian Jung <flo@thinkpad.(none)> | 2011-01-14 13:38:54 +0100 |
commit | b2d0c97e0ca7b7eb0a7195ddbf263b9953171e66 (patch) | |
tree | 00ecb19be6f349196b8c14085ff3325b074677c2 /synth/jack.cpp | |
parent | a43a4e27a2ba3c34bac5a215ce49175b22913bd4 (diff) |
Moved lfos and sample-and-hold in own source file
Diffstat (limited to 'synth/jack.cpp')
-rw-r--r-- | synth/jack.cpp | 37 |
1 files changed, 2 insertions, 35 deletions
diff --git a/synth/jack.cpp b/synth/jack.cpp index fbf1ea0..d0a6169 100644 --- a/synth/jack.cpp +++ b/synth/jack.cpp @@ -10,6 +10,7 @@ #include "jack.h" #include "communication.h" +#include "lfos.h" using namespace std; @@ -46,40 +47,6 @@ void process_request() -void maybe_calc_stuff() //TODO woandershinschieben? lfo.cpp oder so? -{ - static int lfocnt=0; - static int snhcnt=0; - - if (lfocnt==0) - { - lfocnt=lfo_update_frames; - - for (int i=0;i<N_LFOS;i++) - { - lfo_phase[i]=(lfo_phase[i]+1)%lfo_res[i]; - curr_lfo[i]=lfo[i][lfo_phase[i]]; - } - } - - if (snhcnt==0) - { - snhcnt=sample_and_hold_frames; - - //temp ranges between -ONE and ONE - fixed_t temp = (float(rand())/(RAND_MAX/2) - 1.0) * ONE; - - for (int i=0;i<N_LFO_LEVELS;i++) - sample_and_hold[i]= temp*i/(N_LFO_LEVELS-1) + ONE; - - curr_lfo[SNH_LFO]=sample_and_hold; - // could be moved to some init function, but looks clearer and - // does not eat up the cpu too much ;) - } - - lfocnt--; - snhcnt--; -} @@ -479,7 +446,7 @@ int process_callback(jack_nframes_t nframes, void *notused) } } - maybe_calc_stuff(); + maybe_calc_lfos(); for (int j=0;j<N_CHANNELS;j++) { |