MCPcopy Create free account
hub / github.com/jerryuhoo/Fire / LfoPanel

Method LfoPanel

Source/Panels/ControlPanel/LfoPanel.cpp:947–1096  ·  view source on GitHub ↗

============================================================================== LfoPanel Implementation ==============================================================================

Source from the content-addressed store, hash-verified

945// LfoPanel Implementation
946//==============================================================================
947LfoPanel::LfoPanel(FireAudioProcessor& p) : processor(p)
948{
949 lfoEditor.setDataToDisplay(processor.getLfoManager().getLfoData()[currentLfoIndex]);
950 addAndMakeVisible(lfoEditor);
951
952 // FIX: Set up the callback to send updated data back to the manager
953 lfoEditor.onDataChanged = [this](const LfoData& newData)
954 {
955 // Use the thread-safe setter to update the authoritative data
956 processor.getLfoManager().setLfoData(currentLfoIndex, newData);
957
958 // Notify the main editor that a change has occurred (e.g., to mark preset as dirty)
959 if (onDataChanged)
960 onDataChanged();
961 };
962
963 // Create UI Components
964 for (int i = 0; i < 4; ++i)
965 {
966 lfoSelectButtons[i] = std::make_unique<juce::TextButton>("LFO " + juce::String(i + 1));
967 addAndMakeVisible(lfoSelectButtons[i].get());
968 lfoSelectButtons[i]->setRadioGroupId(1);
969 styleLfoSelectButton(*lfoSelectButtons[i], activeLfoColour);
970 lfoSelectButtons[i]->addListener(this);
971 }
972 lfoSelectButtons[0]->setToggleState(true, juce::dontSendNotification);
973
974 // --- Setup Mode Buttons ---
975 addAndMakeVisible(editModeButton);
976 editModeButton.setRadioGroupId(1002);
977 styleButton(editModeButton, true);
978
979 addAndMakeVisible(brushModeButton);
980 brushModeButton.setRadioGroupId(1002);
981 styleButton(brushModeButton, true);
982
983 // --- Setup Brush Selector ---
984 addAndMakeVisible(brushSelector);
985 brushSelector.addItem("Saw Up", (int) LfoPresetShape::SawUp);
986 brushSelector.addItem("Saw Down", (int) LfoPresetShape::SawDown);
987 brushSelector.addItem("Sine Convex", (int) LfoPresetShape::SineConvex);
988 brushSelector.addItem("Sine Concave", (int) LfoPresetShape::SineConcave);
989 brushSelector.addItem("Square High", (int) LfoPresetShape::SquareHigh);
990 brushSelector.addItem("Square Low", (int) LfoPresetShape::SquareLow);
991 brushSelector.onChange = [this]
992 { lfoEditor.setCurrentBrush(static_cast<LfoPresetShape>(brushSelector.getSelectedId())); };
993
994 setEditMode(LfoEditMode::PointEdit); // Set initial state
995
996 addAndMakeVisible(assignButton);
997 assignButton.setButtonText("Assign");
998 styleButton(assignButton, true);
999
1000 addAndMakeVisible(matrixButton);
1001 matrixButton.setButtonText("Matrix"); // Set button text
1002 styleButton(matrixButton, false);
1003
1004 addAndMakeVisible(syncButton);

Callers

nothing calls this directly

Calls 7

getIDStringFunction · 0.85
setDataToDisplayMethod · 0.80
setLfoDataMethod · 0.80
getMethod · 0.80
addListenerMethod · 0.80
setCurrentBrushMethod · 0.80
setTextMethod · 0.80

Tested by

no test coverage detected