Additional MIDI CC and fixes
This commit is contained in:
parent
729890ef7e
commit
48849a96d8
4 changed files with 112 additions and 18 deletions
|
@ -31,6 +31,8 @@ public:
|
|||
int controllers[255];
|
||||
int controllers_default[255];
|
||||
|
||||
std::map<String, int> mapping;
|
||||
|
||||
bool loaded = false;
|
||||
MidiMap()
|
||||
{
|
||||
|
@ -39,243 +41,320 @@ public:
|
|||
}
|
||||
void reset(){
|
||||
for(int i = 0 ; i < 255;i++){
|
||||
controllers[i] = 0;
|
||||
controllers_default[i] = 0;
|
||||
controllers[i] = -1;
|
||||
controllers_default[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void set_default(){
|
||||
int midicc = 71;
|
||||
controllers[midicc] = controllers_default[midicc] = VOLUME;
|
||||
mapping["VOLUME"]=VOLUME;
|
||||
|
||||
midicc = 15;
|
||||
controllers[midicc] = controllers_default[midicc] = VOICE_COUNT;
|
||||
mapping["VOICE_COUNT"]=VOICE_COUNT;
|
||||
|
||||
midicc = 33;
|
||||
controllers[midicc] = controllers_default[midicc] = TUNE;
|
||||
mapping["TUNE"]=TUNE;
|
||||
|
||||
|
||||
midicc = 17;
|
||||
controllers[midicc] = controllers_default[midicc] = OCTAVE;
|
||||
mapping["OCTAVE"]=OCTAVE;
|
||||
|
||||
midicc = 118;
|
||||
controllers[midicc] = controllers_default[midicc] = BENDRANGE;
|
||||
mapping["BENDRANGE"]=BENDRANGE;
|
||||
|
||||
midicc = 34;
|
||||
controllers[midicc] = controllers_default[midicc] = BENDOSC2;
|
||||
mapping["BENDOSC2"]=BENDOSC2;
|
||||
|
||||
midicc = 35;
|
||||
controllers[midicc] = controllers_default[midicc] = LEGATOMODE;
|
||||
mapping["LEGATOMODE"]=LEGATOMODE;
|
||||
|
||||
midicc = 75;
|
||||
controllers[midicc] = controllers_default[midicc] = BENDLFORATE;
|
||||
mapping["BENDLFORATE"]=BENDLFORATE;
|
||||
|
||||
midicc = 76;
|
||||
controllers[midicc] = controllers_default[midicc] = VFLTENV;
|
||||
mapping["VFLTENV"]=VFLTENV;
|
||||
|
||||
midicc = 20;
|
||||
controllers[midicc] = controllers_default[midicc] = VAMPENV;
|
||||
mapping["VAMPENV"]=VAMPENV;
|
||||
|
||||
midicc = 21;
|
||||
controllers[midicc] = controllers_default[midicc] = ASPLAYEDALLOCATION;
|
||||
mapping["ASPLAYEDALLOCATION"]=ASPLAYEDALLOCATION;
|
||||
|
||||
midicc = 23;
|
||||
controllers[midicc] = controllers_default[midicc] = PORTAMENTO;
|
||||
mapping["PORTAMENTO"]=PORTAMENTO;
|
||||
|
||||
midicc = 16;
|
||||
controllers[midicc] = controllers_default[midicc] = UNISON;
|
||||
mapping["UNISON"]=UNISON;
|
||||
|
||||
midicc = 24;
|
||||
controllers[midicc] = controllers_default[midicc] = UDET;
|
||||
mapping["UDET"]=UDET;
|
||||
|
||||
midicc = 43;
|
||||
controllers[midicc] = controllers_default[midicc] = OSC2_DET;
|
||||
mapping["OSC2_DET"]=OSC2_DET;
|
||||
|
||||
midicc = 19;
|
||||
controllers[midicc] = controllers_default[midicc] = LFOFREQ;
|
||||
mapping["LFOFREQ"]=LFOFREQ;
|
||||
|
||||
midicc = 44;
|
||||
controllers[midicc] = controllers_default[midicc] = LFOSINWAVE;
|
||||
mapping["LFOSINWAVE"]=LFOSINWAVE;
|
||||
|
||||
midicc = 45;
|
||||
controllers[midicc] = controllers_default[midicc] = LFOSQUAREWAVE;
|
||||
mapping["LFOSQUAREWAVE"]=LFOSQUAREWAVE;
|
||||
|
||||
midicc = 46;
|
||||
controllers[midicc] = controllers_default[midicc] = LFOSHWAVE;
|
||||
mapping["LFOSHWAVE"]=LFOSHWAVE;
|
||||
|
||||
midicc = 22;
|
||||
controllers[midicc] = controllers_default[midicc] = LFO1AMT;
|
||||
mapping["LFO1AMT"]=LFO1AMT;
|
||||
|
||||
midicc = 25;
|
||||
controllers[midicc] = controllers_default[midicc] = LFO2AMT;
|
||||
mapping["LFO2AMT"]=LFO2AMT;
|
||||
|
||||
midicc = 47;
|
||||
controllers[midicc] = controllers_default[midicc] = LFOOSC1;
|
||||
mapping["LFOOSC1"]=LFOOSC1;
|
||||
|
||||
midicc = 48;
|
||||
controllers[midicc] = controllers_default[midicc] = LFOOSC2;
|
||||
mapping["LFOOSC2"]=LFOOSC2;
|
||||
|
||||
midicc = 49;
|
||||
controllers[midicc] = controllers_default[midicc] = LFOFILTER;
|
||||
mapping["LFOFILTER"]=LFOFILTER;
|
||||
|
||||
midicc = 50;
|
||||
controllers[midicc] = controllers_default[midicc] = LFOPW1;
|
||||
mapping["LFOPW1"]=LFOPW1;
|
||||
|
||||
midicc = 51;
|
||||
controllers[midicc] = controllers_default[midicc] = LFOPW2;
|
||||
mapping["LFOPW2"]=LFOPW2;
|
||||
|
||||
midicc = 52;
|
||||
controllers[midicc] = controllers_default[midicc] = OSC2HS;
|
||||
mapping["OSC2HS"]=OSC2HS;
|
||||
|
||||
midicc = 53;
|
||||
controllers[midicc] = controllers_default[midicc] = XMOD;
|
||||
mapping["XMOD"]=XMOD;
|
||||
|
||||
midicc = 54;
|
||||
controllers[midicc] = controllers_default[midicc] = OSC1P;
|
||||
mapping["OSC1P"]=OSC1P;
|
||||
|
||||
midicc = 55;
|
||||
controllers[midicc] = controllers_default[midicc] = OSC2P;
|
||||
mapping["OSC2P"]=OSC2P;
|
||||
|
||||
midicc = 56;
|
||||
controllers[midicc] = controllers_default[midicc] = OSCQuantize;
|
||||
mapping["OSCQuantize"]=OSCQuantize;
|
||||
|
||||
midicc = 57;
|
||||
controllers[midicc] = controllers_default[midicc] = OSC1Saw;
|
||||
mapping["OSC1Saw"]=OSC1Saw;
|
||||
|
||||
midicc = 58;
|
||||
controllers[midicc] = controllers_default[midicc] = OSC1Pul;
|
||||
mapping["OSC1Pul"]=OSC1Pul;
|
||||
|
||||
midicc = 59;
|
||||
controllers[midicc] = controllers_default[midicc] = OSC2Saw;
|
||||
mapping["OSC2Saw"]=OSC2Saw;
|
||||
|
||||
midicc = 60;
|
||||
controllers[midicc] = controllers_default[midicc] = OSC2Pul;
|
||||
mapping["OSC2Pul"]=OSC2Pul;
|
||||
|
||||
midicc = 61;
|
||||
controllers[midicc] = controllers_default[midicc] = PW;
|
||||
mapping["PW"]=PW;
|
||||
|
||||
midicc = 62;
|
||||
controllers[midicc] = controllers_default[midicc] = BRIGHTNESS;
|
||||
mapping["BRIGHTNESS"]=BRIGHTNESS;
|
||||
|
||||
midicc = 63;
|
||||
controllers[midicc] = controllers_default[midicc] = ENVPITCH;
|
||||
mapping["ENVPITCH"]=ENVPITCH;
|
||||
|
||||
midicc = 77;
|
||||
controllers[midicc] = controllers_default[midicc] = OSC1MIX;
|
||||
|
||||
mapping["OSC1MIX"]=OSC1MIX;
|
||||
|
||||
midicc = 78;
|
||||
controllers[midicc] = controllers_default[midicc] = OSC2MIX;
|
||||
mapping["OSC2MIX"]=OSC2MIX;
|
||||
|
||||
midicc = 102;
|
||||
controllers[midicc] = controllers_default[midicc] = NOISEMIX;
|
||||
mapping["NOISEMIX"]=NOISEMIX;
|
||||
|
||||
midicc = 103;
|
||||
controllers[midicc] = controllers_default[midicc] = FLT_KF;
|
||||
mapping["FLT_KF"]=FLT_KF;
|
||||
|
||||
midicc = 74;
|
||||
controllers[midicc] = controllers_default[midicc] = CUTOFF;
|
||||
mapping["CUTOFF"]=CUTOFF;
|
||||
|
||||
midicc = 42;
|
||||
controllers[midicc] = controllers_default[midicc] = RESONANCE;
|
||||
mapping["RESONANCE"]=RESONANCE;
|
||||
|
||||
midicc = 104;
|
||||
controllers[midicc] = controllers_default[midicc] = MULTIMODE;
|
||||
mapping["MULTIMODE"]=MULTIMODE;
|
||||
|
||||
midicc = 18;
|
||||
controllers[midicc] = controllers_default[midicc] = FILTER_WARM;
|
||||
mapping["FILTER_WARM"]=FILTER_WARM;
|
||||
|
||||
midicc = 105;
|
||||
controllers[midicc] = controllers_default[midicc] = BANDPASS;
|
||||
mapping["BANDPASS"]=BANDPASS;
|
||||
|
||||
midicc = 106;
|
||||
controllers[midicc] = controllers_default[midicc] = FOURPOLE;
|
||||
mapping["FOURPOLE"]=FOURPOLE;
|
||||
|
||||
midicc = 107;
|
||||
controllers[midicc] = controllers_default[midicc] = ENVELOPE_AMT;
|
||||
mapping["ENVELOPE_AMT"]=ENVELOPE_AMT;
|
||||
|
||||
midicc = 73;
|
||||
controllers[midicc] = controllers_default[midicc] = LATK;
|
||||
mapping["LATK"]=LATK;
|
||||
|
||||
midicc = 36;
|
||||
controllers[midicc] = controllers_default[midicc] = LDEC;
|
||||
mapping["LDEC"]=LDEC;
|
||||
|
||||
midicc = 37;
|
||||
controllers[midicc] = controllers_default[midicc] = LSUS;
|
||||
mapping["LSUS"]=LSUS;
|
||||
|
||||
midicc = 72;
|
||||
controllers[midicc] = controllers_default[midicc] = LREL;
|
||||
mapping["LREL"]=LREL;
|
||||
|
||||
midicc = 38;
|
||||
controllers[midicc] = controllers_default[midicc] = FATK;
|
||||
mapping["FATK"]=FATK;
|
||||
|
||||
midicc = 39;
|
||||
controllers[midicc] = controllers_default[midicc] = FDEC;
|
||||
mapping["FDEC"]=FDEC;
|
||||
|
||||
midicc = 40;
|
||||
controllers[midicc] = controllers_default[midicc] = FSUS;
|
||||
mapping["FSUS"]=FSUS;
|
||||
|
||||
midicc = 41;
|
||||
controllers[midicc] = controllers_default[midicc] = FREL;
|
||||
mapping["FREL"]=FREL;
|
||||
|
||||
midicc = 108;
|
||||
controllers[midicc] = controllers_default[midicc] = ENVDER;
|
||||
mapping["ENVDER"]=ENVDER;
|
||||
|
||||
midicc = 109;
|
||||
controllers[midicc] = controllers_default[midicc] = FILTERDER;
|
||||
mapping["FILTERDER"]=FILTERDER;
|
||||
|
||||
midicc = 110;
|
||||
controllers[midicc] = controllers_default[midicc] = PORTADER;
|
||||
mapping["PORTADER"]=PORTADER;
|
||||
|
||||
midicc = 81;
|
||||
controllers[midicc] = controllers_default[midicc] = PAN1;
|
||||
mapping["PAN1"]=PAN1;
|
||||
|
||||
midicc = 82;
|
||||
controllers[midicc] = controllers_default[midicc] = PAN2;
|
||||
mapping["PAN2"]=PAN2;
|
||||
|
||||
midicc = 83;
|
||||
controllers[midicc] = controllers_default[midicc] = PAN3;
|
||||
mapping["PAN3"]=PAN3;
|
||||
|
||||
midicc = 84;
|
||||
controllers[midicc] = controllers_default[midicc] = PAN4;
|
||||
mapping["PAN4"]=PAN4;
|
||||
|
||||
midicc = 85;
|
||||
controllers[midicc] = controllers_default[midicc] = PAN5;
|
||||
mapping["PAN5"]=PAN5;
|
||||
|
||||
midicc = 86;
|
||||
controllers[midicc] = controllers_default[midicc] = PAN6;
|
||||
mapping["PAN6"]=PAN6;
|
||||
|
||||
midicc = 87;
|
||||
controllers[midicc] = controllers_default[midicc] = PAN7;
|
||||
mapping["PAN7"]=PAN7;
|
||||
|
||||
midicc = 88;
|
||||
controllers[midicc] = controllers_default[midicc] = PAN8;
|
||||
mapping["PAN8"]=PAN8;
|
||||
|
||||
midicc = 111;
|
||||
controllers[midicc] = controllers_default[midicc] = ECONOMY_MODE;
|
||||
mapping["ECONOMY_MODE"]=ECONOMY_MODE;
|
||||
|
||||
//midicc = 112;
|
||||
//controllers[midicc] = controllers_default[midicc] = LFO_SYNC;
|
||||
|
||||
midicc = 113;
|
||||
controllers[midicc] = controllers_default[midicc] = PW_ENV;
|
||||
mapping["PW_ENV"]=PW_ENV;
|
||||
|
||||
midicc = 114;
|
||||
controllers[midicc] = controllers_default[midicc] = PW_ENV_BOTH;
|
||||
mapping["PW_ENV_BOTH"]=PW_ENV_BOTH;
|
||||
|
||||
midicc = 115;
|
||||
controllers[midicc] = controllers_default[midicc] = ENV_PITCH_BOTH;
|
||||
mapping["ENV_PITCH_BOTH"]=ENV_PITCH_BOTH;
|
||||
|
||||
midicc = 116;
|
||||
controllers[midicc] = controllers_default[midicc] = FENV_INVERT;
|
||||
mapping["FENV_INVERT"]=FENV_INVERT;
|
||||
|
||||
midicc = 117;
|
||||
controllers[midicc] = controllers_default[midicc] = PW_OSC2_OFS;
|
||||
mapping["PW_OSC2_OFS"]=PW_OSC2_OFS;
|
||||
|
||||
midicc = 118;
|
||||
controllers[midicc] = controllers_default[midicc] = LEVEL_DIF;
|
||||
mapping["LEVEL_DIF"]=LEVEL_DIF;
|
||||
|
||||
midicc = 119;
|
||||
controllers[midicc] = controllers_default[midicc] = SELF_OSC_PUSH;
|
||||
|
||||
mapping["SELF_OSC_PUSH"]=SELF_OSC_PUSH;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -290,19 +369,31 @@ public:
|
|||
void setXml( XmlElement &xml){
|
||||
for (int i = 0; i < 255; ++i)
|
||||
{
|
||||
xml.setAttribute("Val_" + String(i), controllers[i]);
|
||||
if (controllers[i]!= -1){
|
||||
xml.setAttribute("MIDI_" +String(i), getTag(controllers[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
String getTag(int paraId){
|
||||
for (std::map<String, int>::iterator it = this->mapping.begin(); it != this->mapping.end(); it ++){
|
||||
if (paraId == it->second){
|
||||
return it->first;
|
||||
}
|
||||
}
|
||||
return "undefine";
|
||||
}
|
||||
|
||||
int getParaId(String tagName){
|
||||
return mapping[tagName];
|
||||
}
|
||||
|
||||
void getXml(XmlElement &xml){
|
||||
for (int i = 0; i < 255; ++i)
|
||||
{
|
||||
int tmp = xml.getIntAttribute("Val_" + String(i), controllers_default[i]);
|
||||
if (tmp == 0){
|
||||
tmp = controllers_default[i];
|
||||
String tmp = xml.getStringAttribute("MIDI_" + String(i), "undefine");
|
||||
if (tmp != "undefine"){
|
||||
controllers[i] = getParaId(tmp);
|
||||
}
|
||||
|
||||
controllers[i] = tmp;
|
||||
}
|
||||
|
||||
// Backward keys
|
||||
|
@ -316,7 +407,6 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool loadFile(File& xml){
|
||||
reset();
|
||||
set_default();
|
||||
|
@ -331,11 +421,11 @@ public:
|
|||
|
||||
void updateCC(int idx_para, int midiCC) {
|
||||
for (int i =0; i < 255; i++) {
|
||||
if (controllers[i] == midiCC){
|
||||
controllers[i] = 0;
|
||||
if (controllers[i] == idx_para){
|
||||
controllers[i] = -1;
|
||||
}
|
||||
}
|
||||
controllers[idx_para] = midiCC;
|
||||
controllers[midiCC] = idx_para;
|
||||
}
|
||||
|
||||
void saveFile(File& xml){
|
||||
|
|
|
@ -931,6 +931,9 @@ void ObxdAudioProcessorEditor::filesDropped(const StringArray& files, int x, int
|
|||
processor.setCurrentProgram(i++);
|
||||
processor.loadPreset(file);
|
||||
}
|
||||
if (i >=processor.getNumPrograms()){
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
processor.sendChangeMessage();
|
||||
createMenu();
|
||||
|
|
|
@ -273,7 +273,7 @@ inline void ObxdAudioProcessor::processMidiPerSample (MidiBuffer::Iterator* iter
|
|||
if (programs.currentProgramPtr->values[MIDILEARN] > 0.5f){
|
||||
midiControlledParamSet = true;
|
||||
//bindings[lastMovedController] = lastUsedParameter;
|
||||
bindings.updateCC(lastMovedController, lastUsedParameter);
|
||||
bindings.updateCC(lastUsedParameter, lastMovedController);
|
||||
File midi_file = getDocumentFolder().getChildFile("Midi")
|
||||
.getChildFile("Custom.xml");
|
||||
bindings.saveFile(midi_file);
|
||||
|
@ -605,7 +605,7 @@ bool ObxdAudioProcessor::saveFXBFile(const File& fxbFile) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ObxdAudioProcessor::loadFromFXBFile(const File& fxbFile)
|
||||
bool ObxdAudioProcessor::loadFromFXBFile(const File& fxbFile, bool changeProgram)
|
||||
{
|
||||
MemoryBlock mb;
|
||||
if (! fxbFile.loadFileAsData(mb))
|
||||
|
@ -680,7 +680,8 @@ bool ObxdAudioProcessor::loadFromFXBFile(const File& fxbFile)
|
|||
return false;
|
||||
|
||||
setStateInformation(cset->chunk, fxbSwap (cset->chunkSize));
|
||||
setCurrentProgram(0); // Set to first preset position
|
||||
if (changeProgram)
|
||||
setCurrentProgram(0); // Set to first preset position
|
||||
}
|
||||
else if (compareMagic (set->fxMagic, "FPCh"))
|
||||
{
|
||||
|
|
|
@ -175,7 +175,7 @@ public:
|
|||
void newPreset(const String &name);
|
||||
void deletePreset();
|
||||
|
||||
bool loadFromFXBFile(const File& fxbFile);
|
||||
bool loadFromFXBFile(const File& fxbFile, bool changeProgram=true);
|
||||
bool saveFXBFile(const File& fxbFile);
|
||||
bool saveFXPFile(const File& fxpFile);
|
||||
bool saveBank(const File& fxbFile);
|
||||
|
|
Loading…
Reference in a new issue