10#include "sound_engine.h"
56 gui_ = std::make_unique<FullInterface>(&synth_data);
76 gui_->setValue(name, value, NotificationType::dontSendNotification);
84 gui_->modulationChanged();
88 gui_->modulationValueChanged(index);
106 if (connection_index < 0)
114 std::string power_name =
"modulation_" + std::to_string(connection_index + 1) +
"_power";
116 gui_->setValue(power_name, 0.0f, NotificationType::dontSendNotification);
123 if (connection_index < 0)
126 std::string number = std::to_string(connection_index + 1);
127 std::string amount_name =
"modulation_" + number +
"_amount";
128 std::string bipolar_name =
"modulation_" + number +
"_bipolar";
129 std::string stereo_name =
"modulation_" + number +
"_stereo";
130 std::string bypass_name =
"modulation_" + number +
"_bypass";
132 float bipolar_amount = bipolar ? 1.0f : 0.0f;
133 float stereo_amount = stereo ? 1.0f : 0.0f;
134 float bypass_amount = bypass ? 1.0f : 0.0f;
140 gui_->setValue(amount_name, amount, NotificationType::dontSendNotification);
141 gui_->setValue(bipolar_name, bipolar_amount, NotificationType::dontSendNotification);
142 gui_->setValue(stereo_name, stereo_amount, NotificationType::dontSendNotification);
143 gui_->setValue(bypass_name, bypass_amount, NotificationType::dontSendNotification);
169 gui_->notifyChange();
183 gui_->openSaveDialog();
190 gui_->externalPresetLoaded(preset);
198 Point<int> position =
gui_->getScreenBounds().getCentre();
199 const Displays::Display& display = Desktop::getInstance().getDisplays().findDisplayForPoint(position);
201 Rectangle<int> display_area = Desktop::getInstance().getDisplays().getTotalBounds(
true);
202 ComponentPeer* peer =
gui_->getPeer();
204 peer->getFrameSize().subtractFrom(display_area);
206 float window_size = scale / display.scale;
214 Rectangle<int> bounds =
gui_->getBounds();
215 bounds.setWidth(width);
216 bounds.setHeight(height);
217 gui_->getParentComponent()->setBounds(bounds);
218 gui_->redoBackground();
A class for generating and storing a line shape, defined by a series of points and associated powers.
Definition line_generator.h:20
void initLinear()
Initializes the line to a simple linear shape (from 1.0 at x=0 to 0.0 at x=1).
Definition line_generator.cpp:11
static void saveWindowSize(float window_size)
Saves the window size scaling factor.
Definition load_save.cpp:1324
A base class providing foundational functionality for the Vital synthesizer’s engine,...
Definition synth_base.h:42
bool connectModulation(const std::string &source, const std::string &destination)
Connects a modulation source to a destination parameter.
Definition synth_base.cpp:165
int getConnectionIndex(const std::string &source, const std::string &destination)
Gets the index of a modulation connection given its source and destination.
Definition synth_base.cpp:111
vital::ModulationConnectionBank & getModulationBank()
Retrieves the ModulationConnectionBank managing all modulation connections.
Definition synth_base.cpp:730
LineGenerator * getLfoSource(int index)
Retrieves an LFO source by index.
Definition synth_base.cpp:278
void disconnectModulation(const std::string &source, const std::string &destination)
Disconnects a modulation source from a destination parameter.
Definition synth_base.cpp:190
WavetableCreator * getWavetableCreator(int index)
Gets a WavetableCreator for a given oscillator index.
Definition synth_base.cpp:270
vital::control_map & getControls()
Provides access to the controls map (parameter name to Parameter pointer).
Definition synth_base.h:477
vital::SoundEngine * getEngine()
Returns a pointer to the SoundEngine used for audio and modulation processing.
Definition synth_base.h:484
void valueChanged(const std::string &name, vital::mono_float value)
Updates the value of a control parameter.
Definition synth_base.cpp:50
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
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
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
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
ModulationConnection * atIndex(int index)
Retrieves a ModulationConnection by index.
Definition synth_types.h:114
constexpr int kNumOscillators
Number of oscillators available in Vital.
Definition synth_constants.h:16
constexpr int kDefaultWindowHeight
Default height of the Vital window (in pixels).
Definition synth_constants.h:64
constexpr int kDefaultWindowWidth
Default width of the Vital window (in pixels).
Definition synth_constants.h:61
constexpr int kNumLfos
Number of LFO sources available in the Vital synthesizer.
Definition synth_constants.h:13
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
std::unique_ptr< ModulationConnectionProcessor > modulation_processor
Processor applying scaling/mapping.
Definition synth_types.h:75