diff options
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() |