==============================================================================
| 15 | |
| 16 | //============================================================================== |
| 17 | FireAudioProcessorEditor::FireAudioProcessorEditor(FireAudioProcessor& p) |
| 18 | : AudioProcessorEditor(&p), |
| 19 | processor(p), |
| 20 | stateComponent { p.stateAB, p.statePresets, p.treeState }, |
| 21 | // Initialize bandPanel and globalPanel with the popup callbacks |
| 22 | bandPanel(p, {}, {}, {}, {}, {}), |
| 23 | globalPanel(processor, {}, {}, {}, {}, {}), |
| 24 | lfoPanel(p) |
| 25 | { |
| 26 | addAndMakeVisible(valuePopup); |
| 27 | valuePopup.setAlwaysOnTop(true); |
| 28 | valuePopup.setVisible(false); |
| 29 | |
| 30 | addAndMakeVisible(valueEntryPopup); |
| 31 | valueEntryPopup.setAlwaysOnTop(true); |
| 32 | valueEntryPopup.setVisible(false); |
| 33 | |
| 34 | valueEntryPopup.onOk = [this](double value) |
| 35 | { |
| 36 | if (sliderForValueEntry != nullptr) |
| 37 | { |
| 38 | processor.setModulationValue(sliderForValueEntry->getParamID(), (float) value); |
| 39 | } |
| 40 | |
| 41 | valueEntryPopup.setVisible(false); |
| 42 | sliderForValueEntry = nullptr; |
| 43 | }; |
| 44 | |
| 45 | valueEntryPopup.onCancel = [this]() |
| 46 | { |
| 47 | valueEntryPopup.setVisible(false); |
| 48 | sliderForValueEntry = nullptr; |
| 49 | }; |
| 50 | |
| 51 | processor.addChangeListener(this); |
| 52 | // timer |
| 53 | juce::Timer::startTimerHz(60.0f); |
| 54 | |
| 55 | lfoPanel.onAssignButtonClicked = [this](int lfoIndex) |
| 56 | { |
| 57 | if (isLfoAssignMode) |
| 58 | { |
| 59 | // If already in assignment mode, exit directly. |
| 60 | // (The cleanup logic has been moved to a separate function for reusability). |
| 61 | exitAssignMode(); |
| 62 | } |
| 63 | else |
| 64 | { |
| 65 | // --- Enter assignment mode --- |
| 66 | isLfoAssignMode = true; |
| 67 | lfoSourceForAssignment = lfoIndex; |
| 68 | lfoPanel.assignButton.setToggleState(true, juce::dontSendNotification); |
| 69 | |
| 70 | // Define the callback function to be executed when a slider is clicked. |
| 71 | auto sliderClickCallback = [this](const juce::String& parameterID) |
| 72 | { |
| 73 | // This callback now does only one thing: tell the processor to assign the LFO. |
| 74 | // It no longer handles any UI state changes. |
nothing calls this directly
no test coverage detected