@@ -15,40 +15,47 @@ ReverbAudioProcessorEditor::ReverbAudioProcessorEditor (ReverbAudioProcessor& p)
1515{
1616 logo = juce::ImageCache::getFromMemory (BinaryData::logo686_png, BinaryData::logo686_pngSize);
1717
18- auto updateFunc = [this ](){
19- if (audioProcessor.apvts .getRawParameterValue (" Auto update" )->load ()==true ){
20- audioProcessor.setIrLoader ();
21- };
18+ auto startDrag = [this ](){
19+ audioProcessor.autoUpdate = false ;
20+ };
21+
22+ auto stopDrag = [this ](){
23+ audioProcessor.autoUpdate = autoButton.getToggleStateValue ().getValue ();
2224 };
2325
2426 // Room size controllers
2527 addController (roomXSlider, juce::Slider::SliderStyle::RotaryHorizontalVerticalDrag, juce::Colours::teal,juce::Colours::black);
2628 addAndConnectLabel (roomXSlider, roomXLabel);
2729 roomXSliderAttachment = std::make_unique<juce::AudioProcessorValueTreeState::SliderAttachment>(audioProcessor.apvts ," RoomX" ,roomXSlider);
28- roomXSlider.onDragEnd = updateFunc;
2930 roomXSlider.setLookAndFeel (&knobLookAndFeel);
31+ roomXSlider.onDragStart = startDrag;
32+ roomXSlider.onDragEnd = stopDrag;
3033
3134 addController (roomYSlider, juce::Slider::SliderStyle::RotaryHorizontalVerticalDrag, juce::Colours::teal,juce::Colours::black);
3235 addAndConnectLabel (roomYSlider, roomYLabel);
3336 roomYSliderAttachment = std::make_unique<juce::AudioProcessorValueTreeState::SliderAttachment>(audioProcessor.apvts ," RoomY" ,roomYSlider);
34- roomYSlider.onDragEnd = updateFunc;
3537 roomYSlider.setLookAndFeel (&knobLookAndFeel);
38+ roomYSlider.onDragStart = startDrag;
39+ roomYSlider.onDragEnd = stopDrag;
3640
3741 // Listener position controllers
3842 addController (listenerXSlider, juce::Slider::SliderStyle::LinearHorizontal, listenerColour, juce::Colours::black);
3943 listenerXSlider.setTextBoxStyle (juce::Slider::TextEntryBoxPosition::NoTextBox, true , 0 , 0 );
4044 listenerXSliderAttachment = std::make_unique<juce::AudioProcessorValueTreeState::SliderAttachment>(audioProcessor.apvts ," ListenerX" ,listenerXSlider);
41- listenerXSlider.onDragEnd = updateFunc;
45+ listenerXSlider.onDragStart = startDrag;
46+ listenerXSlider.onDragEnd = stopDrag;
4247
4348 addController (listenerYSlider, juce::Slider::SliderStyle::LinearVertical, listenerColour, juce::Colours::black);
4449 listenerYSlider.setTextBoxStyle (juce::Slider::TextEntryBoxPosition::NoTextBox, true , 0 , 0 );
4550 listenerYSliderAttachment = std::make_unique<juce::AudioProcessorValueTreeState::SliderAttachment>(audioProcessor.apvts ," ListenerY" ,listenerYSlider);
46- listenerYSlider.onDragEnd = updateFunc;
51+ listenerYSlider.onDragStart = startDrag;
52+ listenerYSlider.onDragEnd = stopDrag;
4753
4854 addController (listenerOSlider, juce::Slider::SliderStyle::RotaryHorizontalVerticalDrag, listenerColour, juce::Colours::black);
4955 listenerOSlider.setTextBoxStyle (juce::Slider::TextEntryBoxPosition::NoTextBox, true , 0 , 0 );
5056 listenerOSliderAttachment = std::make_unique<juce::AudioProcessorValueTreeState::SliderAttachment>(audioProcessor.apvts ," ListenerO" ,listenerOSlider);
51- listenerOSlider.onDragEnd = updateFunc;
57+ listenerOSlider.onDragStart = startDrag;
58+ listenerOSlider.onDragEnd = stopDrag;
5259 addAndConnectLabel (listenerOSlider, listenerOLabel);
5360 juce::Slider::RotaryParameters par;
5461 par.startAngleRadians = -juce::MathConstants<float >::pi;
@@ -61,42 +68,45 @@ ReverbAudioProcessorEditor::ReverbAudioProcessorEditor (ReverbAudioProcessor& p)
6168 addController (sourceXSlider, juce::Slider::SliderStyle::LinearHorizontal, sourceColour, juce::Colours::black);
6269 sourceXSlider.setTextBoxStyle (juce::Slider::TextEntryBoxPosition::NoTextBox, true , 0 , 0 );
6370 sourceXSliderAttachment = std::make_unique<juce::AudioProcessorValueTreeState::SliderAttachment>(audioProcessor.apvts ," SourceX" ,sourceXSlider);
64- sourceXSlider.onDragEnd = updateFunc;
71+ sourceXSlider.onDragStart = startDrag;
72+ sourceXSlider.onDragEnd = stopDrag;
6573
6674 addController (sourceYSlider, juce::Slider::SliderStyle::LinearVertical, sourceColour, juce::Colours::black);
6775 sourceYSlider.setTextBoxStyle (juce::Slider::TextEntryBoxPosition::NoTextBox, true , 0 , 0 );
6876 sourceYSliderAttachment = std::make_unique<juce::AudioProcessorValueTreeState::SliderAttachment>(audioProcessor.apvts ," SourceY" ,sourceYSlider);
69- sourceYSlider.onDragEnd = updateFunc;
77+ sourceXSlider.onDragStart = startDrag;
78+ sourceXSlider.onDragEnd = stopDrag;
7079
7180 // Damping sliders
7281 addController (dampingSlider, juce::Slider::SliderStyle::RotaryVerticalDrag, juce::Colours::green,juce::Colours::black);
7382 addAndConnectLabel (dampingSlider, dampingLabel);
7483 dampingSliderAttachment = std::make_unique<juce::AudioProcessorValueTreeState::SliderAttachment>(audioProcessor.apvts ," D" ,dampingSlider);
75- dampingSlider.onDragEnd = updateFunc;
7684 dampingSlider.setLookAndFeel (&knobLookAndFeel);
85+ dampingSlider.onDragStart = startDrag;
86+ dampingSlider.onDragEnd = stopDrag;
7787
7888 addController (hfDampingSlider, juce::Slider::SliderStyle::RotaryVerticalDrag, juce::Colours::green,juce::Colours::black);
7989 addAndConnectLabel (hfDampingSlider, hfDampingLabel);
8090 hfDampingSliderAttachment = std::make_unique<juce::AudioProcessorValueTreeState::SliderAttachment>(audioProcessor.apvts ," HFD" ,hfDampingSlider);
81- hfDampingSlider.onDragEnd = updateFunc;
8291 hfDampingSlider.setLookAndFeel (&knobLookAndFeel);
92+ hfDampingSlider.onDragStart = startDrag;
93+ hfDampingSlider.onDragEnd = stopDrag;
8394
8495 addController (widthSlider, juce::Slider::SliderStyle::RotaryVerticalDrag, juce::Colours::green,juce::Colours::black);
8596 addAndConnectLabel (widthSlider, widthLabel);
8697 widthSliderAttachment = std::make_unique<juce::AudioProcessorValueTreeState::SliderAttachment>(audioProcessor.apvts ," Stereo Width" ,widthSlider);
87- widthSlider.onDragEnd = updateFunc;
8898 widthSlider.setLookAndFeel (&knobLookAndFeel);
99+ widthSlider.onDragEnd = stopDrag;
100+ widthSlider.onDragStart = startDrag;
89101
90102 addController (directLevelSlider, juce::Slider::SliderStyle::RotaryVerticalDrag, juce::Colours::darkorange,juce::Colours::black);
91103 addAndConnectLabel (directLevelSlider, directLevelLabel);
92104 directLevelSliderAttachment = std::make_unique<juce::AudioProcessorValueTreeState::SliderAttachment>(audioProcessor.apvts ," Direct Level" ,directLevelSlider);
93- // directLevelSlider.onDragEnd = updateFunc;
94105 directLevelSlider.setLookAndFeel (&knobLookAndFeel);
95106
96107 addController (reflectionsLevelSlider, juce::Slider::SliderStyle::RotaryVerticalDrag, juce::Colours::darkorange,juce::Colours::black);
97108 addAndConnectLabel (reflectionsLevelSlider, reflectionsLevelLabel);
98109 reflectionsLevelSliderAttachment = std::make_unique<juce::AudioProcessorValueTreeState::SliderAttachment>(audioProcessor.apvts ," Reflections Level" ,reflectionsLevelSlider);
99- // reflectionsLevelSlider.onDragEnd = updateFunc;
100110 reflectionsLevelSlider.setLookAndFeel (&knobLookAndFeel);
101111
102112 // Reverb type combo box
@@ -107,7 +117,6 @@ ReverbAudioProcessorEditor::ReverbAudioProcessorEditor (ReverbAudioProcessor& p)
107117 typeLabel.attachToComponent (&typeComboBox,false );
108118 addAndMakeVisible (typeComboBox);
109119 addAndMakeVisible (typeLabel);
110- typeComboBox.onChange = updateFunc;
111120
112121 // XY Pad
113122 addAndMakeVisible (xyPad2);
@@ -118,18 +127,18 @@ ReverbAudioProcessorEditor::ReverbAudioProcessorEditor (ReverbAudioProcessor& p)
118127 xyPad2.registerSlider (&listenerOSlider, Gui::XyPad2h::Axis::O1 );
119128 xyPad2.thumb1 .setColour (listenerColour);
120129 xyPad2.thumb2 .setColour (sourceColour);
121- xyPad2.thumb1 .mouseUpCallback = updateFunc;
122- xyPad2.thumb2 .mouseUpCallback = updateFunc;
130+ xyPad2.thumb1 .mouseUpCallback = stopDrag;
131+ xyPad2.thumb2 .mouseUpCallback = stopDrag;
132+ xyPad2.thumb1 .mouseDownCallback = startDrag;
133+ xyPad2.thumb2 .mouseDownCallback = startDrag;
123134
124- addAndMakeVisible (calculateButton);
125- calculateButton.setButtonText (" Update" );
126- // We don't use updateFunc here because it has to update even if autoUpdate is false
127- calculateButton.onClick = [this ](){
128- audioProcessor.setIrLoader ();
129- };
135+ addAndMakeVisible (autoButton);
136+ autoButtonAttachment = std::make_unique<juce::AudioProcessorValueTreeState::ButtonAttachment>(audioProcessor.apvts ," Update" ,autoButton);
137+ addAndMakeVisible (autoLabel);
138+ autoLabel.attachToComponent (&autoButton,false );
130139
131140 addAndMakeVisible (autoButton);
132- autoButtonAttachment = std::make_unique<juce::AudioProcessorValueTreeState::ButtonAttachment>(audioProcessor.apvts ," Auto update " ,autoButton);
141+ autoButtonAttachment = std::make_unique<juce::AudioProcessorValueTreeState::ButtonAttachment>(audioProcessor.apvts ," Update " ,autoButton);
133142 addAndMakeVisible (autoLabel);
134143 autoLabel.attachToComponent (&autoButton,false );
135144
0 commit comments