Added controllers for mod-wheel, foot, breath and aftertouch.

pull/1/head
Holger Wirtz 8 years ago
parent c74b2b6635
commit d425065b31
  1. 28
      src/dexed.cpp
  2. 40
      src/msfa/controllers.h

@ -555,7 +555,7 @@ void Dexed::ProcessMidiMessage(const uint8_t *buf, uint32_t buf_size) {
// setCurrentProgram(buf[1]); // setCurrentProgram(buf[1]);
// break; // break;
// aftertouch // channel aftertouch
case 0xd0 : case 0xd0 :
TRACE("MIDI aftertouch 0xd0 event: %d %d",buf[1]); TRACE("MIDI aftertouch 0xd0 event: %d %d",buf[1]);
controllers.aftertouch_cc = buf[1]; controllers.aftertouch_cc = buf[1];
@ -684,12 +684,6 @@ void Dexed::onParam(uint8_t param_num,float param_val)
_param_change_counter++; _param_change_counter++;
if(param_num==165)
{
int32_t tune=param_val*0x4000;
controllers.masterTune=(tune<<11)*(1.0/12);
}
if(param_num==144 || param_num==134) if(param_num==144 || param_num==134)
panic(); panic();
@ -706,28 +700,32 @@ void Dexed::onParam(uint8_t param_num,float param_val)
controllers.values_[kControllerPitchStep]=data[param_num]; controllers.values_[kControllerPitchStep]=data[param_num];
break; break;
case 157: case 157:
controllers.values_[kControllerModRange]=data[param_num]; controllers.wheel.setRange(data[param_num]);
break; break;
case 158: case 158:
controllers.values_[kControllerModAssign]=data[param_num]; controllers.wheel.setConfig(data[param_num]);
break; break;
case 159: case 159:
controllers.values_[kControllerFootRange]=data[param_num]; controllers.foot.setRange(data[param_num]);
break; break;
case 160: case 160:
controllers.values_[kControllerFootAssign]=data[param_num]; controllers.foot.setConfig(data[param_num]);
break; break;
case 161: case 161:
controllers.values_[kControllerBreathRange]=data[param_num]; controllers.breath.setRange(data[param_num]);
break; break;
case 162: case 162:
controllers.values_[kControllerBreathAssign]=data[param_num]; controllers.breath.setConfig(data[param_num]);
break; break;
case 163: case 163:
controllers.values_[kControllerATRange]=data[param_num]; controllers.at.setRange(data[param_num]);
break; break;
case 164: case 164:
controllers.values_[kControllerATAssign]=data[param_num]; controllers.at.setConfig(data[param_num]);
break;
case 165:
int32_t tune=param_val*0x4000;
controllers.masterTune=(tune<<11)*(1.0/12);
break; break;
} }

@ -31,23 +31,11 @@
const int kControllerPitch = 0; const int kControllerPitch = 0;
const int kControllerPitchRange = 1; const int kControllerPitchRange = 1;
const int kControllerPitchStep = 2; const int kControllerPitchStep = 2;
const int kControllerMod = 4;
const int kControllerModRange = 5;
const int kControllerModAssign = 6;
const int kControllerFoot = 7;
const int kControllerFootRange = 8;
const int kControllerFootAssign = 9;
const int kControllerBreath = 10;
const int kControllerBreathRange = 11;
const int kControllerBreathAssign = 12;
const int kControllerAT = 13;
const int kControllerATRange = 14;
const int kControllerATAssign = 15;
class FmCore; class FmCore;
struct FmMod { struct FmMod {
int range; uint8_t range;
bool pitch; bool pitch;
bool amp; bool amp;
bool eg; bool eg;
@ -59,18 +47,22 @@ struct FmMod {
eg = false; eg = false;
} }
void parseConfig(const char *cfg) { public:
int r = 0, p = 0, a = 0, e = 0; void setRange(uint8_t r) {
sscanf(cfg, "%d %d %d %d", &r, &p, &a, &e); //range = r < 0 && r > 127 ? 0 : r;
range = r < 0 && r > 127 ? 0 : r; range = r < 0 && r > 100 ? 0 : r;
pitch = p != 0;
amp = a != 0;
eg = e != 0;
} }
void setConfig(char *cfg) { void setConfig(uint8_t assign) {
snprintf(cfg, 13, "%d %d %d %d", range, pitch, amp, eg); if(assign & 1)
pitch=true;
if(assign & (1<<1))
amp=true;
if(assign & (1<<2))
eg=true;
} }
}; };

Loading…
Cancel
Save