Vital
Loading...
Searching...
No Matches
full_interface.h
Go to the documentation of this file.
1#pragma once
2
3#include "JuceHeader.h"
4
5#include "authentication.h"
7#include "download_section.h"
8#include "header_section.h"
9#include "effects_interface.h"
10#include "memory.h"
11#include "modulation_matrix.h"
12#include "open_gl_background.h"
13#include "shaders.h"
14#include "synth_section.h"
16#include "wavetable_creator.h"
17
18class AboutSection;
19class BankExporter;
20class BendSection;
21class DeleteSection;
22class ExpiredSection;
23class ExtraModSection;
24class HeaderSection;
30class PresetBrowser;
31class SaveSection;
33struct SynthGuiData;
34class SynthSlider;
36class VoiceSection;
37
61 public OpenGLRenderer, DragAndDropContainer {
62 public:
66 static constexpr double kMinOpenGlVersion = 1.4;
67
72 FullInterface(SynthGuiData* synth_gui_data);
73
80
84 virtual ~FullInterface();
85
90 void setOscilloscopeMemory(const vital::poly_float* memory);
91
96 void setAudioMemory(const vital::StereoMemory* memory);
97
103 void createModulationSliders(const vital::output_map& mono_modulations,
104 const vital::output_map& poly_modulations);
105
110 virtual void paintBackground(Graphics& g) override;
111
116 void copySkinValues(const Skin& skin);
117
122 void reloadSkin(const Skin& skin);
123
129
134
140
146 void redoBackground();
147
152 void checkShouldReposition(bool resize = true);
153
159 void parentHierarchyChanged() override {
160 SynthSection::parentHierarchyChanged();
162 }
163
167 virtual void resized() override;
168
173 void animate(bool animate) override;
174
178 void reset() override;
179
184 void setAllValues(vital::control_map& controls) override;
185
191 void dataDirectoryChanged() override;
192
196 void noDownloadNeeded() override;
197
201 void needsUpdate() override;
202
206 void loggedIn() override;
207
211 void setWavetableNames();
212
216 void startDownload();
217
221 void newOpenGLContextCreated() override;
222
226 void renderOpenGL() override;
227
231 void openGLContextClosing() override;
232
236 void showAboutSection() override;
237
242 void deleteRequested(File preset) override;
243
248 void tabSelected(int index) override;
249
254 void clearTemporaryTab(int current_tab) override;
255
261 void setPresetBrowserVisibility(bool visible, int current_tab) override;
262
268 void setBankExporterVisibility(bool visible, int current_tab) override;
269
273 void bankImported() override;
274
278 void effectsMoved() override;
279
283 void modulationsScrolled() override;
284
288 void setFocus();
289
293 void notifyChange();
294
298 void notifyFresh();
299
304 void externalPresetLoaded(const File& preset);
305
310 void showFullScreenSection(SynthSection* full_screen);
311
316 void showWavetableEditSection(int index);
317
323 std::string getLastBrowsedWavetable(int index);
324
330 std::string getWavetableName(int index);
331
336 std::string getSignedInName();
337
341 void signOut();
342
346 void signIn();
347
352
358 void loadWavetableFile(int index, const File& wavetable);
359
365 void loadWavetable(int index, json& wavetable_data);
366
371 void loadDefaultWavetable(int index);
372
377 void resynthesizeToWavetable(int index);
378
383 void saveWavetable(int index);
384
389 void saveLfo(const json& data);
390
396 json getWavetableJson(int index);
397
406 bool loadAudioAsWavetable(int index, const String& name, InputStream* audio_stream,
408
418 void popupBrowser(SynthSection* owner, Rectangle<int> bounds, std::vector<File> directories,
419 String extensions, std::string passthrough_name, std::string additional_folders_name);
420
425 void popupBrowserUpdate(SynthSection* owner);
426
435 void popupSelector(Component* source, Point<int> position, const PopupItems& options,
436 std::function<void(int)> callback, std::function<void()> cancel);
437
446 void dualPopupSelector(Component* source, Point<int> position, int width,
447 const PopupItems& options, std::function<void(int)> callback);
448
456 void popupDisplay(Component* source, const std::string& text,
457 BubbleComponent::BubblePlacement placement, bool primary);
458
463 void hideDisplay(bool primary);
464
468 void modulationChanged();
469
474 void modulationValueChanged(int index);
475
476 void openSaveDialog() { save_section_->setIsPreset(true); save_section_->setVisible(true); }
477
482 void enableRedoBackground(bool enable) {
483 enable_redo_background_ = enable;
484 if (enable)
485 resized();
486 }
487
492 float getResizingScale() const { return width_ * 1.0f / resized_width_; }
493
498 float getPixelScaling() const override { return display_scale_; }
499
504 int getPixelMultiple() const override { return pixel_multiple_; }
505 void toggleOscillatorZoom(int index);
506 void toggleFilter1Zoom();
507 void toggleFilter2Zoom();
508
509 private:
514 bool wavetableEditorsInitialized() {
515 for (int i = 0; i < vital::kNumOscillators; ++i) {
516 if (wavetable_edits_[i] == nullptr)
517 return false;
518 }
519 return true;
520 }
521
522 Authentication auth_;
523 std::map<std::string, SynthSlider*> slider_lookup_;
524 std::map<std::string, Button*> button_lookup_;
525 std::unique_ptr<ModulationManager> modulation_manager_;
526 std::unique_ptr<ModulationMatrix> modulation_matrix_;
527
528 std::unique_ptr<AboutSection> about_section_;
529 std::unique_ptr<AuthenticationSection> authentication_;
530 std::unique_ptr<UpdateCheckSection> update_check_section_;
531 std::unique_ptr<Component> standalone_settings_section_;
532
533 std::unique_ptr<HeaderSection> header_;
534 std::unique_ptr<SynthesisInterface> synthesis_interface_;
535 std::unique_ptr<MasterControlsInterface> master_controls_interface_;
536 std::unique_ptr<ModulationInterface> modulation_interface_;
537 std::unique_ptr<ExtraModSection> extra_mod_section_;
538 std::unique_ptr<EffectsInterface> effects_interface_;
539 std::unique_ptr<WavetableEditSection> wavetable_edits_[vital::kNumOscillators];
540 std::unique_ptr<KeyboardInterface> keyboard_interface_;
541 std::unique_ptr<BendSection> bend_section_;
542 std::unique_ptr<PortamentoSection> portamento_section_;
543 std::unique_ptr<VoiceSection> voice_section_;
544 std::unique_ptr<PresetBrowser> preset_browser_;
545 std::unique_ptr<PopupBrowser> popup_browser_;
546 std::unique_ptr<SinglePopupSelector> popup_selector_;
547 std::unique_ptr<DualPopupSelector> dual_popup_selector_;
548 std::unique_ptr<PopupDisplay> popup_display_1_;
549 std::unique_ptr<PopupDisplay> popup_display_2_;
550 std::unique_ptr<BankExporter> bank_exporter_;
551 std::unique_ptr<SaveSection> save_section_;
552 std::unique_ptr<DeleteSection> delete_section_;
553 std::unique_ptr<DownloadSection> download_section_;
554 std::unique_ptr<ExpiredSection> expired_section_;
555 SynthSection* full_screen_section_;
556
557 int width_;
558 int resized_width_;
559 float last_render_scale_;
560 float display_scale_;
561 int pixel_multiple_;
562 bool setting_all_values_;
563 bool unsupported_;
564 bool animate_;
565 bool enable_redo_background_;
566 bool needs_download_;
567 CriticalSection open_gl_critical_section_;
568 OpenGLContext open_gl_context_;
569 std::unique_ptr<Shaders> shaders_;
570 OpenGlWrapper open_gl_;
571 Image background_image_;
572 OpenGlBackground background_;
573
574 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FullInterface)
575};
Declares the AuthenticationSection class and related components for user authentication.
An overlay section that displays application information, device settings, and UI scaling options.
Definition about_section.h:64
A no-op stub implementation used when authentication is disabled.
Definition authentication.h:163
Definition authentication_section.h:265
A UI component for exporting a selection of presets, wavetables, LFOs, and samples as a bank.
Definition bank_exporter.h:257
A UI section containing both pitch and modulation wheels.
Definition bend_section.h:84
An overlay that asks the user to confirm deletion of a preset file.
Definition delete_section.h:15
Interface for objects that need to respond to data directory changes or no-download scenarios.
Definition download_section.h:54
Interface for objects that need to respond when effects are moved or scrolled.
Definition effects_interface.h:69
A section overlay that displays an expiration message for a beta version of the plugin.
Definition expired_section.h:14
A section that displays additional modulation controls for the synthesizer, including macro knobs and...
Definition extra_mod_section.h:18
The main GUI container for the entire synthesizer interface.
Definition full_interface.h:61
void hideDisplay(bool primary)
Hides a previously shown popup display.
Definition full_interface.cpp:914
void createModulationSliders(const vital::output_map &mono_modulations, const vital::output_map &poly_modulations)
Creates modulation sliders for both mono and poly modulations.
Definition full_interface.cpp:518
std::string getWavetableName(int index)
Gets the current wavetable name for a given oscillator.
Definition full_interface.cpp:788
void repaintOpenGlBackground(OpenGlComponent *component)
Repaints the background that shows behind OpenGL components.
Definition full_interface.cpp:338
void setWavetableNames()
Updates displayed wavetable names from the current wavetable data.
Definition full_interface.cpp:566
void modulationValueChanged(int index)
Called when a particular modulation value changes.
Definition full_interface.cpp:929
void renderOpenGL() override
Renders the GUI using OpenGL.
Definition full_interface.cpp:599
void openSaveDialog()
Definition full_interface.h:476
void effectsMoved() override
Called when the effects interface is moved, to update meter positions.
Definition full_interface.cpp:708
void newOpenGLContextCreated() override
Called when a new OpenGL context is created.
Definition full_interface.cpp:580
std::string getSignedInName()
Gets the name of the currently signed-in user, if any.
Definition full_interface.cpp:792
void animate(bool animate) override
Enables or disables animations (like continuous OpenGL repainting).
Definition full_interface.cpp:534
void setAudioMemory(const vital::StereoMemory *memory)
Assigns stereo audio memory for visualization.
Definition full_interface.cpp:511
void saveLfo(const json &data)
Opens a save dialog to save a given LFO shape.
Definition full_interface.cpp:848
void enableRedoBackground(bool enable)
Enables or disables redrawing of the background when resized.
Definition full_interface.h:482
void toggleFilter1Zoom()
Definition full_interface.cpp:943
bool loadAudioAsWavetable(int index, const String &name, InputStream *audio_stream, WavetableCreator::AudioFileLoadStyle style)
Loads an audio file as a wavetable into the given oscillator editor.
Definition full_interface.cpp:863
void copySkinValues(const Skin &skin)
Copies skin values from a Skin instance into the interface and look-and-feel.
Definition full_interface.cpp:270
void parentHierarchyChanged() override
Called when this component is added to a new parent.
Definition full_interface.h:159
void showFullScreenSection(SynthSection *full_screen)
Displays a full-screen section overlay, hiding other sections.
Definition full_interface.cpp:738
void tabSelected(int index) override
Handles user selecting a main tab (e.g., Synthesis, Effects, etc.)
Definition full_interface.cpp:636
void repaintSynthesisSection()
Repaints only the synthesis (oscillator/filter) section background.
Definition full_interface.cpp:322
void hideWavetableEditSection()
Hides any open wavetable editing section, returning to the normal view.
Definition full_interface.cpp:811
void notifyChange()
Notifies that a parameter or state has changed.
Definition full_interface.cpp:723
void toggleOscillatorZoom(int index)
Definition full_interface.cpp:936
void reset() override
Resets the entire interface to a default state.
Definition full_interface.cpp:542
virtual ~FullInterface()
Destructor.
Definition full_interface.cpp:239
void showAboutSection() override
Shows the "About" section overlay.
Definition full_interface.cpp:626
void dualPopupSelector(Component *source, Point< int > position, int width, const PopupItems &options, std::function< void(int)> callback)
Opens a dual popup selector for choosing from a hierarchical list of items.
Definition full_interface.cpp:898
virtual void resized() override
Adjusts layout and sizes of child components after the interface is resized.
Definition full_interface.cpp:375
void noDownloadNeeded() override
Indicates that no download is needed after checking updates.
Definition full_interface.cpp:287
void repaintChildBackground(SynthSection *child)
Repaints the background of a child section.
Definition full_interface.cpp:303
void notifyFresh()
Notifies that the interface is in a fresh state (no unsaved changes).
Definition full_interface.cpp:728
void resynthesizeToWavetable(int index)
Performs resynthesis of the current wavetable for the given oscillator.
Definition full_interface.cpp:830
void toggleFilter2Zoom()
Definition full_interface.cpp:950
void loadDefaultWavetable(int index)
Loads a default wavetable into the given oscillator editor.
Definition full_interface.cpp:825
void reloadSkin(const Skin &skin)
Reloads and applies a new skin, then adjusts layout accordingly.
Definition full_interface.cpp:276
void clearTemporaryTab(int current_tab) override
Clears temporary overlay tabs such as the preset browser.
Definition full_interface.cpp:653
void redoBackground()
Redraws the entire background image for the interface.
Definition full_interface.cpp:349
void saveWavetable(int index)
Opens a save dialog to save the current wavetable of an oscillator.
Definition full_interface.cpp:835
json getWavetableJson(int index)
Retrieves the JSON data representing the current wavetable for an oscillator.
Definition full_interface.cpp:857
void showWavetableEditSection(int index)
Shows the wavetable edit section for a given oscillator index.
Definition full_interface.cpp:763
void signIn()
Opens the sign-in interface, if available.
Definition full_interface.cpp:804
void loadWavetableFile(int index, const File &wavetable)
Loads a wavetable from a file into the given oscillator editor.
Definition full_interface.cpp:815
void setOscilloscopeMemory(const vital::poly_float *memory)
Assigns memory for oscilloscope visualization.
Definition full_interface.cpp:504
void startDownload()
Starts a download of additional content if needed.
Definition full_interface.cpp:573
void setAllValues(vital::control_map &controls) override
Sets all parameter values on the interface.
Definition full_interface.cpp:559
int getPixelMultiple() const override
Returns the pixel multiple used for scaling pixel-perfect rendering.
Definition full_interface.h:504
void deleteRequested(File preset) override
Handles a request to delete a preset file.
Definition full_interface.cpp:631
float getResizingScale() const
Returns the scale factor for resizing operations.
Definition full_interface.h:492
static constexpr double kMinOpenGlVersion
Minimum required OpenGL version for the interface to function properly.
Definition full_interface.h:66
void externalPresetLoaded(const File &preset)
Handles loading an external preset file into the interface.
Definition full_interface.cpp:733
void setPresetBrowserVisibility(bool visible, int current_tab) override
Toggles the visibility of the preset browser.
Definition full_interface.cpp:663
void dataDirectoryChanged() override
Called when the data directory changes.
Definition full_interface.cpp:283
void signOut()
Signs out the current user, if signed in.
Definition full_interface.cpp:799
void setBankExporterVisibility(bool visible, int current_tab) override
Toggles the visibility of the bank exporter.
Definition full_interface.cpp:684
void popupBrowser(SynthSection *owner, Rectangle< int > bounds, std::vector< File > directories, String extensions, std::string passthrough_name, std::string additional_folders_name)
Opens a popup browser for file browsing.
Definition full_interface.cpp:872
void popupDisplay(Component *source, const std::string &text, BubbleComponent::BubblePlacement placement, bool primary)
Shows a popup display (a tooltip-like bubble) with provided text.
Definition full_interface.cpp:907
void modulationsScrolled() override
Called when modulations are scrolled, to update meter positions.
Definition full_interface.cpp:712
void bankImported() override
Called when a new bank of presets has been imported, to refresh lists.
Definition full_interface.cpp:704
void checkShouldReposition(bool resize=true)
Checks if the interface should be repositioned or resized based on scaling or display changes.
Definition full_interface.cpp:365
float getPixelScaling() const override
Returns the current pixel scaling factor based on display scale.
Definition full_interface.h:498
void setFocus()
Sets keyboard focus to a relevant component (e.g., authentication).
Definition full_interface.cpp:716
std::string getLastBrowsedWavetable(int index)
Gets the last browsed wavetable file path for a given oscillator.
Definition full_interface.cpp:784
void loggedIn() override
Called when the user has successfully logged in.
Definition full_interface.cpp:296
virtual void paintBackground(Graphics &g) override
Paints the background of the entire interface.
Definition full_interface.cpp:246
void popupSelector(Component *source, Point< int > position, const PopupItems &options, std::function< void(int)> callback, std::function< void()> cancel)
Opens a popup selector for choosing from a list of items.
Definition full_interface.cpp:888
void openGLContextClosing() override
Called when the OpenGL context is closing, allowing cleanup of resources.
Definition full_interface.cpp:616
void needsUpdate() override
Indicates that a software update is available and needs action.
Definition full_interface.cpp:291
void modulationChanged()
Called when modulations have changed, updating the modulation matrix and related components.
Definition full_interface.cpp:920
void popupBrowserUpdate(SynthSection *owner)
Updates the popup browser's ownership, useful if the owner changed.
Definition full_interface.cpp:883
FullInterface()
Constructs a minimal, empty full interface.
Definition full_interface.cpp:224
void loadWavetable(int index, json &wavetable_data)
Loads a wavetable from a JSON object into the given oscillator editor.
Definition full_interface.cpp:820
Interface for objects that need to be notified of events from the HeaderSection.
Definition header_section.h:96
The topmost section of the synthesizer GUI, displaying the logo, tab selector, preset controls,...
Definition header_section.h:90
A UI section of the synthesizer interface that displays and handles a virtual MIDI keyboard.
Definition keyboard_interface.h:16
A top-level UI component that contains various sections for configuring the synthesizer.
Definition master_controls_interface.h:138
A user interface section for managing and viewing various modulation sources like envelopes,...
Definition modulation_interface.h:28
A top-level section for managing all modulation connections, amounts, and related UI components.
Definition modulation_manager.h:290
Interface for objects that need to respond to modulation matrix scrolling events.
Definition modulation_matrix.h:402
A class that manages and renders a background image using OpenGL.
Definition open_gl_background.h:16
A base component class that integrates JUCE's Component with OpenGL rendering.
Definition open_gl_component.h:20
A UI section for controlling portamento (glide) settings in a synthesizer.
Definition portamento_section.h:18
A UI for browsing, loading, and organizing presets.
Definition preset_browser.h:413
A UI overlay for saving presets or other files.
Definition save_section.h:21
Manages the overall color and value theme (or "skin") of the user interface.
Definition skin.h:24
Base class for all synthesizer sections, providing UI layout, painting, and interaction logic.
Definition synth_section.h:193
A specialized slider with extended functionality for modulation, parameter control,...
Definition synth_slider.h:314
A top-level synthesis section that combines oscillators, samples, and filters.
Definition synthesis_interface.h:21
Interface for components interested in update notifications.
Definition update_check_section.h:96
A UI section for controlling various global voice parameters.
Definition voice_section.h:14
AudioFileLoadStyle
Defines how audio files are interpreted when loading into a wavetable.
Definition wavetable_creator.h:33
A UI section for editing, visualizing, and managing wavetables.
Definition wavetable_edit_section.h:35
A specialized MemoryTemplate for two-channel (stereo) audio.
Definition memory.h:216
Declares the DownloadSection class, providing a UI for downloading and installing preset packs.
Declares the EffectsInterface class and related components for managing and displaying multiple effec...
nlohmann::json json
Definition line_generator.h:7
Declares classes for time-domain memory storage and retrieval with cubic interpolation.
constexpr int kNumOscillators
Number of oscillators available in Vital.
Definition synth_constants.h:16
std::map< std::string, Output * > output_map
Maps parameter names to Output pointers, representing output signals from various modules.
Definition synth_types.h:229
std::map< std::string, Value * > control_map
Maps parameter names to Value pointers representing synth control parameters.
Definition synth_types.h:214
A helper struct containing references to OpenGL context, shaders, and display scale.
Definition shaders.h:174
A hierarchical structure of popup menu items for a selector component.
Definition synth_section.h:29
A struct holding references and data used by the GUI to interact with the SynthBase.
Definition synth_gui_interface.h:27
Represents a vector of floating-point values using SIMD instructions.
Definition poly_values.h:600