2
0
Fork 0
This commit is contained in:
George Reales 2020-07-13 11:19:34 +02:00
parent 0295e85aed
commit 41e5018bbc
3 changed files with 284 additions and 17 deletions

View file

@ -25,7 +25,7 @@
#include "ObxdVoice.h"
enum ObxdParameters
{
UNDEFINED,
UNDEFINED = 0,
MIDILEARN,
VOLUME,
VOICE_COUNT,

View file

@ -2,7 +2,7 @@
==============================================================================
This file is part of Obxd synthesizer.
Copyright © 2013-2014 Filatov Vadim
Copyright © 2013-2014 Filatov Vadim
Contact author via email :
justdat_@_e1.ru
@ -23,13 +23,286 @@
*/
#pragma once
#include "SynthEngine.h"
#include "ParamsEnum.h"
#include "../JuceLibraryCode/JuceHeader.h"
class MidiMap
{
public:
int controllers[255];
int controllers_default[255];
bool loaded = false;
MidiMap()
{
for(int i = 0 ; i < 255;i++)
controllers[i] = 0;
reset();
set_default();
}
};
void reset(){
for(int i = 0 ; i < 255;i++){
controllers[i] = 0;
controllers_default[i] = 0;
}
}
void set_default(){
int midicc = 71;
controllers[midicc] = controllers_default[midicc] = VOLUME;
midicc = 72;
controllers[midicc] = controllers_default[midicc] = VOICE_COUNT;
midicc = 33;
controllers[midicc] = controllers_default[midicc] = TUNE;
midicc = 17;
controllers[midicc] = controllers_default[midicc] = OCTAVE;
midicc = 118;
controllers[midicc] = controllers_default[midicc] = BENDRANGE;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = BENDOSC2;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = LEGATOMODE;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = BENDLFORATE;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = VFLTENV;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = VAMPENV;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = ASPLAYEDALLOCATION;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = PORTAMENTO;
//midicc = 16;
//controllers[midicc] = controllers_default[midicc] = UNISON;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = UDET;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = OSC2_DET;
//midicc = 19;
//controllers[midicc] = controllers_default[midicc] = LFOFREQ;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = LFOSINWAVE;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = LFOSQUAREWAVE;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = LFOSHWAVE;
midicc = 22;
controllers[midicc] = controllers_default[midicc] = LFO1AMT;
midicc = 25;
controllers[midicc] = controllers_default[midicc] = LFO2AMT;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = LFOOSC1;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = LFOOSC2;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = LFOFILTER;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = LFOPW1;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = LFOPW2;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = OSC2HS;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = XMOD;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = OSC1P;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = OSC2P;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = OSCQuantize;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = OSC1Saw;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = OSC1Pul;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = OSC2Saw;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = OSC2Pul;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = PW;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = BRIGHTNESS;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = ENVPITCH;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = OSC1MIX;
//midicc = 8;
//controllers[midicc] = controllers_default[midicc] = OSC2MIX;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = NOISEMIX;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = FLT_KF;
midicc = 74;
controllers[midicc] = controllers_default[midicc] = CUTOFF;
midicc = 42;
controllers[midicc] = controllers_default[midicc] = RESONANCE;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = MULTIMODE;
midicc = 47;
controllers[midicc] = controllers_default[midicc] = FILTER_WARM;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = BANDPASS;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = FOURPOLE;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = ENVELOPE_AMT;
midicc = 73;
controllers[midicc] = controllers_default[midicc] = LATK;
midicc = 36;
controllers[midicc] = controllers_default[midicc] = LDEC;
midicc = 37;
controllers[midicc] = controllers_default[midicc] = LSUS;
midicc = 72;
controllers[midicc] = controllers_default[midicc] = LREL;
midicc = 38;
controllers[midicc] = controllers_default[midicc] = FATK;
midicc = 39;
controllers[midicc] = controllers_default[midicc] = FDEC;
midicc = 40;
controllers[midicc] = controllers_default[midicc] = FSUS;
midicc = 41;
controllers[midicc] = controllers_default[midicc] = FREL;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = ENVDER;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = FILTERDER;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = PORTADER;
//midicc = 81;
//controllers[midicc] = controllers_default[midicc] = PAN1;
//midicc = 82;
//controllers[midicc] = controllers_default[midicc] = PAN2;
midicc = 83;
controllers[midicc] = controllers_default[midicc] = PAN3;
midicc = 84;
controllers[midicc] = controllers_default[midicc] = PAN4;
midicc = 85;
controllers[midicc] = controllers_default[midicc] = PAN5;
midicc = 86;
controllers[midicc] = controllers_default[midicc] = PAN6;
midicc = 87;
controllers[midicc] = controllers_default[midicc] = PAN7;
midicc = 88;
controllers[midicc] = controllers_default[midicc] = PAN8;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = ECONOMY_MODE;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = LFO_SYNC;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = PW_ENV;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = PW_ENV_BOTH;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = ENV_PITCH_BOTH;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = FENV_INVERT;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = PW_OSC2_OFS;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = LEVEL_DIF;
//midicc = 0;
//controllers[midicc] = controllers_default[midicc] = SELF_OSC_PUSH;
}
int& operator[](int index)
{
if (index >= 255) {
exit(0);
}
return controllers[index];
}
void setXml( XmlElement &xml){
for (int i = 0; i < 255; ++i)
{
xml.setAttribute("Val_" + String(i), controllers[i]);
}
}
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];
}
controllers[i] = tmp;
}
}
};

View file

@ -230,22 +230,22 @@ inline void ObxdAudioProcessor::processMidiPerSample (MidiBuffer::Iterator* iter
lastMovedController = midiMsg->getControllerNumber();
if (programs.currentProgramPtr->values[MIDILEARN] > 0.5f)
bindings.controllers[lastMovedController] = lastUsedParameter;
bindings[lastMovedController] = lastUsedParameter;
if (programs.currentProgramPtr->values[UNLEARN] > 0.5f)
{
midiControlledParamSet = true;
bindings.controllers[lastMovedController] = 0;
bindings[lastMovedController] = 0;
setEngineParameterValue (UNLEARN, 0);
lastMovedController = 0;
lastUsedParameter = 0;
midiControlledParamSet = false;
}
if (bindings.controllers[lastMovedController] > 0)
if (bindings[lastMovedController] > 0)
{
midiControlledParamSet = true;
setEngineParameterValue (bindings.controllers[lastMovedController],
setEngineParameterValue (bindings[lastMovedController],
midiMsg->getControllerValue() / 127.0f);
setEngineParameterValue (MIDILEARN, 0);
@ -355,10 +355,7 @@ void ObxdAudioProcessor::getStateInformation(MemoryBlock& destData)
xmlState.addChildElement(xprogs);
for (int i = 0; i < 255; ++i)
{
xmlState.setAttribute("Val_" + String(i), bindings.controllers[i]);
}
bindings.setXml(xmlState);
copyXmlToBinary(xmlState, destData);
}
@ -415,10 +412,7 @@ void ObxdAudioProcessor::setStateInformation(const void* data, int sizeInBytes)
}
}
for (int i = 0; i < 255; ++i)
{
bindings.controllers[i] = xmlState->getIntAttribute("Val_" + String(i), 0);
}
bindings.getXml(*xmlState);
#if ! DEMOVERSION
setCurrentProgram(xmlState->getIntAttribute(S("currentProgram"), 0));