Vital
|
An interface class linking the Vital synthesizer backend (SynthBase) with a GUI. More...
#include <synth_gui_interface.h>
Public Member Functions | |
SynthGuiInterface (SynthBase *synth, bool use_gui=true) | |
Constructs the SynthGuiInterface, optionally creating a FullInterface GUI. | |
virtual | ~SynthGuiInterface () |
Destroys the SynthGuiInterface, cleaning up any associated GUI resources. | |
virtual AudioDeviceManager * | getAudioDeviceManager () |
Retrieves the audio device manager if available. | |
SynthBase * | getSynth () |
Returns the SynthBase instance this interface is managing. | |
virtual void | updateFullGui () |
Updates the entire GUI to reflect the current synth state. | |
virtual void | updateGuiControl (const std::string &name, vital::mono_float value) |
Updates a single GUI control to reflect a new parameter value. | |
vital::mono_float | getControlValue (const std::string &name) |
Retrieves the current value of a named control from the synth. | |
void | notifyModulationsChanged () |
Notifies the GUI that modulation connections or states have changed. | |
void | notifyModulationValueChanged (int index) |
Notifies the GUI that a specific modulation's value changed. | |
void | connectModulation (std::string source, std::string destination) |
Connects a modulation source to a destination parameter through the GUI. | |
void | connectModulation (vital::ModulationConnection *connection) |
Connects a modulation using a pre-existing ModulationConnection object. | |
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. | |
void | initModulationValues (const std::string &source, const std::string &destination) |
Initializes modulation values for a newly created modulation connection. | |
void | disconnectModulation (std::string source, std::string destination) |
Disconnects a modulation from the GUI layer. | |
void | disconnectModulation (vital::ModulationConnection *connection) |
Disconnects a modulation using a ModulationConnection object. | |
void | setFocus () |
Brings the GUI window or main component into focus. | |
void | notifyChange () |
Notifies the GUI that a parameter or modulation changed, prompting GUI updates. | |
void | notifyFresh () |
Notifies the GUI that a fresh state (like a new preset load) has occurred, prompting a full refresh. | |
void | openSaveDialog () |
Opens a save dialog (e.g., to save a preset) through the GUI. | |
void | externalPresetLoaded (File preset) |
Notifies the GUI that a preset was loaded externally (outside the GUI controls). | |
void | setGuiSize (float scale) |
Sets the GUI window or component size based on a scale factor. | |
FullInterface * | getGui () |
Gets the FullInterface GUI component if it exists. | |
Protected Attributes | |
SynthBase * | synth_ |
The backend SynthBase this GUI interface controls. | |
std::unique_ptr< FullInterface > | gui_ |
The primary GUI component (if applicable). | |
An interface class linking the Vital synthesizer backend (SynthBase) with a GUI.
SynthGuiInterface provides methods to:
On some builds (HEADLESS mode), these functionalities may be stubbed out, meaning the GUI does nothing. When GUI is available, it typically integrates with a FullInterface GUI component that displays and updates Vital’s parameters and states.
SynthGuiInterface::SynthGuiInterface | ( | SynthBase * | synth, |
bool | use_gui = true ) |
Constructs the SynthGuiInterface, optionally creating a FullInterface GUI.
synth | A pointer to the SynthBase instance to manage GUI for. |
use_gui | If true, constructs a GUI interface. If false (or HEADLESS), no GUI is created. |
|
virtual |
Destroys the SynthGuiInterface, cleaning up any associated GUI resources.
void SynthGuiInterface::connectModulation | ( | std::string | source, |
std::string | destination ) |
Connects a modulation source to a destination parameter through the GUI.
If a new modulation connection is created, the GUI may initialize default modulation values.
source | The modulation source name. |
destination | The destination parameter name. |
void SynthGuiInterface::connectModulation | ( | vital::ModulationConnection * | connection | ) |
Connects a modulation using a pre-existing ModulationConnection object.
connection | Pointer to the ModulationConnection to connect. |
void SynthGuiInterface::disconnectModulation | ( | std::string | source, |
std::string | destination ) |
Disconnects a modulation from the GUI layer.
source | The modulation source name. |
destination | The destination parameter name. |
void SynthGuiInterface::disconnectModulation | ( | vital::ModulationConnection * | connection | ) |
Disconnects a modulation using a ModulationConnection object.
connection | Pointer to the ModulationConnection to disconnect. |
void SynthGuiInterface::externalPresetLoaded | ( | File | preset | ) |
Notifies the GUI that a preset was loaded externally (outside the GUI controls).
preset | The preset file that was loaded. |
|
inlinevirtual |
Retrieves the audio device manager if available.
By default, this returns nullptr. Subclasses or custom builds might return a valid manager.
Reimplemented in SynthEditor.
vital::mono_float SynthGuiInterface::getControlValue | ( | const std::string & | name | ) |
Retrieves the current value of a named control from the synth.
name | The parameter/control name. |
|
inline |
Gets the FullInterface GUI component if it exists.
|
inline |
void SynthGuiInterface::initModulationValues | ( | const std::string & | source, |
const std::string & | destination ) |
Initializes modulation values for a newly created modulation connection.
Resets line mappings and other parameters to default linear states.
source | The modulation source name. |
destination | The parameter to modulate. |
void SynthGuiInterface::notifyChange | ( | ) |
Notifies the GUI that a parameter or modulation changed, prompting GUI updates.
void SynthGuiInterface::notifyFresh | ( | ) |
Notifies the GUI that a fresh state (like a new preset load) has occurred, prompting a full refresh.
void SynthGuiInterface::notifyModulationsChanged | ( | ) |
Notifies the GUI that modulation connections or states have changed.
This prompts the GUI to refresh displays related to modulation routing or amounts.
void SynthGuiInterface::notifyModulationValueChanged | ( | int | index | ) |
Notifies the GUI that a specific modulation's value changed.
index | The modulation connection index that changed. |
void SynthGuiInterface::openSaveDialog | ( | ) |
Opens a save dialog (e.g., to save a preset) through the GUI.
void SynthGuiInterface::setFocus | ( | ) |
Brings the GUI window or main component into focus.
void SynthGuiInterface::setGuiSize | ( | float | scale | ) |
Sets the GUI window or component size based on a scale factor.
Adjusts the main interface dimensions relative to a default size and current display settings.
scale | A scaling factor for the GUI size. |
void SynthGuiInterface::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.
This function updates both the backend and GUI to reflect the new modulation settings.
source | The modulation source name. |
destination | The parameter to modulate. |
amount | The modulation amount. |
bipolar | True for bipolar modulation, false for unipolar. |
stereo | True if modulation is stereo, false if mono. |
bypass | True if modulation is bypassed, false otherwise. |
|
virtual |
Updates the entire GUI to reflect the current synth state.
This method is typically called after loading a new preset or making significant changes to parameters. It instructs the GUI to refresh all displayed values.
Reimplemented in SynthEditor.
|
virtual |
Updates a single GUI control to reflect a new parameter value.
name | The parameter/control name. |
value | The new value to display on the GUI. |
|
protected |
The primary GUI component (if applicable).