14 : AudioProcessorEditor(&p), audioProcessor(p)
18 if (audioProcessor.
getTreeState()->getParameterAsValue(
"isProfessional").getValue())
20 margin_multiplier = GUI_EXPANDED_MARGIN_MULTIPLIER();
24 margin_multiplier = GUI_CONTRACTED_MARGIN_MULTIPLIER();
28 if (audioProcessor.
getTreeState()->getParameterAsValue(
"isProfessional").getValue())
39 GUI_EXPAND_ANIMATION_DURATION(),
41 { this->expandCallback(); },
43 { this->contractCallback(); },
45 { this->expansionStartedCallback(); },
47 { this->contractionStartedCallback(); },
49 { this->expansionEndedCallback(); },
51 { this->contractionEndedCallback(); }));
54 triggerListener.reset(
59 removeChildComponent(oscilloscopeComponent.get());
60 oscilloscopeComponent.reset(
62 addAndMakeVisible(oscilloscopeComponent.get());
68 removeChildComponent(oscilloscopeComponent.get());
69 oscilloscopeComponent.reset(
71 addAndMakeVisible(oscilloscopeComponent.get());
74 audioProcessor.
getTreeState()->addParameterListener(
"isTriggered", triggerListener.get());
77 addAndMakeVisible(oscilloscopeComponent.get());
78 addAndMakeVisible(controlSection);
84 std::vector<juce::String> attachmentNames;
85 attachmentNames.push_back(
"drawGrid");
86 attachmentNames.push_back(
"bufferLength");
87 attachmentNames.push_back(
"isProfessional");
88 attachmentNames.push_back(
"isTriggered");
89 attachmentNames.push_back(
"slopeButtonTriggered");
90 attachmentNames.push_back(
"triggerLevel");
91 attachmentNames.push_back(
"autoTriggered");
92 attachmentNames.push_back(
"refreshTime");
93 attachmentNames.push_back(
"muteOutput");
94 attachmentNames.push_back(
"decayTime");
98 setResizable(
true,
true);
99 setResizeLimits(256, 256, 1920, 1080);
115 auto area = getLocalBounds();
116 int height = area.getHeight();
117 int width = area.getWidth();
118 int margin = int(
float(area.getHeight()) * margin_multiplier);
121 oscilloscopeComponent->setTopLeftPosition(0, 0);
122 oscilloscopeComponent->setSize(area.getWidth(), margin);
123 controlSection.setTopLeftPosition(0, margin);
124 controlSection.setSize(width, height - margin);
130void OscilloscopeAudioProcessorEditor::expandCallback()
133 if (this->margin_multiplier > GUI_EXPANDED_MARGIN_MULTIPLIER())
136 float difference = GUI_CONTRACTED_MARGIN_MULTIPLIER() - GUI_EXPANDED_MARGIN_MULTIPLIER();
137 float totalFrames = float(EDITOR_INITIAL_RATE()) * GUI_EXPAND_ANIMATION_DURATION();
138 float increment = difference / totalFrames;
139 this->margin_multiplier = this->margin_multiplier - increment;
144 this->margin_multiplier = GUI_EXPANDED_MARGIN_MULTIPLIER();
151void OscilloscopeAudioProcessorEditor::expansionEndedCallback()
157void OscilloscopeAudioProcessorEditor::contractCallback()
160 if (this->margin_multiplier < GUI_CONTRACTED_MARGIN_MULTIPLIER())
163 float difference = GUI_CONTRACTED_MARGIN_MULTIPLIER() - GUI_EXPANDED_MARGIN_MULTIPLIER();
165 float totalFrames = float(EDITOR_INITIAL_RATE()) * GUI_EXPAND_ANIMATION_DURATION();
166 float increment = difference / totalFrames;
167 this->margin_multiplier = this->margin_multiplier + increment;
172 this->margin_multiplier = GUI_CONTRACTED_MARGIN_MULTIPLIER();
179void OscilloscopeAudioProcessorEditor::contractionEndedCallback()
190void OscilloscopeAudioProcessorEditor::expansionStartedCallback()
198void OscilloscopeAudioProcessorEditor::contractionStartedCallback()
void resetNumHorizontalSections()
void setMultipleAttachments(std::vector< juce::String > attachmentNames, juce::AudioProcessorValueTreeState &processorTreeState)
void paint(juce::Graphics &) override
~OscilloscopeAudioProcessorEditor() override
OscilloscopeAudioProcessorEditor(OscilloscopeAudioProcessor &)
Oscilloscope audio processor.
void storeEditorSize(int width, int height)
juce::AudioProcessorValueTreeState * getTreeState()