From aadf4221a44518d89e9fd15dd7aff7809e03cc1e Mon Sep 17 00:00:00 2001 From: Werner Schweer Date: Thu, 21 Jun 2007 16:57:16 +0000 Subject: update --- muse/synti/organ/organ.cpp | 17 ++++++++++++----- muse/synti/organ/organ.h | 3 ++- muse/synti/organ/organgui.ui | 5 ++++- muse/synti/organ/reverb.cpp | 2 +- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/muse/synti/organ/organ.cpp b/muse/synti/organ/organ.cpp index d2cc5635..1f6eede4 100644 --- a/muse/synti/organ/organ.cpp +++ b/muse/synti/organ/organ.cpp @@ -109,8 +109,7 @@ Organ::Organ(int sr) static const float v = -9.0; static const float m = 1.0 / (NO_VOICES - 12); for (int i = 11; i < NO_VOICES; i++) { - float a = float(i - 11); - keyCompression[i] = dBToGain(u + ((v - u) * a * m)); + keyCompression[i] = dBToGain(u + ((v - u) * float(i - 11) * m)); } // Initialize controller table @@ -124,6 +123,7 @@ Organ::Organ(int sr) addController("drawbar135", DRAWBAR6, 0, 8, 0); addController("drawbar113", DRAWBAR7, 0, 8, 0); addController("drawbar1", DRAWBAR8, 0, 8, 0); + addController("reverbOn", REVERB_ON, 0, 1, 0); addController("reverbRoomSize", REVERB_ROOM_SIZE, 0, 127, 60); addController("reverbMix", REVERB_MIX, 0, 127, 100); addController("vibratoOn", VIBRATO_ON, 0, 1, 1); @@ -275,13 +275,16 @@ void Organ::process(float** ports, int offset, int sampleCount) } for (int i = 0; i < sampleCount; ++i) { buffer1[i] *= volume * keyCompressionValue; + if (keyCompressionCount) { keyCompressionValue += keyCompressionDelta; --keyCompressionCount; } } - - reverb->process(buffer1, buffer2, sampleCount); + if (reverbOn) + reverb->process(buffer1, buffer2, sampleCount); + else + memcpy(buffer2, buffer1, sizeof(float) * sampleCount); } //--------------------------------------------------------- @@ -294,7 +297,7 @@ void Organ::changeKeyCompression() keyCompressionCount = int(sampleRate() * .005); // 5 msec envelope if (keyCompressionCount < 2) keyCompressionCount = 2; - keyCompressionDelta = (keyCompressionValue - kc) / keyCompressionCount; + keyCompressionDelta = (kc - keyCompressionValue) / keyCompressionCount; } //--------------------------------------------------------- @@ -386,6 +389,10 @@ void Organ::setController(int ctrlId, int data) reverb->setMix(float(data) / 127.0); break; + case REVERB_ON: + reverbOn = data != 0; + break; + case VIBRATO_ON: vibratoOn = data != 0; break; diff --git a/muse/synti/organ/organ.h b/muse/synti/organ/organ.h index 0f91826c..6a90d67a 100644 --- a/muse/synti/organ/organ.h +++ b/muse/synti/organ/organ.h @@ -29,7 +29,7 @@ static const int NO_ELEMENTS = 194; enum { DRAWBAR0 = CTRL_RPN14_OFFSET, DRAWBAR1, DRAWBAR2, DRAWBAR3, DRAWBAR4, DRAWBAR5, DRAWBAR6, DRAWBAR7, DRAWBAR8, - REVERB_ROOM_SIZE, REVERB_MIX, + REVERB_ON, REVERB_ROOM_SIZE, REVERB_MIX, VIBRATO_ON, VIBRATO_FREQ, VIBRATO_DEPTH, PERC_ON, PERC_SOFT, PERC_SLOW, }; @@ -83,6 +83,7 @@ class Organ : public Mess2 { OrganGui* gui; Reverb* reverb; + bool reverbOn; double volume; unsigned vibratoStep; diff --git a/muse/synti/organ/organgui.ui b/muse/synti/organ/organgui.ui index 1a0bd263..c0643106 100644 --- a/muse/synti/organ/organgui.ui +++ b/muse/synti/organ/organgui.ui @@ -107,10 +107,13 @@ background-color: gray; - + Reverb + + true + diff --git a/muse/synti/organ/reverb.cpp b/muse/synti/organ/reverb.cpp index 4ce94767..0ec29514 100644 --- a/muse/synti/organ/reverb.cpp +++ b/muse/synti/organ/reverb.cpp @@ -157,7 +157,7 @@ void Reverb::process(float* l, float* r, int n) outR = allpassR[k].process(outR); } l[i] = outL * wet + l[i] * dry; - r[i] = outR * wet + r[i] * dry; + r[i] = outR * wet + l[i] * dry; } } -- cgit v1.2.3