MIDI learn and clear
This commit is contained in:
parent
bc7dd1912d
commit
39fb65be68
3 changed files with 26 additions and 15 deletions
|
@ -284,7 +284,7 @@ TooglableButton* ObxdAudioProcessorEditor::addButton (int x, int y, int w, int h
|
|||
button->setButtonText (name);
|
||||
button->setValue (filter.getPluginState().getParameter (filter.getEngineParameterId (parameter))->getValue(),
|
||||
dontSendNotification);
|
||||
|
||||
button->addListener(this);
|
||||
addAndMakeVisible (button);
|
||||
|
||||
return button;
|
||||
|
@ -429,6 +429,16 @@ void ObxdAudioProcessorEditor::buttonClicked (Button* b)
|
|||
|
||||
resultFromMenu (pos);
|
||||
}
|
||||
|
||||
|
||||
auto toggleButton = dynamic_cast<TooglableButton*> (b);
|
||||
if (toggleButton == midiUnlearnButton){
|
||||
if (midiUnlearnButton->toogled){
|
||||
processor.getMidiMap().reset();
|
||||
processor.getMidiMap().set_default();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
@ -229,18 +229,14 @@ inline void ObxdAudioProcessor::processMidiPerSample (MidiBuffer::Iterator* iter
|
|||
{
|
||||
lastMovedController = midiMsg->getControllerNumber();
|
||||
|
||||
if (programs.currentProgramPtr->values[MIDILEARN] > 0.5f)
|
||||
if (programs.currentProgramPtr->values[MIDILEARN] > 0.5f){
|
||||
midiControlledParamSet = true;
|
||||
bindings[lastMovedController] = lastUsedParameter;
|
||||
|
||||
if (programs.currentProgramPtr->values[UNLEARN] > 0.5f)
|
||||
{
|
||||
midiControlledParamSet = true;
|
||||
bindings[lastMovedController] = 0;
|
||||
setEngineParameterValue (UNLEARN, 0);
|
||||
lastMovedController = 0;
|
||||
lastUsedParameter = 0;
|
||||
midiControlledParamSet = false;
|
||||
}
|
||||
setEngineParameterValue (MIDILEARN, 0, true);
|
||||
lastMovedController = 0;
|
||||
lastUsedParameter = 0;
|
||||
midiControlledParamSet = false;
|
||||
}
|
||||
|
||||
if (bindings[lastMovedController] > 0)
|
||||
{
|
||||
|
@ -760,7 +756,7 @@ int ObxdAudioProcessor::getParameterIndexFromId (String paramId)
|
|||
return -1;
|
||||
}
|
||||
|
||||
void ObxdAudioProcessor::setEngineParameterValue (int index, float newValue)
|
||||
void ObxdAudioProcessor::setEngineParameterValue (int index, float newValue, bool notifyToHost)
|
||||
{
|
||||
if (! midiControlledParamSet || index == MIDILEARN || index == UNLEARN)
|
||||
{
|
||||
|
@ -768,8 +764,12 @@ void ObxdAudioProcessor::setEngineParameterValue (int index, float newValue)
|
|||
}
|
||||
|
||||
programs.currentProgramPtr->values[index] = newValue;
|
||||
apvtState.getParameter(getEngineParameterId(index))->setValue(newValue);
|
||||
|
||||
if (notifyToHost){
|
||||
apvtState.getParameter(getEngineParameterId(index))->setValueNotifyingHost(newValue);
|
||||
} else {
|
||||
apvtState.getParameter(getEngineParameterId(index))->setValue(newValue);
|
||||
}
|
||||
|
||||
switch (index)
|
||||
{
|
||||
|
|
|
@ -171,6 +171,7 @@ public:
|
|||
bool restoreProgramSettings(const fxProgram* const prog);
|
||||
File getCurrentBankFile() const;
|
||||
|
||||
MidiMap &getMidiMap(){ return bindings; }
|
||||
//==============================================================================
|
||||
const ObxdBank& getPrograms() const { return programs; }
|
||||
|
||||
|
@ -185,7 +186,7 @@ public:
|
|||
//==============================================================================
|
||||
static String getEngineParameterId (size_t);
|
||||
int getParameterIndexFromId (String);
|
||||
void setEngineParameterValue (int, float);
|
||||
void setEngineParameterValue (int, float, bool notifyToHost= false);
|
||||
void parameterChanged (const String&, float) override;
|
||||
AudioProcessorValueTreeState& getPluginState();
|
||||
|
||||
|
|
Loading…
Reference in a new issue