Vital
Loading...
Searching...
No Matches
WaveSourceOverlay Class Reference

Provides an overlay for editing WaveSource objects in the Wavetable component. More...

#include <wave_source_overlay.h>

Inheritance diagram for WaveSourceOverlay:
WavetableComponentOverlay WaveSourceEditor::Listener BarEditor::Listener SynthSection WavetablePlayhead::Listener WavetableOrganizer::Listener SynthButton::ButtonListener

Public Member Functions

 WaveSourceOverlay ()
 Constructs a new WaveSourceOverlay.
 
void resized () override
 Called when the component is resized.
 
virtual void frameSelected (WavetableKeyframe *keyframe) override
 Called when a keyframe is selected within the Wavetable.
 
virtual void frameDragged (WavetableKeyframe *keyframe, int position) override
 Called when a keyframe is dragged within the Wavetable.
 
virtual void setEditBounds (Rectangle< int > bounds) override
 Sets the bounds for the editable region of this overlay.
 
virtual bool setTimeDomainBounds (Rectangle< int > bounds) override
 Sets the bounds for the time-domain editor.
 
virtual bool setFrequencyAmplitudeBounds (Rectangle< int > bounds) override
 Sets the bounds for the frequency amplitude editor.
 
virtual bool setPhaseBounds (Rectangle< int > bounds) override
 Sets the bounds for the frequency phase editor.
 
void updateFrequencyDomain (std::complex< float > *frequency_domain)
 Updates the frequency-domain editors with new data.
 
void loadFrequencyDomain ()
 Loads frequency-domain data from the editors back into the current frame.
 
void valuesChanged (int start, int end, bool mouse_up) override
 Called when values in the WaveSourceEditor are changed.
 
void barsChanged (int start, int end, bool mouse_up) override
 Called when values in the BarEditor are changed.
 
void sliderValueChanged (Slider *moved_slider) override
 Called when a slider changes value.
 
void setPowerScale (bool scale) override
 Enables or disables power scaling for the frequency amplitude editor.
 
void setFrequencyZoom (float zoom) override
 Sets the zoom level for frequency-domain editors.
 
void setInterpolationType (WaveSource::InterpolationStyle style, WaveSource::InterpolationMode mode)
 Sets the interpolation type for the WaveSource.
 
void setWaveSource (WaveSource *wave_source)
 Assigns a WaveSource to this overlay.
 
- Public Member Functions inherited from WavetableComponentOverlay
 WavetableComponentOverlay (String name)
 Constructs a WavetableComponentOverlay.
 
 WavetableComponentOverlay ()=delete
 Deleted default constructor.
 
void paintBackground (Graphics &g) override
 Custom paint method for background.
 
void playheadMoved (int position) override
 Called when the wavetable playhead moves, but default does nothing.
 
void resetOverlay ()
 Resets the overlay, clearing any associated component.
 
void initOpenGlComponents (OpenGlWrapper &open_gl) override
 Initializes OpenGL components.
 
bool initialized ()
 Checks if the overlay has been initialized.
 
void addFrameListener (Listener *listener)
 Adds a listener for frame changes.
 
void removeListener (Listener *listener)
 Removes a frame listener.
 
void setPadding (int padding)
 Sets padding around controls and triggers a repaint.
 
int getPadding ()
 Gets the current padding value.
 
void setComponent (WavetableComponent *component)
 Sets the WavetableComponent that this overlay is editing.
 
WavetableComponentgetComponent ()
 Gets the currently associated WavetableComponent.
 
- Public Member Functions inherited from SynthSection
 SynthSection (const String &name)
 Constructs a SynthSection with a given name.
 
virtual ~SynthSection ()=default
 
void setParent (const SynthSection *parent)
 Sets the parent SynthSection.
 
float findValue (Skin::ValueId value_id) const
 Finds a value in the skin overrides or from the parent if not found locally.
 
virtual void reset ()
 Resets the section and all sub-sections.
 
virtual void paint (Graphics &g) override
 Called when the component should paint itself.
 
virtual void paintSidewaysHeadingText (Graphics &g)
 Paints the section name heading text vertically if sideways_heading_ is true.
 
virtual void paintHeadingText (Graphics &g)
 Paints the heading text for this section, either sideways or horizontally.
 
virtual void setSkinValues (const Skin &skin, bool top_level)
 Sets skin values (colors, sizes) and applies them to sub-sections.
 
void setSkinOverride (Skin::SectionOverride skin_override)
 
virtual void repaintBackground ()
 Requests a repaint of the background.
 
void showPopupBrowser (SynthSection *owner, Rectangle< int > bounds, std::vector< File > directories, String extensions, std::string passthrough_name, std::string additional_folders_name)
 Shows a file browser popup (e.g., for loading samples or wavetables).
 
void updatePopupBrowser (SynthSection *owner)
 Updates the currently visible popup browser if any.
 
void showPopupSelector (Component *source, Point< int > position, const PopupItems &options, std::function< void(int)> callback, std::function< void()> cancel={ })
 Shows a popup selector with options.
 
void showDualPopupSelector (Component *source, Point< int > position, int width, const PopupItems &options, std::function< void(int)> callback)
 Shows a dual popup selector for hierarchical selection.
 
void showPopupDisplay (Component *source, const std::string &text, BubbleComponent::BubblePlacement placement, bool primary)
 Shows a brief popup display (like a tooltip).
 
void hidePopupDisplay (bool primary)
 Hides the currently shown popup display.
 
virtual void loadFile (const File &file)
 Loads a file (e.g., a sample or wavetable). Overridden by subclasses.
 
virtual File getCurrentFile ()
 Gets the currently loaded file. Overridden by subclasses.
 
virtual std::string getFileName ()
 Gets the name of the currently loaded file. Overridden by subclasses.
 
virtual std::string getFileAuthor ()
 Gets the author metadata of the currently loaded file. Overridden by subclasses.
 
virtual void paintContainer (Graphics &g)
 Paints the container background, body, heading, etc.
 
virtual void paintBody (Graphics &g, Rectangle< int > bounds)
 Paints the body background within given bounds.
 
virtual void paintBorder (Graphics &g, Rectangle< int > bounds)
 Paints the border around given bounds.
 
virtual void paintBody (Graphics &g)
 Paints the section body background using the entire component area.
 
virtual void paintBorder (Graphics &g)
 Paints the border around the entire component.
 
int getComponentShadowWidth ()
 Gets the width of shadow around components.
 
virtual void paintTabShadow (Graphics &g)
 Paints a tab-like shadow effect around the component.
 
void paintTabShadow (Graphics &g, Rectangle< int > bounds)
 Paints a tab shadow effect within specified bounds.
 
virtual void paintBackgroundShadow (Graphics &g)
 Stub for painting background shadows. Overridden by subclasses if needed.
 
virtual void setSizeRatio (float ratio)
 Sets the size ratio for scaling UI elements.
 
void paintKnobShadows (Graphics &g)
 Paints knob shadows for all sliders.
 
Font getLabelFont ()
 Gets a suitable font for label text.
 
void setLabelFont (Graphics &g)
 Sets the Graphics context font and color for labels.
 
void drawLabelConnectionForComponents (Graphics &g, Component *left, Component *right)
 Draws a rectangular connection between labels of two components.
 
void drawLabelBackground (Graphics &g, Rectangle< int > bounds, bool text_component=false)
 Draws a background for a label area.
 
void drawLabelBackgroundForComponent (Graphics &g, Component *component)
 Draws label background for a specific component.
 
Rectangle< int > getDividedAreaBuffered (Rectangle< int > full_area, int num_sections, int section, int buffer)
 Divides an area into equal sections with buffering, returns the specified section.
 
Rectangle< int > getDividedAreaUnbuffered (Rectangle< int > full_area, int num_sections, int section, int buffer)
 Divides an area into equal sections without extra buffering, returns the specified section.
 
Rectangle< int > getLabelBackgroundBounds (Rectangle< int > bounds, bool text_component=false)
 Gets the background bounds for a label.
 
Rectangle< int > getLabelBackgroundBounds (Component *component, bool text_component=false)
 Gets the label background bounds for a component.
 
void drawLabel (Graphics &g, String text, Rectangle< int > component_bounds, bool text_component=false)
 Draws a label text below a component.
 
void drawLabelForComponent (Graphics &g, String text, Component *component, bool text_component=false)
 Draws a label for a given component.
 
void drawTextBelowComponent (Graphics &g, String text, Component *component, int space, int padding=0)
 Draws text below a component with optional padding.
 
virtual void paintChildrenShadows (Graphics &g)
 Paints shadows for child sections.
 
void paintChildrenBackgrounds (Graphics &g)
 Paints the backgrounds for all child sections.
 
void paintOpenGlChildrenBackgrounds (Graphics &g)
 Paints the backgrounds for all OpenGL child components.
 
void paintChildBackground (Graphics &g, SynthSection *child)
 Paints a child's background specifically.
 
void paintChildShadow (Graphics &g, SynthSection *child)
 Paints a child's shadow specifically.
 
void paintOpenGlBackground (Graphics &g, OpenGlComponent *child)
 Paints the background of an OpenGlComponent child.
 
void drawTextComponentBackground (Graphics &g, Rectangle< int > bounds, bool extend_to_label)
 Draws a background for a text component area.
 
void drawTempoDivider (Graphics &g, Component *sync)
 Draws a divider line for tempo-related controls.
 
virtual void renderOpenGlComponents (OpenGlWrapper &open_gl, bool animate)
 Renders all OpenGL components in this section and sub-sections.
 
virtual void destroyOpenGlComponents (OpenGlWrapper &open_gl)
 Destroys all OpenGL components in this section and sub-sections.
 
virtual void buttonClicked (Button *clicked_button) override
 Called when a button is clicked. Updates the synth parameter accordingly.
 
virtual void guiChanged (SynthButton *button) override
 Called when a SynthButton state changes (GUI interaction).
 
std::map< std::string, SynthSlider * > getAllSliders ()
 Gets all sliders registered in this section.
 
std::map< std::string, ToggleButton * > getAllButtons ()
 Gets all toggle buttons registered in this section.
 
std::map< std::string, ModulationButton * > getAllModulationButtons ()
 Gets all modulation buttons registered in this section.
 
virtual void setActive (bool active)
 Sets the active state of this section and sub-sections.
 
bool isActive () const
 Checks if the section is currently active.
 
virtual void animate (bool animate)
 Triggers animation state change in sub-sections if needed.
 
virtual void setAllValues (vital::control_map &controls)
 Sets values for all known parameters from a control map.
 
virtual void setValue (const std::string &name, vital::mono_float value, NotificationType notification)
 Sets a single parameter value for a known control.
 
void addModulationButton (ModulationButton *button, bool show=true)
 Adds a modulation button to this section.
 
void addSubSection (SynthSection *section, bool show=true)
 Adds a subsection (another SynthSection) as a child.
 
void removeSubSection (SynthSection *section)
 Removes a previously added subsection.
 
virtual void setScrollWheelEnabled (bool enabled)
 Enables or disables scroll wheel support for this section and sub-sections.
 
ToggleButton * activator () const
 Gets the activator toggle button if any.
 
void setSkinValues (std::map< Skin::ValueId, float > values)
 Sets custom skin values for this section.
 
void setSkinValue (Skin::ValueId id, float value)
 Sets a single skin value override.
 
float getTitleWidth ()
 
float getPadding ()
 
float getPowerButtonOffset () const
 
float getKnobSectionHeight ()
 
float getSliderWidth ()
 
float getSliderOverlap ()
 
float getSliderOverlapWithSpace ()
 
float getTextComponentHeight ()
 
float getStandardKnobSize ()
 
float getTotalKnobHeight ()
 
float getTextSectionYOffset ()
 
float getModButtonWidth ()
 
float getModFontSize ()
 
float getWidgetMargin ()
 
float getWidgetRounding ()
 
float getSizeRatio () const
 
int getPopupWidth () const
 
int getDualPopupWidth () const
 
- Public Member Functions inherited from SynthButton::ButtonListener
virtual ~ButtonListener ()
 Virtual destructor.
 
- Public Member Functions inherited from WavetablePlayhead::Listener
virtual ~Listener ()
 
- Public Member Functions inherited from WavetableOrganizer::Listener
virtual ~Listener ()
 
virtual void positionsUpdated ()
 Called when keyframe positions or arrangement changes.
 
virtual void wheelMoved (const MouseEvent &e, const MouseWheelDetails &wheel)
 Called when the mouse wheel is moved over the organizer.
 
- Public Member Functions inherited from WaveSourceEditor::Listener
virtual ~Listener ()
 
- Public Member Functions inherited from BarEditor::Listener
virtual ~Listener ()
 

Static Public Attributes

static constexpr int kDefaultXGrid = 6
 Default number of horizontal grid divisions.
 
static constexpr int kDefaultYGrid = 4
 Default number of vertical grid divisions.
 
static constexpr float kDefaultPhase = -0.5f
 Default phase value for frequency phase editor.
 
static constexpr float kBarAlpha = 0.75f
 Default alpha value for bars in BarEditor components.
 
- Static Public Attributes inherited from WavetableComponentOverlay
static constexpr int kMaxGrid = 16
 Maximum grid lines used by some overlays.
 
static constexpr float kTitleHeightForWidth = 0.1f
 Ratio constants for layout and sizing.
 
static constexpr float kWidgetHeightForWidth = 0.08f
 
static constexpr float kShadowPercent = 0.1f
 
static constexpr float kDividerPoint = 0.44f
 
static constexpr float kTitleHeightRatio = 0.4f
 
- Static Public Attributes inherited from SynthSection
static constexpr int kDefaultPowerButtonOffset = 0
 
static constexpr float kPowerButtonPaddingPercent = 0.29f
 
static constexpr float kTransposeHeightPercent = 0.5f
 
static constexpr float kTuneHeightPercent = 0.4f
 
static constexpr float kJointModulationRadiusPercent = 0.1f
 
static constexpr float kJointModulationExtensionPercent = 0.6666f
 
static constexpr float kPitchLabelPercent = 0.33f
 
static constexpr float kJointLabelHeightPercent = 0.4f
 
static constexpr double kTransposeMouseSensitivity = 0.2
 
static constexpr float kJointLabelBorderRatioX = 0.05f
 
static constexpr int kDefaultBodyRounding = 4
 
static constexpr int kDefaultLabelHeight = 10
 
static constexpr int kDefaultLabelBackgroundHeight = 16
 
static constexpr int kDefaultLabelBackgroundWidth = 56
 
static constexpr int kDefaultLabelBackgroundRounding = 4
 
static constexpr int kDefaultPadding = 2
 
static constexpr int kDefaultPopupMenuWidth = 150
 
static constexpr int kDefaultDualPopupMenuWidth = 340
 
static constexpr int kDefaultStandardKnobSize = 32
 
static constexpr int kDefaultKnobThickness = 2
 
static constexpr float kDefaultKnobModulationAmountThickness = 2.0f
 
static constexpr int kDefaultKnobModulationMeterSize = 43
 
static constexpr int kDefaultKnobModulationMeterThickness = 4
 
static constexpr int kDefaultModulationButtonWidth = 64
 
static constexpr int kDefaultModFontSize = 10
 
static constexpr int kDefaultKnobSectionHeight = 64
 
static constexpr int kDefaultSliderWidth = 24
 
static constexpr int kDefaultTextWidth = 80
 
static constexpr int kDefaultTextHeight = 24
 
static constexpr int kDefaultWidgetMargin = 6
 
static constexpr float kDefaultWidgetFillFade = 0.3f
 
static constexpr float kDefaultWidgetLineWidth = 4.0f
 
static constexpr float kDefaultWidgetFillCenter = 0.0f
 

Protected Attributes

WaveSourcewave_source_
 Pointer to the WaveSource being edited.
 
vital::WaveFramecurrent_frame_
 Pointer to the currently selected WaveFrame in the WaveSource.
 
std::unique_ptr< WaveSourceEditoroscillator_
 Editor for time-domain waveforms.
 
std::unique_ptr< BarEditorfrequency_amplitudes_
 BarEditor for frequency amplitudes.
 
std::unique_ptr< BarEditorfrequency_phases_
 BarEditor for frequency phases.
 
std::unique_ptr< TextSelectorinterpolation_type_
 TextSelector for choosing interpolation style and mode.
 
std::unique_ptr< SynthSliderhorizontal_grid_
 SynthSlider for the number of horizontal grid lines in the WaveSourceEditor.
 
std::unique_ptr< SynthSlidervertical_grid_
 SynthSlider for the number of vertical grid lines in the WaveSourceEditor.
 
std::unique_ptr< Component > horizontal_incrementers_
 Incrementer button set for horizontal grid adjustments.
 
std::unique_ptr< Component > vertical_incrementers_
 Incrementer button set for vertical grid adjustments.
 
std::unique_ptr< Slider > interpolation_selector_
 (Unused) Slider for interpolation selection in other contexts.
 
- Protected Attributes inherited from WavetableComponentOverlay
WavetableComponentcurrent_component_
 
ControlsBackground controls_background_
 
std::vector< Listener * > listeners_
 
Rectangle< int > edit_bounds_
 
int controls_width_
 
bool initialized_
 
int padding_
 
- Protected Attributes inherited from SynthSection
std::map< Skin::ValueId, float > value_lookup_
 
std::vector< SynthSection * > sub_sections_
 
std::vector< OpenGlComponent * > open_gl_components_
 
std::map< std::string, SynthSlider * > slider_lookup_
 
std::map< std::string, Button * > button_lookup_
 
std::map< std::string, ModulationButton * > modulation_buttons_
 
std::map< std::string, SynthSlider * > all_sliders_
 
std::map< std::string, ToggleButton * > all_buttons_
 
std::map< std::string, ModulationButton * > all_modulation_buttons_
 
const SynthSectionparent_
 
SynthButtonactivator_
 
PresetSelectorpreset_selector_
 
bool preset_selector_half_width_
 
std::unique_ptr< OffOverlayoff_overlay_
 
Skin::SectionOverride skin_override_
 
float size_ratio_
 
bool active_
 
bool sideways_heading_
 

Additional Inherited Members

- Protected Member Functions inherited from WavetableComponentOverlay
void setControlsWidth (int width)
 Sets the total width for controls in the overlay.
 
void notifyChanged (bool mouse_up)
 Notifies listeners that a change has occurred to the frame.
 
float getTitleHeight ()
 Gets the title height based on ratio and current edit bounds.
 
int getDividerX ()
 Gets the x position of a divider line.
 
int getWidgetHeight ()
 Gets the widget height for controls.
 
int getWidgetPadding ()
 Gets the widget padding.
 
- Protected Member Functions inherited from SynthSection
void setSliderHasHzAlternateDisplay (SynthSlider *slider)
 
void setSidewaysHeading (bool sideways)
 
void addToggleButton (ToggleButton *button, bool show)
 
void addButton (OpenGlToggleButton *button, bool show=true)
 
void addButton (OpenGlShapeButton *button, bool show=true)
 
void addSlider (SynthSlider *slider, bool show=true, bool listen=true)
 
void addOpenGlComponent (OpenGlComponent *open_gl_component, bool to_beginning=false)
 
void setActivator (SynthButton *activator)
 
void createOffOverlay ()
 
void setPresetSelector (PresetSelector *preset_selector, bool half=false)
 
void paintJointControlSliderBackground (Graphics &g, int x, int y, int width, int height)
 
void paintJointControlBackground (Graphics &g, int x, int y, int width, int height)
 
void paintJointControl (Graphics &g, int x, int y, int width, int height, const std::string &name)
 
void placeJointControls (int x, int y, int width, int height, SynthSlider *left, SynthSlider *right, Component *widget=nullptr)
 
void placeTempoControls (int x, int y, int width, int height, SynthSlider *tempo, SynthSlider *sync)
 
void placeRotaryOption (Component *option, SynthSlider *rotary)
 
void placeKnobsInArea (Rectangle< int > area, std::vector< Component * > knobs)
 
void lockCriticalSection ()
 
void unlockCriticalSection ()
 
Rectangle< int > getPresetBrowserBounds ()
 
int getTitleTextRight ()
 
Rectangle< int > getPowerButtonBounds ()
 
Rectangle< int > getTitleBounds ()
 
float getDisplayScale () const
 
virtual int getPixelMultiple () const
 

Detailed Description

Provides an overlay for editing WaveSource objects in the Wavetable component.

The WaveSourceOverlay is responsible for handling graphical user interface elements that allow users to edit a WaveSource (time-domain waveform, frequency amplitudes, and phases). It integrates with various editors (WaveSourceEditor, BarEditor) to facilitate editing both the time-domain data and the frequency-domain data.

Constructor & Destructor Documentation

◆ WaveSourceOverlay()

WaveSourceOverlay::WaveSourceOverlay ( )

Constructs a new WaveSourceOverlay.

Initializes various editors (time-domain, frequency amplitude, frequency phase) and controls (sliders, incrementers, etc.) for modifying the wave source data.

Initializes the GUI components (time-domain editor, frequency amplitude editor, frequency phase editor, interpolation controls, grid controls) and sets their default parameters and visibility states.

Member Function Documentation

◆ barsChanged()

void WaveSourceOverlay::barsChanged ( int start,
int end,
bool mouse_up )
overridevirtual

Called when values in the BarEditor are changed.

Called when values in the BarEditor components change.

Updates the frequency-domain data, recalculates the time-domain waveform, and reloads the editor.

Parameters
startThe start index of changed data.
endThe end index of changed data.
mouse_upIndicates whether the mouse button is released after changing values.

Reloads the frequency-domain data into the current frame and updates the time-domain editor with the new waveform.

Parameters
startThe starting index of the modified region.
endThe ending index of the modified region.
mouse_upIndicates if this change was triggered upon mouse release.

Implements BarEditor::Listener.

◆ frameDragged()

virtual void WaveSourceOverlay::frameDragged ( WavetableKeyframe * keyframe,
int position )
inlineoverridevirtual

Called when a keyframe is dragged within the Wavetable.

This override does nothing for the WaveSourceOverlay.

Parameters
keyframePointer to the dragged WavetableKeyframe.
positionThe new position of the keyframe.

Implements WavetableOrganizer::Listener.

◆ frameSelected()

void WaveSourceOverlay::frameSelected ( WavetableKeyframe * keyframe)
overridevirtual

Called when a keyframe is selected within the Wavetable.

Callback when a specific WavetableKeyframe is selected.

If the selected keyframe belongs to this overlay's WaveSource, the overlay's editors become visible and load the current frame data.

Parameters
keyframePointer to the selected WavetableKeyframe.

If the keyframe belongs to this overlay's WaveSource, enables editing by loading the WaveFrame data into the editors.

Parameters
keyframePointer to the selected keyframe.

Implements WavetableOrganizer::Listener.

◆ loadFrequencyDomain()

void WaveSourceOverlay::loadFrequencyDomain ( )

Loads frequency-domain data from the editors back into the current frame.

Loads frequency-domain data from the BarEditor components back into the current frame.

Converts the updated frequency-domain data into the time-domain, normalizes, then back to frequency-domain.

Converts updated amplitude and phase data to std::complex<float>, updates the WaveFrame, and converts back and forth between time and frequency domains to apply the changes.

◆ resized()

void WaveSourceOverlay::resized ( )
overridevirtual

Called when the component is resized.

Called when the WaveSourceOverlay is resized.

Updates the layout and colors for the internal sub-components.

Updates the layout of internal editors and sets colors based on the current skin.

Reimplemented from SynthSection.

◆ setEditBounds()

void WaveSourceOverlay::setEditBounds ( Rectangle< int > bounds)
overridevirtual

Sets the bounds for the editable region of this overlay.

Sets the bounds for the overlay’s editable area and positions sub-controls.

Parameters
boundsThe bounding rectangle for the overlay’s controls.

This method computes appropriate sizing for the interpolation selector, grid sliders, and incrementer buttons.

Parameters
boundsThe bounding rectangle where controls should be placed.

Reimplemented from WavetableComponentOverlay.

◆ setFrequencyAmplitudeBounds()

bool WaveSourceOverlay::setFrequencyAmplitudeBounds ( Rectangle< int > bounds)
overridevirtual

Sets the bounds for the frequency amplitude editor.

Parameters
boundsThe bounding rectangle for the frequency amplitude editor.
Returns
True if successfully set.

Reimplemented from WavetableComponentOverlay.

◆ setFrequencyZoom()

void WaveSourceOverlay::setFrequencyZoom ( float zoom)
inlineoverridevirtual

Sets the zoom level for frequency-domain editors.

Parameters
zoomThe new zoom level.

Reimplemented from WavetableComponentOverlay.

◆ setInterpolationType()

void WaveSourceOverlay::setInterpolationType ( WaveSource::InterpolationStyle style,
WaveSource::InterpolationMode mode )

Sets the interpolation type for the WaveSource.

Sets the interpolation type on the associated WaveSource.

Parameters
styleThe interpolation style.
modeThe interpolation mode (time or spectral).

Converts the style and mode into the appropriate slider value for the interpolation selector.

Parameters
styleThe desired interpolation style.
modeThe desired interpolation mode.

◆ setPhaseBounds()

bool WaveSourceOverlay::setPhaseBounds ( Rectangle< int > bounds)
overridevirtual

Sets the bounds for the frequency phase editor.

Parameters
boundsThe bounding rectangle for the frequency phase editor.
Returns
True if successfully set.

Reimplemented from WavetableComponentOverlay.

◆ setPowerScale()

void WaveSourceOverlay::setPowerScale ( bool scale)
inlineoverridevirtual

Enables or disables power scaling for the frequency amplitude editor.

Parameters
scaleIf true, the frequency amplitudes will be power-scaled.

Reimplemented from WavetableComponentOverlay.

◆ setTimeDomainBounds()

bool WaveSourceOverlay::setTimeDomainBounds ( Rectangle< int > bounds)
overridevirtual

Sets the bounds for the time-domain editor.

Parameters
boundsThe bounding rectangle for the time-domain editor.
Returns
True if successfully set.

Reimplemented from WavetableComponentOverlay.

◆ setWaveSource()

void WaveSourceOverlay::setWaveSource ( WaveSource * wave_source)
inline

Assigns a WaveSource to this overlay.

Parameters
wave_sourcePointer to the WaveSource to edit.

◆ sliderValueChanged()

void WaveSourceOverlay::sliderValueChanged ( Slider * moved_slider)
overridevirtual

Called when a slider changes value.

Used to handle changes in grid size and interpolation type.

Parameters
moved_sliderPointer to the slider that has changed.

Handles changes in grid sliders and interpolation type.

Parameters
moved_sliderThe slider that changed.

Reimplemented from SynthSection.

◆ updateFrequencyDomain()

void WaveSourceOverlay::updateFrequencyDomain ( std::complex< float > * frequency_domain)

Updates the frequency-domain editors with new data.

Updates the frequency-domain editors with the given complex data.

Populates frequency amplitude and phase editors from a complex float array.

Parameters
frequency_domainPointer to the frequency-domain array of std::complex<float>.

Computes amplitude and phase for each frequency bin, adjusting amplitudes to fit the editor's scale and normalizing phase values between 0 and 1.

Parameters
frequency_domainPointer to an array of std::complex<float>.

◆ valuesChanged()

void WaveSourceOverlay::valuesChanged ( int start,
int end,
bool mouse_up )
overridevirtual

Called when values in the WaveSourceEditor are changed.

Called when time-domain values in the WaveSourceEditor change.

Updates the time-domain data in the current frame and recalculates frequency-domain data.

Parameters
startThe start index of changed data.
endThe end index of changed data.
mouse_upIndicates whether the mouse button is released after changing values.

Updates the WaveFrame’s time-domain data and recalculates the frequency-domain data.

Parameters
startThe starting index of the modified region.
endThe ending index of the modified region.
mouse_upIndicates if this change was triggered upon mouse release.

Implements WaveSourceEditor::Listener.

Member Data Documentation

◆ current_frame_

vital::WaveFrame* WaveSourceOverlay::current_frame_
protected

Pointer to the currently selected WaveFrame in the WaveSource.

◆ frequency_amplitudes_

std::unique_ptr<BarEditor> WaveSourceOverlay::frequency_amplitudes_
protected

BarEditor for frequency amplitudes.

◆ frequency_phases_

std::unique_ptr<BarEditor> WaveSourceOverlay::frequency_phases_
protected

BarEditor for frequency phases.

◆ horizontal_grid_

std::unique_ptr<SynthSlider> WaveSourceOverlay::horizontal_grid_
protected

SynthSlider for the number of horizontal grid lines in the WaveSourceEditor.

◆ horizontal_incrementers_

std::unique_ptr<Component> WaveSourceOverlay::horizontal_incrementers_
protected

Incrementer button set for horizontal grid adjustments.

◆ interpolation_selector_

std::unique_ptr<Slider> WaveSourceOverlay::interpolation_selector_
protected

(Unused) Slider for interpolation selection in other contexts.

◆ interpolation_type_

std::unique_ptr<TextSelector> WaveSourceOverlay::interpolation_type_
protected

TextSelector for choosing interpolation style and mode.

◆ kBarAlpha

float WaveSourceOverlay::kBarAlpha = 0.75f
staticconstexpr

Default alpha value for bars in BarEditor components.

◆ kDefaultPhase

float WaveSourceOverlay::kDefaultPhase = -0.5f
staticconstexpr

Default phase value for frequency phase editor.

A negative phase indicates a shift in the waveform’s starting angle.

◆ kDefaultXGrid

int WaveSourceOverlay::kDefaultXGrid = 6
staticconstexpr

Default number of horizontal grid divisions.

◆ kDefaultYGrid

int WaveSourceOverlay::kDefaultYGrid = 4
staticconstexpr

Default number of vertical grid divisions.

◆ oscillator_

std::unique_ptr<WaveSourceEditor> WaveSourceOverlay::oscillator_
protected

Editor for time-domain waveforms.

◆ vertical_grid_

std::unique_ptr<SynthSlider> WaveSourceOverlay::vertical_grid_
protected

SynthSlider for the number of vertical grid lines in the WaveSourceEditor.

◆ vertical_incrementers_

std::unique_ptr<Component> WaveSourceOverlay::vertical_incrementers_
protected

Incrementer button set for vertical grid adjustments.

◆ wave_source_

WaveSource* WaveSourceOverlay::wave_source_
protected

Pointer to the WaveSource being edited.


The documentation for this class was generated from the following files: