==============================================================================
| 18 | |
| 19 | //============================================================================== |
| 20 | NeuralPiAudioProcessorEditor::NeuralPiAudioProcessorEditor (NeuralPiAudioProcessor& p) |
| 21 | : AudioProcessorEditor (&p), processor (p) |
| 22 | { |
| 23 | // Make sure that before the constructor has finished, you've set the |
| 24 | // editor's size to whatever you need it to |
| 25 | |
| 26 | blueLookAndFeel.setColour(juce::Slider::thumbColourId, juce::Colours::aqua); |
| 27 | redLookAndFeel.setColour(juce::Slider::thumbColourId, juce::Colours::red); |
| 28 | |
| 29 | //addAndMakeVisible(modelKnob); |
| 30 | //ampGainKnob.setLookAndFeel(&SilverKnobLAF); |
| 31 | modelKnob.setTextBoxStyle(juce::Slider::TextEntryBoxPosition::TextBoxBelow, false, 50, 20); |
| 32 | modelKnob.setNumDecimalPlacesToDisplay(1); |
| 33 | modelKnob.addListener(this); |
| 34 | //modelKnob.setRange(0, processor.jsonFiles.size() - 1); |
| 35 | modelKnob.setRange(0.0, 1.0); |
| 36 | modelKnob.setValue(0.0); |
| 37 | modelKnob.setSliderStyle(juce::Slider::SliderStyle::RotaryVerticalDrag); |
| 38 | modelKnob.setTextBoxStyle(juce::Slider::TextEntryBoxPosition::NoTextBox, false, 50, 20); |
| 39 | modelKnob.setNumDecimalPlacesToDisplay(1); |
| 40 | modelKnob.setDoubleClickReturnValue(true, 0.0); |
| 41 | |
| 42 | auto modelValue = getParameterValue(modelName); |
| 43 | Slider& modelSlider = getModelSlider(); |
| 44 | modelSlider.setValue(modelValue, NotificationType::dontSendNotification); |
| 45 | |
| 46 | modelKnob.onValueChange = [this] |
| 47 | { |
| 48 | const float sliderValue = static_cast<float> (getModelSlider().getValue()); |
| 49 | const float modelValue = getParameterValue(modelName); |
| 50 | |
| 51 | if (!approximatelyEqual(modelValue, sliderValue)) |
| 52 | { |
| 53 | setParameterValue(modelName, sliderValue); |
| 54 | |
| 55 | // create and send an OSC message with an address and a float value: |
| 56 | float value = static_cast<float> (getModelSlider().getValue()); |
| 57 | |
| 58 | if (!oscSender.send(modelAddressPattern, value)) |
| 59 | { |
| 60 | updateOutConnectedLabel(false); |
| 61 | } |
| 62 | else |
| 63 | { |
| 64 | DBG("Sent value " + String(value) + " to AP " + modelAddressPattern); |
| 65 | } |
| 66 | } |
| 67 | }; |
| 68 | |
| 69 | |
| 70 | addAndMakeVisible(modelSelect); |
| 71 | modelSelect.setColour(juce::Label::textColourId, juce::Colours::black); |
| 72 | int c = 1; |
| 73 | for (const auto& jsonFile : processor.jsonFiles) { |
| 74 | modelSelect.addItem(jsonFile.getFileNameWithoutExtension(), c); |
| 75 | c += 1; |
| 76 | } |
| 77 | modelSelect.onChange = [this] {modelSelectChanged(); }; |
nothing calls this directly
no outgoing calls
no test coverage detected