Vital
Loading...
Searching...
No Matches
synth_gui_interface.h
Go to the documentation of this file.
1/*
2Summary:
3The SynthGuiInterface class mediates between the SynthBase (synth engine backend) and a graphical front end (FullInterface). It updates GUI elements when parameters or modulations change, and also handles user actions from the GUI such as connecting modulations or resizing the window. In HEADLESS mode, these functionalities become no-ops. The SynthGuiData struct provides a data snapshot of engine state (controls, modulations, wavetable creators) to the GUI for display and interaction.
4 */
5#pragma once
6
7#include "JuceHeader.h"
8#include "synth_base.h"
9
10#if HEADLESS
11
12class FullInterface { };
13class AudioDeviceManager { };
14
15#endif
16
17class FullInterface;
18class Authentication;
19
42
57public:
64 SynthGuiInterface(SynthBase* synth, bool use_gui = true);
65
69 virtual ~SynthGuiInterface();
70
78 virtual AudioDeviceManager* getAudioDeviceManager() { return nullptr; }
79
85 SynthBase* getSynth() { return synth_; }
86
93 virtual void updateFullGui();
94
101 virtual void updateGuiControl(const std::string& name, vital::mono_float value);
102
109 vital::mono_float getControlValue(const std::string& name);
110
117
123 void notifyModulationValueChanged(int index);
124
133 void connectModulation(std::string source, std::string destination);
134
141
154 void setModulationValues(const std::string& source, const std::string& destination,
155 vital::mono_float amount, bool bipolar, bool stereo, bool bypass);
156
165 void initModulationValues(const std::string& source, const std::string& destination);
166
173 void disconnectModulation(std::string source, std::string destination);
174
181
185 void setFocus();
186
190 void notifyChange();
191
195 void notifyFresh();
196
200 void openSaveDialog();
201
207 void externalPresetLoaded(File preset);
208
216 void setGuiSize(float scale);
217
223 FullInterface* getGui() { return gui_.get(); }
224
225protected:
227 std::unique_ptr<FullInterface> gui_;
228
229 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SynthGuiInterface)
230};
A no-op stub implementation used when authentication is disabled.
Definition authentication.h:163
The main GUI container for the entire synthesizer interface.
Definition full_interface.h:61
A base class providing foundational functionality for the Vital synthesizer’s engine,...
Definition synth_base.h:42
An interface class linking the Vital synthesizer backend (SynthBase) with a GUI.
Definition synth_gui_interface.h:56
void notifyModulationsChanged()
Notifies the GUI that modulation connections or states have changed.
Definition synth_gui_interface.cpp:83
SynthBase * synth_
The backend SynthBase this GUI interface controls.
Definition synth_gui_interface.h:226
std::unique_ptr< FullInterface > gui_
The primary GUI component (if applicable).
Definition synth_gui_interface.h:227
SynthGuiInterface(SynthBase *synth, bool use_gui=true)
Constructs the SynthGuiInterface, optionally creating a FullInterface GUI.
Definition synth_gui_interface.cpp:49
FullInterface * getGui()
Gets the FullInterface GUI component if it exists.
Definition synth_gui_interface.h:223
vital::mono_float getControlValue(const std::string &name)
Retrieves the current value of a named control from the synth.
Definition synth_gui_interface.cpp:79
SynthBase * getSynth()
Returns the SynthBase instance this interface is managing.
Definition synth_gui_interface.h:85
void notifyChange()
Notifies the GUI that a parameter or modulation changed, prompting GUI updates.
Definition synth_gui_interface.cpp:165
void setGuiSize(float scale)
Sets the GUI window or component size based on a scale factor.
Definition synth_gui_interface.cpp:193
void initModulationValues(const std::string &source, const std::string &destination)
Initializes modulation values for a newly created modulation connection.
Definition synth_gui_interface.cpp:103
void setModulationValues(const std::string &source, const std::string &destination, vital::mono_float amount, bool bipolar, bool stereo, bool bypass)
Sets various modulation parameters (amount, bipolar, stereo, bypass) for a given connection.
Definition synth_gui_interface.cpp:119
virtual void updateGuiControl(const std::string &name, vital::mono_float value)
Updates a single GUI control to reflect a new parameter value.
Definition synth_gui_interface.cpp:71
void disconnectModulation(std::string source, std::string destination)
Disconnects a modulation from the GUI layer.
Definition synth_gui_interface.cpp:146
void connectModulation(std::string source, std::string destination)
Connects a modulation source to a destination parameter through the GUI.
Definition synth_gui_interface.cpp:91
void setFocus()
Brings the GUI window or main component into focus.
Definition synth_gui_interface.cpp:158
virtual ~SynthGuiInterface()
Destroys the SynthGuiInterface, cleaning up any associated GUI resources.
Definition synth_gui_interface.cpp:60
virtual AudioDeviceManager * getAudioDeviceManager()
Retrieves the audio device manager if available.
Definition synth_gui_interface.h:78
void openSaveDialog()
Opens a save dialog (e.g., to save a preset) through the GUI.
Definition synth_gui_interface.cpp:179
void notifyModulationValueChanged(int index)
Notifies the GUI that a specific modulation's value changed.
Definition synth_gui_interface.cpp:87
virtual void updateFullGui()
Updates the entire GUI to reflect the current synth state.
Definition synth_gui_interface.cpp:62
void externalPresetLoaded(File preset)
Notifies the GUI that a preset was loaded externally (outside the GUI controls).
Definition synth_gui_interface.cpp:186
void notifyFresh()
Notifies the GUI that a fresh state (like a new preset load) has occurred, prompting a full refresh.
Definition synth_gui_interface.cpp:172
A class responsible for creating complete wavetables from groups of wavetable components.
Definition wavetable_creator.h:27
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
float mono_float
Definition common.h:33
A struct holding references and data used by the GUI to interact with the SynthBase.
Definition synth_gui_interface.h:27
vital::output_map poly_modulations
Polyphonic modulation values.
Definition synth_gui_interface.h:37
vital::control_map controls
Current set of parameter controls from the synth.
Definition synth_gui_interface.h:35
vital::output_map modulation_sources
All available modulation sources.
Definition synth_gui_interface.h:38
vital::output_map mono_modulations
Mono (global) modulation values.
Definition synth_gui_interface.h:36
SynthBase * synth
Pointer back to the associated SynthBase.
Definition synth_gui_interface.h:40
WavetableCreator * wavetable_creators[vital::kNumOscillators]
Array of pointers to wavetable creators for each oscillator.
Definition synth_gui_interface.h:39
SynthGuiData(SynthBase *synth_base)
Constructs SynthGuiData from a given SynthBase instance.
Definition synth_gui_interface.cpp:14
A structure representing a single modulation connection between a modulation source and a destination...
Definition synth_types.h:30