Vital
Loading...
Searching...
No Matches
header_section.h
Go to the documentation of this file.
1#pragma once
2
3#include "JuceHeader.h"
4#include "synth_section.h"
5#include "bank_exporter.h"
7
8class BankExporter;
9class LogoButton;
10class TabSelector;
11class Oscilloscope;
12class Spectrogram;
13class PresetBrowser;
14class VolumeSection;
15
22class LogoSection : public SynthSection {
23 public:
27 static constexpr float kLogoPaddingY = 2.0f;
28
33 class Listener {
34 public:
35 virtual ~Listener() { }
36
40 virtual void showAboutSection() = 0;
41 };
42
47
51 void resized() override;
52
57 void paintBackground(Graphics& g) override;
58
63 void buttonClicked(Button* clicked_button) override;
64
69 void addListener(Listener* listener) { listeners_.push_back(listener); }
70
71 private:
72 std::vector<Listener*> listeners_;
73 std::unique_ptr<LogoButton> logo_button_;
74};
75
91 public:
96 class Listener {
97 public:
98 virtual ~Listener() { }
99
103 virtual void showAboutSection() = 0;
104
109 virtual void deleteRequested(File preset) = 0;
110
115 virtual void tabSelected(int index) = 0;
116
121 virtual void clearTemporaryTab(int current_tab) = 0;
122
128 virtual void setPresetBrowserVisibility(bool visible, int current_tab) = 0;
129
135 virtual void setBankExporterVisibility(bool visible, int current_tab) = 0;
136
140 virtual void bankImported() = 0;
141 };
142
147
152 void paintBackground(Graphics& g) override;
153
157 void resized() override;
158
162 void reset() override;
163
168 void setAllValues(vital::control_map& controls) override;
169
174 void buttonClicked(Button* clicked_button) override;
175
180 void sliderValueChanged(Slider* slider) override;
181
186 void setPresetBrowserVisibility(bool visible) override;
187
192 void setBankExporterVisibility(bool visible) override;
193
198 void deleteRequested(File preset) override;
199
203 void bankImported() override;
204
209 void save(File preset) override;
210
215 void setTemporaryTab(String name);
216
220 void showAboutSection() override {
221 for (Listener* listener : listeners_)
222 listener->showAboutSection();
223 }
224
229 void setOscilloscopeMemory(const vital::poly_float* memory);
230
235 void setAudioMemory(const vital::StereoMemory* memory);
236
240 void notifyChange();
241
245 void notifyFresh();
246
251 void setSaveSection(SaveSection* save_section) {
252 synth_preset_selector_->setSaveSection(save_section);
253 save_section->addSaveListener(this);
254 }
255
260 void setBrowser(PresetBrowser* browser) { synth_preset_selector_->setBrowser(browser); }
261
266 void setBankExporter(BankExporter* exporter) { synth_preset_selector_->setBankExporter(exporter); }
267
272 void addListener(Listener* listener) { listeners_.push_back(listener); }
273
278 void setTabOffset(int offset) { tab_offset_ = offset; repaint(); }
279
280 private:
281 std::vector<Listener*> listeners_;
282
283 std::unique_ptr<LogoSection> logo_section_;
284 std::unique_ptr<TabSelector> tab_selector_;
285 int tab_offset_;
286 std::unique_ptr<PlainTextComponent> temporary_tab_;
287 std::unique_ptr<OpenGlShapeButton> exit_temporary_button_;
288
289 std::unique_ptr<SynthButton> view_spectrogram_;
290 std::unique_ptr<Oscilloscope> oscilloscope_;
291 std::unique_ptr<Spectrogram> spectrogram_;
292 std::unique_ptr<SynthPresetSelector> synth_preset_selector_;
293 std::unique_ptr<VolumeSection> volume_section_;
294
295 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(HeaderSection)
296};
297
Declares the ContentList and BankExporter classes for exporting banks of presets, wavetables,...
A UI component for exporting a selection of presets, wavetables, LFOs, and samples as a bank.
Definition bank_exporter.h:257
Interface for objects that need to be notified of events from the HeaderSection.
Definition header_section.h:96
virtual void deleteRequested(File preset)=0
Called when a delete request is made for a given preset file.
virtual ~Listener()
Definition header_section.h:98
virtual void tabSelected(int index)=0
Called when a tab is selected by the user.
virtual void bankImported()=0
Called after a bank of presets has been imported.
virtual void clearTemporaryTab(int current_tab)=0
Called when a temporary tab (e.g., preset browser) should be cleared and return to the previous tab.
virtual void setBankExporterVisibility(bool visible, int current_tab)=0
Called when the bank exporter visibility should change.
virtual void setPresetBrowserVisibility(bool visible, int current_tab)=0
Called when the preset browser visibility should change.
virtual void showAboutSection()=0
Called when the "About" section should be shown.
The topmost section of the synthesizer GUI, displaying the logo, tab selector, preset controls,...
Definition header_section.h:90
void notifyFresh()
Marks the interface as having no unsaved changes.
Definition header_section.cpp:341
void reset() override
Resets the header, typically after loading a preset or making other state changes.
Definition header_section.cpp:258
void bankImported() override
Called when a bank of presets has been imported.
Definition header_section.cpp:311
void addListener(Listener *listener)
Adds a Listener to receive header events.
Definition header_section.h:272
void setAudioMemory(const vital::StereoMemory *memory)
Sets the memory used by the spectrogram for visualization.
Definition header_section.cpp:333
void save(File preset) override
Called after saving a preset, allowing the header to update its state (e.g., mark as unmodified).
Definition header_section.cpp:316
void paintBackground(Graphics &g) override
Paints the background of the header, including tab areas, preset areas, and optional expiration count...
Definition header_section.cpp:188
void setSaveSection(SaveSection *save_section)
Assigns the SaveSection used by the header's preset selector.
Definition header_section.h:251
void setTabOffset(int offset)
Sets the horizontal offset for the tab selector, allowing flexible layout adjustments.
Definition header_section.h:278
void sliderValueChanged(Slider *slider) override
Handles slider value changes (e.g., when the tab selector moves to a different tab).
Definition header_section.cpp:286
void setPresetBrowserVisibility(bool visible) override
Called to show or hide the preset browser.
Definition header_section.cpp:296
HeaderSection()
Constructs the HeaderSection.
Definition header_section.cpp:138
void setOscilloscopeMemory(const vital::poly_float *memory)
Sets the memory used by the oscilloscope for visualization.
Definition header_section.cpp:329
void notifyChange()
Marks the interface as having unsaved changes.
Definition header_section.cpp:337
void showAboutSection() override
Called when the logo's listener requests the About section.
Definition header_section.h:220
void setAllValues(vital::control_map &controls) override
Sets parameter values for the header section.
Definition header_section.cpp:263
void resized() override
Resizes and rearranges child components within the header.
Definition header_section.cpp:215
void buttonClicked(Button *clicked_button) override
Handles button clicks within the header (e.g., toggling spectrogram, exiting temporary tabs).
Definition header_section.cpp:270
void deleteRequested(File preset) override
Handles the request to delete a given preset.
Definition header_section.cpp:306
void setBrowser(PresetBrowser *browser)
Assigns the preset browser to the preset selector.
Definition header_section.h:260
void setBankExporterVisibility(bool visible) override
Called to show or hide the bank exporter.
Definition header_section.cpp:301
void setBankExporter(BankExporter *exporter)
Assigns the bank exporter to the preset selector.
Definition header_section.h:266
void setTemporaryTab(String name)
Sets a temporary tab name, typically when overlaying the preset browser or bank exporter.
Definition header_section.cpp:321
Definition header_section.cpp:10
Interface for objects that need to respond to logo interactions.
Definition header_section.h:33
virtual void showAboutSection()=0
Called when the logo is clicked and the "About" section should be shown.
virtual ~Listener()
Definition header_section.h:35
A section at the top of the interface displaying the Vital logo.
Definition header_section.h:22
void addListener(Listener *listener)
Registers a listener for the logo interactions.
Definition header_section.h:69
static constexpr float kLogoPaddingY
The vertical padding applied to the logo within its section.
Definition header_section.h:27
void resized() override
Positions the logo button within the section.
Definition header_section.cpp:118
void paintBackground(Graphics &g) override
Paints the background of the logo section.
Definition header_section.cpp:126
LogoSection()
Constructs the LogoSection.
Definition header_section.cpp:106
void buttonClicked(Button *clicked_button) override
Handles button click events. In this case, clicking the logo button.
Definition header_section.cpp:133
Renders a time-domain waveform using OpenGL.
Definition oscilloscope.h:15
A UI for browsing, loading, and organizing presets.
Definition preset_browser.h:413
Interface for objects interested in the result of the save action.
Definition save_section.h:43
A UI overlay for saving presets or other files.
Definition save_section.h:21
void addSaveListener(Listener *listener)
Adds a listener to be notified when saving occurs.
Definition save_section.h:161
Renders a frequency-domain representation (spectrogram) using OpenGL.
Definition oscilloscope.h:64
Interface for components that need to respond to preset selector events.
Definition synth_preset_selector.h:29
Base class for all synthesizer sections, providing UI layout, painting, and interaction logic.
Definition synth_section.h:193
A slider-based UI component that displays selectable tabs.
Definition tab_selector.h:16
A UI section that provides a master volume control and visual peak meters.
Definition volume_section.h:17
A specialized MemoryTemplate for two-channel (stereo) audio.
Definition memory.h:216
std::map< std::string, Value * > control_map
Maps parameter names to Value pointers representing synth control parameters.
Definition synth_types.h:214
Represents a vector of floating-point values using SIMD instructions.
Definition poly_values.h:600
Declares the SynthPresetSelector class, which provides UI elements for selecting, browsing,...