From fb64a8b33f0183a7f79a205c805dee571bf4661b Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Thu, 12 Jan 2017 09:11:35 +0100 Subject: [PATCH] Fixed initialization of pitch-bend. Added opSwitch to the controllers and changed controller code for this. --- src/dexed.cpp | 9 +++++++-- src/msfa/controllers.h | 9 ++++----- src/msfa/dx7note.cc | 3 ++- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/dexed.cpp b/src/dexed.cpp index 0b87a37..a2a105f 100644 --- a/src/dexed.cpp +++ b/src/dexed.cpp @@ -48,13 +48,15 @@ Dexed::Dexed(double rate) : lvtk::Synth(p_n_ports, p_midi_in) } currentNote = 0; - memset(&controllers.values_, 0, sizeof(controllers.values_)); controllers.values_[kControllerPitch] = 0x2000; + controllers.values_[kControllerPitchRange] = data[156]; + controllers.values_[kControllerPitchStep] = data[157]; controllers.modwheel_cc = 0; controllers.foot_cc = 0; controllers.breath_cc = 0; controllers.aftertouch_cc = 0; controllers.masterTune=0; + controllers.opSwitch=0; bufsize_=256; @@ -694,7 +696,7 @@ void Dexed::onParam(uint8_t param_num,float param_val) _param_change_counter++; - if(param_num==144 || param_num==134) + if(param_num==144 || param_num==134 || param_num==155) panic(); refreshVoice=true; @@ -703,6 +705,9 @@ void Dexed::onParam(uint8_t param_num,float param_val) switch(param_num) { + case 155: + controllers.opSwitch=data[param_num]; + break; case 156: controllers.values_[kControllerPitchRange]=data[param_num]; break; diff --git a/src/msfa/controllers.h b/src/msfa/controllers.h index 6eac688..f9ed3b9 100755 --- a/src/msfa/controllers.h +++ b/src/msfa/controllers.h @@ -76,9 +76,7 @@ class Controllers { } public: - int32_t values_[16]; - - char opSwitch[7]; + int32_t values_[3]; int amp_mod; int pitch_mod; @@ -90,7 +88,9 @@ public: int modwheel_cc; int masterTune; - + + uint8_t opSwitch; + FmMod wheel; FmMod foot; FmMod breath; @@ -100,7 +100,6 @@ public: amp_mod = 0; pitch_mod = 0; eg_mod = 0; - strcpy(opSwitch, "111111"); } void refresh() { diff --git a/src/msfa/dx7note.cc b/src/msfa/dx7note.cc index 258e6cc..b819cca 100644 --- a/src/msfa/dx7note.cc +++ b/src/msfa/dx7note.cc @@ -216,7 +216,8 @@ void Dx7Note::compute(int32_t *buf, int32_t lfo_val, int32_t lfo_delay, const Co // ==== OP RENDER ==== for (int op = 0; op < 6; op++) { - if ( ctrls->opSwitch[op] == '0' ) { + //if ( ctrls->opSwitch[op] == '0' ) { + if ( ctrls->opSwitch & (1<