diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-04-25 20:04:08 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-04-25 20:04:08 +0200 |
commit | 64d8efa4f3abe4257120b85fb4d4a063d96edbfc (patch) | |
tree | d2cde0ad7b59c5f6acbf3c6792118ad3fda28fbf /src/instrument.cc | |
parent | 541f6c214762cceb348f9657258c3db758ea667f (diff) |
Use old 'velocity groups' algorithm on version 1.0 instruments and new 'power distribution' algorithm on 2.0 instruments. Remove 'with-experimental' option from configure.
Diffstat (limited to 'src/instrument.cc')
-rw-r--r-- | src/instrument.cc | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/src/instrument.cc b/src/instrument.cc index 8c88503..d0b25aa 100644 --- a/src/instrument.cc +++ b/src/instrument.cc @@ -34,10 +34,6 @@ #include "sample.h" #include "configuration.h" -#ifdef EXPERIMENTAL -#define NEW_ALGORITHM -#endif - Instrument::Instrument() { DEBUG(instrument, "new %p\n", this); @@ -88,15 +84,16 @@ Sample *Instrument::sample(level_t level, size_t pos) if(mod > 1.0) mod = 1.0; } -#ifdef NEW_ALGORITHM - sample = powerlist.get(level * mod); -#else - // printf("Find level %f\n", level); - std::vector<Sample*> s = samples.get(level * mod); - if(s.size() == 0) return NULL; - size_t idx = rand()%(s.size()); - sample = s[idx]; -#endif/*NEW_ALGORITHM*/ + if(version >= VersionStr("2.0")) { + // Version 2.0 + sample = powerlist.get(level * mod); + } else { + // Version 1.0 + std::vector<Sample*> s = samples.get(level * mod); + if(s.size() == 0) return NULL; + size_t idx = rand()%(s.size()); + sample = s[idx]; + } if(Conf::enable_velocity_modifier) { lastpos = pos; @@ -113,15 +110,15 @@ void Instrument::addSample(level_t a, level_t b, Sample *s) void Instrument::finalise() { -#ifdef NEW_ALGORITHM - std::vector<Sample*>::iterator s = samplelist.begin(); - while(s != samplelist.end()) { - powerlist.add(*s); - s++; + if(version >= VersionStr("2.0")) { + std::vector<Sample*>::iterator s = samplelist.begin(); + while(s != samplelist.end()) { + powerlist.add(*s); + s++; + } + + powerlist.finalise(); } - - powerlist.finalise(); -#endif/*NEW_ALGORITHM*/ } std::string Instrument::name() |