diff options
author | deva <deva> | 2008-08-05 08:43:35 +0000 |
---|---|---|
committer | deva <deva> | 2008-08-05 08:43:35 +0000 |
commit | 90d1466d82e01fd7e5e2d2b49977e2dccaac9e33 (patch) | |
tree | c5a3a1dcdf4425340cb469baf54dc8096e298e76 /src/beatmapper.cc | |
parent | 733e8c2efaee6ac3e0c6cfe81f09171af6a14303 (diff) |
Forgot to put eXpat in configure
Diffstat (limited to 'src/beatmapper.cc')
-rw-r--r-- | src/beatmapper.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/beatmapper.cc b/src/beatmapper.cc index 99432ce..2600499 100644 --- a/src/beatmapper.cc +++ b/src/beatmapper.cc @@ -26,18 +26,21 @@ */ #include "beatmapper.h" +#define DEF 2.0 + BeatMapper::BeatMapper(Instrument *instrument) { this->instrument = instrument; - for(size_t i = 0; i < HISTORY_SIZE; i++) hist[i] = 1.0; + for(size_t i = 0; i < HISTORY_SIZE; i++) hist[i] = DEF; C = 1.3; - mindist = 2; + mindist = 4; last = mindist; } Sample *BeatMapper::map(jack_nframes_t nframes) { + return NULL; Sample *sample = NULL; jack_default_audio_sample_t *buffer; @@ -50,13 +53,15 @@ Sample *BeatMapper::map(jack_nframes_t nframes) float E = 0.0; for(size_t i = 0; i < HISTORY_SIZE; i++) E += hist[i] / (float)HISTORY_SIZE; - if(E == 0) E = 1.0; // We do not have a connection + if(E == 0) E = DEF; // We do not have a connection // printf("last: %d, E: %f, e: %f - threshold: %f\n", last, E, e, 1.3 * E); // Shift history and save new value for(size_t i = 0; i < HISTORY_SIZE - 1; i++) hist[i] = hist[i+1]; - hist[HISTORY_SIZE - 1] = e; + hist[HISTORY_SIZE - 1] = e>DEF?e:DEF; + + if(instrument->name == "hihat" && e > 0) printf("e: %f\n", e); if(e > C * E && last > mindist) { Velocity *v = instrument->getVelocity(127); |