From 58f8f4c3f8d731540d68fc322389df98255a1909 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Thu, 1 Mar 2018 17:38:59 +0000 Subject: [PATCH] Several fixes: - MW/AT/FC/BC should now work. - Fix for avoid crashing at removing plugin. --- src/dexed.cpp | 35 ++++++++++++++++++++++++++--------- src/msfa/controllers.h | 14 ++++++-------- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/dexed.cpp b/src/dexed.cpp index 4c8ed65..4b085d5 100644 --- a/src/dexed.cpp +++ b/src/dexed.cpp @@ -133,29 +133,31 @@ Dexed::~Dexed() { TRACE("Hi"); - if(outbuf_!=NULL) + TRACE("0"); + if(outbuf_) delete [] outbuf_; currentNote = -1; + TRACE("1"); for (uint8_t note = 0; note < MAX_ACTIVE_NOTES; ++note) { - if ( voices[note].dx7_note != NULL ) + if(voices[note].dx7_note) { delete voices[note].dx7_note; - voices[note].dx7_note = NULL; } - voices[note].keydown = false; - voices[note].sustained = false; - voices[note].live = false; } + TRACE("2"); if(engineMsfa) - delete(engineMkI); + delete(engineMsfa); + TRACE("3"); if(engineOpl) - delete(engineMkI); + delete(engineOpl); + TRACE("4"); if(engineMkI) delete(engineMkI); + TRACE("5"); TRACE("Bye"); TRACE("--------------------------------------------------------------------------------"); @@ -784,29 +786,44 @@ void Dexed::onParam(uint8_t param_num,float param_val) controllers.values_[kControllerPitchStep]=data[param_num]; break; case 157: - TRACE("wheel.setRange(%d)",data[param_num]); controllers.wheel.setRange(data[param_num]); + controllers.wheel.setTarget(data[param_num+1]); + controllers.refresh(); break; case 158: + controllers.wheel.setRange(data[param_num-1]); controllers.wheel.setTarget(data[param_num]); + controllers.refresh(); break; case 159: controllers.foot.setRange(data[param_num]); + controllers.foot.setTarget(data[param_num+1]); + controllers.refresh(); break; case 160: + controllers.foot.setRange(data[param_num-1]); controllers.foot.setTarget(data[param_num]); + controllers.refresh(); break; case 161: controllers.breath.setRange(data[param_num]); + controllers.breath.setTarget(data[param_num+1]); + controllers.refresh(); break; case 162: + controllers.breath.setRange(data[param_num-1]); controllers.breath.setTarget(data[param_num]); + controllers.refresh(); break; case 163: controllers.at.setRange(data[param_num]); + controllers.at.setTarget(data[param_num+1]); + controllers.refresh(); break; case 164: + controllers.at.setRange(data[param_num-1]); controllers.at.setTarget(data[param_num]); + controllers.refresh(); break; case 165: tune=param_val*0x4000; diff --git a/src/msfa/controllers.h b/src/msfa/controllers.h index e4dd79b..b8179e2 100755 --- a/src/msfa/controllers.h +++ b/src/msfa/controllers.h @@ -52,13 +52,13 @@ struct FmMod { } void setTarget(uint8_t assign) { + TRACE("Target: %d", assign); assign=assign < 0 && assign > 7 ? 0 : assign; - if(assign&1) // AMP - pitch=true; - if(assign&2) // PITCH - amp=true; - if(assign&4) // EG - eg=true; + pitch=assign&1; // AMP + amp=assign&2; // PITCH + eg=assign&4; // EG + + TRACE("pitch[%d] amp[%d] eg[%d]", pitch,amp,eg); } }; @@ -115,8 +115,6 @@ public: if ( ! ((wheel.eg || foot.eg) || (breath.eg || at.eg)) ) eg_mod = 127; - - TRACE("amp_mod %d pitch_mod %d", amp_mod, pitch_mod); } FmCore *core;