commit 307ee7fd1b16f65ee6ab380bf572c000f811076f
parent 26f806f785f4214feaae577ac15e8aff2362801a
Author: keith <kbloemer89@gmail.com>
Date: Tue, 10 Aug 2021 09:11:55 -0500
Removed toggles, updated EQ levels, added file load error handling
Diffstat:
2 files changed, 37 insertions(+), 28 deletions(-)
diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp
@@ -138,17 +138,16 @@ NeuralPiAudioProcessorEditor::NeuralPiAudioProcessorEditor (NeuralPiAudioProcess
loadIR.addListener(this);
// Toggle IR
- addAndMakeVisible(irButton);
+ //addAndMakeVisible(irButton); // Toggle is for testing purposes
irButton.setToggleState(true, juce::NotificationType::dontSendNotification);
irButton.onClick = [this] { updateToggleState(&irButton, "IR"); };
// Toggle LSTM
- addAndMakeVisible(lstmButton);
+ //addAndMakeVisible(lstmButton); // Toggle is for testing purposes
lstmButton.setToggleState(true, juce::NotificationType::dontSendNotification);
lstmButton.onClick = [this] { updateToggleState(&lstmButton, "LSTM"); };
- //gainSliderAttach = std::make_unique<AudioProcessorValueTreeState::SliderAttachment>(processor.treeState, GAIN_ID, ampGainKnob);
addAndMakeVisible(ampGainKnob);
//ampGainKnob.setLookAndFeel(&SilverKnobLAF);
ampGainKnob.setTextBoxStyle(juce::Slider::TextEntryBoxPosition::TextBoxBelow, false, 50, 20);
@@ -457,7 +456,7 @@ NeuralPiAudioProcessorEditor::NeuralPiAudioProcessorEditor (NeuralPiAudioProcess
connectSender();
// Size of plugin GUI
- setSize(276, 455);
+ setSize(260, 455);
}
NeuralPiAudioProcessorEditor::~NeuralPiAudioProcessorEditor()
@@ -492,19 +491,19 @@ void NeuralPiAudioProcessorEditor::resized()
lstmButton.setBounds(248, 10, 257, 25);
// Amp Widgets
- ampGainKnob.setBounds(15, 120, 75, 95);
- ampMasterKnob.setBounds(100, 120, 75, 95);
- ampBassKnob.setBounds(15, 250, 75, 95);
- ampMidKnob.setBounds(100, 250, 75, 95);
- ampTrebleKnob.setBounds(185, 250, 75, 95);
- ampPresenceKnob.setBounds(185, 120, 75, 95);
-
- GainLabel.setBounds(11, 108, 80, 10);
- LevelLabel.setBounds(98, 108, 80, 10);
- BassLabel.setBounds(11, 238, 80, 10);
- MidLabel.setBounds(97, 238, 80, 10);
- TrebleLabel.setBounds(183, 238, 80, 10);
- PresenceLabel.setBounds(183, 108, 80, 10);
+ ampGainKnob.setBounds(10, 120, 75, 95);
+ ampMasterKnob.setBounds(95, 120, 75, 95);
+ ampBassKnob.setBounds(10, 250, 75, 95);
+ ampMidKnob.setBounds(95, 250, 75, 95);
+ ampTrebleKnob.setBounds(180, 250, 75, 95);
+ ampPresenceKnob.setBounds(180, 120, 75, 95);
+
+ GainLabel.setBounds(6, 108, 80, 10);
+ LevelLabel.setBounds(93, 108, 80, 10);
+ BassLabel.setBounds(6, 238, 80, 10);
+ MidLabel.setBounds(91, 238, 80, 10);
+ TrebleLabel.setBounds(178, 238, 80, 10);
+ PresenceLabel.setBounds(178, 108, 80, 10);
addAndMakeVisible(ampNameLabel);
ampNameField.setEditable(true, true, true);
diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp
@@ -181,11 +181,11 @@ 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());
- // Note: Default 0.0 -> 1.0 param range is converted to +-8.0 here
- auto bass = (static_cast<float> (bassParam->get() - 0.5) * 16.0);
- auto mid = (static_cast<float> (midParam->get() - 0.5) * 16.0);
- auto treble = (static_cast<float> (trebleParam->get() - 0.5) * 16.0);
- auto presence = (static_cast<float> (presenceParam->get() - 0.5) * 16.0);
+ // Note: Default 0.0 -> 1.0 param range is converted to +-12.0 here
+ auto bass = (static_cast<float> (bassParam->get() - 0.5) * 24.0);
+ auto mid = (static_cast<float> (midParam->get() - 0.5) * 24.0);
+ auto treble = (static_cast<float> (trebleParam->get() - 0.5) * 24.0);
+ auto presence = (static_cast<float> (presenceParam->get() - 0.5) * 24.0);
auto model = static_cast<float> (modelParam->get());
model_index = getModelIndex(model);
@@ -299,12 +299,17 @@ int NeuralPiAudioProcessor::getIrIndex(float ir_param)
void NeuralPiAudioProcessor::loadConfig(File configFile)
{
this->suspendProcessing(true);
- model_loaded = 1;
String path = configFile.getFullPathName();
char_filename = path.toUTF8();
- // TODO Add check here for invalid files
- LSTM.load_json(char_filename);
+ try {
+ LSTM.load_json(char_filename);
+ model_loaded = 1;
+ }
+ catch (const std::exception& e) {
+ DBG("Unable to load IR file: " + configFile.getFullPathName());
+ std::cout << e.what();
+ }
this->suspendProcessing(false);
}
@@ -312,10 +317,15 @@ void NeuralPiAudioProcessor::loadConfig(File configFile)
void NeuralPiAudioProcessor::loadIR(File irFile)
{
this->suspendProcessing(true);
- ir_loaded = 1;
- // TODO Add check here for invalid files
- cabSimIR.load(irFile);
+ try {
+ cabSimIR.load(irFile);
+ ir_loaded = 1;
+ }
+ catch (const std::exception& e) {
+ DBG("Unable to load IR file: " + irFile.getFullPathName());
+ std::cout << e.what();
+ }
this->suspendProcessing(false);
}