Enhanced MIDI CC
This commit is contained in:
parent
839f492784
commit
aa250fc799
2 changed files with 38 additions and 5 deletions
|
@ -89,6 +89,7 @@ ObxdAudioProcessor::ObxdAudioProcessor()
|
||||||
}
|
}
|
||||||
|
|
||||||
apvtState.state = ValueTree (JucePlugin_Name);
|
apvtState.state = ValueTree (JucePlugin_Name);
|
||||||
|
initMidi();
|
||||||
}
|
}
|
||||||
|
|
||||||
ObxdAudioProcessor::~ObxdAudioProcessor()
|
ObxdAudioProcessor::~ObxdAudioProcessor()
|
||||||
|
@ -271,11 +272,19 @@ inline void ObxdAudioProcessor::processMidiPerSample (MidiBuffer::Iterator* iter
|
||||||
lastMovedController = midiMsg->getControllerNumber();
|
lastMovedController = midiMsg->getControllerNumber();
|
||||||
if (programs.currentProgramPtr->values[MIDILEARN] > 0.5f){
|
if (programs.currentProgramPtr->values[MIDILEARN] > 0.5f){
|
||||||
midiControlledParamSet = true;
|
midiControlledParamSet = true;
|
||||||
bindings[lastMovedController] = lastUsedParameter;
|
//bindings[lastMovedController] = lastUsedParameter;
|
||||||
|
bindings.updateCC(lastMovedController, lastUsedParameter);
|
||||||
|
File midi_file = getDocumentFolder().getChildFile("Midi")
|
||||||
|
.getChildFile("Custom.xml");
|
||||||
|
bindings.saveFile(midi_file);
|
||||||
|
currentMidiPath = midi_file.getFullPathName();
|
||||||
|
|
||||||
setEngineParameterValue (MIDILEARN, 0, true);
|
setEngineParameterValue (MIDILEARN, 0, true);
|
||||||
lastMovedController = 0;
|
lastMovedController = 0;
|
||||||
lastUsedParameter = 0;
|
lastUsedParameter = 0;
|
||||||
midiControlledParamSet = false;
|
midiControlledParamSet = false;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bindings[lastMovedController] > 0)
|
if (bindings[lastMovedController] > 0)
|
||||||
|
@ -373,7 +382,7 @@ void ObxdAudioProcessor::getStateInformation(MemoryBlock& destData)
|
||||||
|
|
||||||
xmlState.addChildElement(xprogs);
|
xmlState.addChildElement(xprogs);
|
||||||
|
|
||||||
bindings.setXml(xmlState);
|
//bindings.setXml(xmlState);
|
||||||
|
|
||||||
copyXmlToBinary(xmlState, destData);
|
copyXmlToBinary(xmlState, destData);
|
||||||
}
|
}
|
||||||
|
@ -430,7 +439,7 @@ void ObxdAudioProcessor::setStateInformation(const void* data, int sizeInBytes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bindings.getXml(*xmlState);
|
//bindings.getXml(*xmlState);
|
||||||
#if ! DEMOVERSION
|
#if ! DEMOVERSION
|
||||||
setCurrentProgram(xmlState->getIntAttribute(S("currentProgram"), 0));
|
setCurrentProgram(xmlState->getIntAttribute(S("currentProgram"), 0));
|
||||||
|
|
||||||
|
@ -1184,3 +1193,27 @@ AudioProcessor* JUCE_CALLTYPE createPluginFilter()
|
||||||
{
|
{
|
||||||
return new ObxdAudioProcessor();
|
return new ObxdAudioProcessor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ObxdAudioProcessor::initMidi(){
|
||||||
|
//Documents > Obxd > MIDI > Default.xml
|
||||||
|
File default_file = getDocumentFolder().getChildFile("Midi")
|
||||||
|
.getChildFile("Default.xml");
|
||||||
|
if (!default_file.exists()){
|
||||||
|
bindings.saveFile(default_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
File midi_custom_file = getDocumentFolder().getChildFile("Midi")
|
||||||
|
.getChildFile("Custom.xml");
|
||||||
|
|
||||||
|
if (midi_custom_file.exists()) {
|
||||||
|
if (bindings.loadFile(midi_custom_file)){
|
||||||
|
currentMidiPath = midi_custom_file.getFullPathName();
|
||||||
|
} else {
|
||||||
|
if (bindings.loadFile(default_file)){
|
||||||
|
currentMidiPath = default_file.getFullPathName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -138,7 +138,7 @@ public:
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
void initAllParams();
|
void initAllParams();
|
||||||
|
void initMidi();
|
||||||
const String getInputChannelName (int channelIndex) const override; // WATCH OUT!
|
const String getInputChannelName (int channelIndex) const override; // WATCH OUT!
|
||||||
const String getOutputChannelName (int channelIndex) const override; // WATCH OUT!
|
const String getOutputChannelName (int channelIndex) const override; // WATCH OUT!
|
||||||
bool isInputChannelStereoPair (int index) const override; // WATCH OUT!
|
bool isInputChannelStereoPair (int index) const override; // WATCH OUT!
|
||||||
|
@ -234,7 +234,7 @@ public:
|
||||||
File currentBankFile;
|
File currentBankFile;
|
||||||
void saveBank();
|
void saveBank();
|
||||||
|
|
||||||
|
String currentMidiPath;
|
||||||
String currentPreset;
|
String currentPreset;
|
||||||
File currentPresetFile;
|
File currentPresetFile;
|
||||||
void savePreset();
|
void savePreset();
|
||||||
|
|
Loading…
Reference in a new issue