commit 2d0ce5d8987574ad1a84886cf375d03de5be5f08
parent 06fdd7a0d5cd632a373d0a8d932a2cdd3cef3927
Author: keith <kbloemer89@gmail.com>
Date: Mon, 31 May 2021 06:53:33 -0500
WIP updated audio parameter handling
Diffstat:
3 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp
@@ -86,12 +86,12 @@ NeuralPiAudioProcessorEditor::NeuralPiAudioProcessorEditor (NeuralPiAudioProcess
ampGainKnob.setTextBoxStyle(juce::Slider::TextEntryBoxPosition::TextBoxBelow, false, 50, 20);
ampGainKnob.setNumDecimalPlacesToDisplay(1);
ampGainKnob.addListener(this);
- ampGainKnob.setRange(-12.0, 12.0);
- ampGainKnob.setValue(1.0);
+ ampGainKnob.setRange(0.0, 1.0);
+ ampGainKnob.setValue(0.5);
ampGainKnob.setSliderStyle(juce::Slider::SliderStyle::RotaryVerticalDrag);
ampGainKnob.setTextBoxStyle(juce::Slider::TextEntryBoxPosition::NoTextBox, false, 50, 20);
ampGainKnob.setNumDecimalPlacesToDisplay(1);
- ampGainKnob.setDoubleClickReturnValue(true, 0.0);
+ ampGainKnob.setDoubleClickReturnValue(true, 0.5);
auto gainValue = getParameterValue(gainName);
Slider& gainSlider = getGainSlider();
@@ -126,12 +126,12 @@ NeuralPiAudioProcessorEditor::NeuralPiAudioProcessorEditor (NeuralPiAudioProcess
ampMasterKnob.setTextBoxStyle(juce::Slider::TextEntryBoxPosition::TextBoxBelow, false, 50, 20);
ampMasterKnob.setNumDecimalPlacesToDisplay(1);
ampMasterKnob.addListener(this);
- ampMasterKnob.setRange(-48.0, 0.0);
- ampMasterKnob.setValue(1.0);
+ ampMasterKnob.setRange(0.0, 1.0);
+ ampMasterKnob.setValue(0.5);
ampMasterKnob.setSliderStyle(juce::Slider::SliderStyle::RotaryVerticalDrag);
ampMasterKnob.setTextBoxStyle(juce::Slider::TextEntryBoxPosition::NoTextBox, false, 50, 20 );
ampMasterKnob.setNumDecimalPlacesToDisplay(1);
- ampMasterKnob.setDoubleClickReturnValue(true, -24.0);
+ ampMasterKnob.setDoubleClickReturnValue(true, 0.5);
auto masterValue = getParameterValue(masterName);
Slider& masterSlider = getMasterSlider();
@@ -325,8 +325,8 @@ void NeuralPiAudioProcessorEditor::sliderValueChanged(Slider* slider)
//else
if (slider == &modelKnob)
if (slider->getValue() >= 0 && slider->getValue() < processor.jsonFiles.size()) {
- processor.loadConfig(processor.jsonFiles[slider->getValue()]);
- processor.current_model_index = modelSelect.getSelectedItemIndex();
+ //processor.loadConfig(processor.jsonFiles[slider->getValue()]);
+ //processor.current_model_index = modelSelect.getSelectedItemIndex();
modelSelect.setSelectedItemIndex(slider->getValue(), juce::NotificationType::dontSendNotification);
}
diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp
@@ -37,8 +37,8 @@ NeuralPiAudioProcessor::NeuralPiAudioProcessor()
loadConfig(jsonFiles[current_model_index]);
}
// initialize parameters:
- addParameter(gainParam = new AudioParameterFloat(GAIN_ID, GAIN_NAME, NormalisableRange<float>(-12.0f, 12.0f, 0.01f), 0.0f));
- addParameter(masterParam = new AudioParameterFloat(MASTER_ID, MASTER_NAME, NormalisableRange<float>(-48.0f, 0.0f, 0.01f), 0.0f));
+ addParameter(gainParam = new AudioParameterFloat(GAIN_ID, GAIN_NAME, NormalisableRange<float>(-0.0f, 1.0f, 0.01f), 0.5f));
+ addParameter(masterParam = new AudioParameterFloat(MASTER_ID, MASTER_NAME, NormalisableRange<float>(0.0f, 1.0f, 0.01f), 0.5f));
addParameter(modelParam = new AudioParameterFloat(MODEL_ID, MODEL_NAME, NormalisableRange<float>(0, jsonFiles.size()-1, 1), 0));
//treeState.createAndAddParameter(std::make_unique<AudioParameterFloat>(MODEL_ID, MODEL_NAME, NormalisableRange<float>(0, jsonFiles.size() - 1, 1), 0));
@@ -163,17 +163,27 @@ void NeuralPiAudioProcessor::processBlock (AudioBuffer<float>& buffer, MidiBuffe
if (amp_state == 1) {
auto gain = static_cast<float> (gainParam->get());
auto master = static_cast<float> (masterParam->get());
+ auto model = static_cast<float> (modelParam->get());
+ int model_index = static_cast<int>(model);
//buffer.applyGain(ampDrive);
+ //buffer.applyGain(decibelToLinear(gain));
buffer.applyGain(gain);
// Apply LSTM model
if (model_loaded == 1) {
+ if (current_model_index != model_index) {
+ loadConfig(jsonFiles[model_index]);
+ current_model_index = model_index;
+ //current_model_index = modelSelect.getSelectedItemIndex();
+ //setSelectedItemIndex(slider->getValue(), juce::NotificationType::dontSendNotification);
+ }
LSTM.process(buffer.getReadPointer(0), buffer.getWritePointer(0), numSamples);
}
// Master Volume
//buffer.applyGain(ampMaster);
buffer.applyGain(master);
+ //buffer.applyGain(decibelToLinear(master));
}
for (int ch = 1; ch < buffer.getNumChannels(); ++ch)
diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h
@@ -74,9 +74,10 @@ public:
float convertLogScale(float in_value, float x_min, float x_max, float y_min, float y_max);
// Amp
+ /*
void set_ampDrive(float db_ampCleanDrive);
void set_ampMaster(float db_ampMaster);
-
+ */
float decibelToLinear(float dbValue);
void addDirectory(const File& file);