From b293ed223a5f70091fa90dd38e60dfb992168502 Mon Sep 17 00:00:00 2001 From: Krzysztof Foltman Date: Sat, 7 Feb 2009 15:47:42 +0000 Subject: [PATCH] + Organ: fix a bug causing voices not to be put on inactive list when polyphonic percussion is muted --- src/calf/organ.h | 3 ++- src/organ.cpp | 3 ++- src/synth.cpp | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/calf/organ.h b/src/calf/organ.h index 36d0e1f..d4f8e9d 100644 --- a/src/calf/organ.h +++ b/src/calf/organ.h @@ -268,12 +268,13 @@ public: return note; } virtual bool get_active() { + // printf("note %d getactive %d use_percussion %d pamp active %d\n", note, amp.get_active(), use_percussion(), pamp.get_active()); return (note != -1) && (amp.get_active() || (use_percussion() && pamp.get_active())); } void update_pitch(); inline bool use_percussion() { - return dsp::fastf2i_drm(parameters->percussion_trigger) == perctrig_polyphonic; + return dsp::fastf2i_drm(parameters->percussion_trigger) == perctrig_polyphonic && parameters->percussion_level > 0; } }; diff --git a/src/organ.cpp b/src/organ.cpp index 338ba1d..c20d174 100644 --- a/src/organ.cpp +++ b/src/organ.cpp @@ -765,7 +765,8 @@ void organ_voice_base::perc_note_on(int note, int vel) perc_reset(); released_ref = false; this->note = note; - pamp.set(1.0f + (vel - 127) * parameters->percussion_vel2amp / 127.0); + if (parameters->percussion_level > 0) + pamp.set(1.0f + (vel - 127) * parameters->percussion_vel2amp / 127.0); update_pitch(); float (*kt)[2] = parameters->percussion_keytrack; // assume last point (will be put there by padding) diff --git a/src/synth.cpp b/src/synth.cpp index 5b7518b..35c5cea 100644 --- a/src/synth.cpp +++ b/src/synth.cpp @@ -64,14 +64,17 @@ dsp::voice *basic_synth::steal_voice() { std::list::iterator found = active_voices.end(); float priority = 10000; + //int idx = 0; for(std::list::iterator i = active_voices.begin(); i != active_voices.end(); i++) { + //printf("Voice %d priority %f at %p\n", idx++, (*i)->get_priority(), *i); if ((*i)->get_priority() < priority) { priority = (*i)->get_priority(); found = i; } } + //printf("Found: %p\n\n", *found); if (found == active_voices.end()) return NULL; -- 2.11.4.GIT