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

Method FilterControl

Source/Panels/SpectrogramPanel/FilterControl.cpp:15–61  ·  view source on GitHub ↗

==============================================================================

Source from the content-addressed store, hash-verified

13
14//==============================================================================
15FilterControl::FilterControl(FireAudioProcessor& p, GlobalPanel& panel) : processor(p), globalPanel(panel)
16{
17 const auto& params = processor.getParameters();
18 for (auto param : params)
19 {
20 param->addListener(this);
21 }
22
23 // Register as a listener to the processor for preset changes
24 processor.addChangeListener(this);
25
26 updateChain();
27 addAndMakeVisible(draggableLowButton);
28 addAndMakeVisible(draggablePeakButton);
29 addAndMakeVisible(draggableHighButton);
30
31 // The timer is always running, but its callback is now intelligent
32 startTimerHz(60);
33
34 // Initial check for modulation status on startup
35 checkAnimationStatus();
36
37 // Add these lines to connect mouse wheel events to Q parameters
38 auto setupQControl = [this](DraggableButton& button, const juce::String& paramID)
39 {
40 button.onQValueChanged = [this, paramID](float delta)
41 {
42 if (auto* param = processor.treeState.getParameter(paramID))
43 {
44 // Increase sensitivity for finer control
45 float sensitivity = 0.5f;
46 float currentValue = param->getValue();
47 float newValue = currentValue + delta * sensitivity;
48
49 // Clamp the value between 0.0 and 1.0
50 newValue = juce::jlimit(0.0f, 1.0f, newValue);
51
52 param->setValueNotifyingHost(newValue);
53 }
54 };
55 };
56
57 // Assuming you have these parameter IDs defined in Parameters.h
58 setupQControl(draggableLowButton, LOWCUT_Q_ID);
59 setupQControl(draggablePeakButton, PEAK_Q_ID);
60 setupQControl(draggableHighButton, HIGHCUT_Q_ID);
61}
62
63FilterControl::~FilterControl()
64{

Callers

nothing calls this directly

Calls 1

addListenerMethod · 0.80

Tested by

no test coverage detected