11 constexpr int kNumInterpolationTypes = 5;
13 const std::string interpolation_types[kNumInterpolationTypes] = {
17 "Smooth Waveform Blend",
18 "Smooth Spectral Blend",
35 oscillator_ = std::make_unique<WaveSourceEditor>(waveform_size);
73 horizontal_grid_ = std::make_unique<SynthSlider>(
"wave_source_horizontal_grid");
89 vertical_grid_ = std::make_unique<SynthSlider>(
"wave_source_vertical_grid");
98 vertical_grid_->setSliderStyle(Slider::RotaryHorizontalVerticalDrag);
118 if (findParentComponentOfClass<SynthGuiInterface>() ==
nullptr)
125 oscillator_->setFillColors(fill_color2, fill_color1);
141 if (keyframe ==
nullptr) {
166 static constexpr float kInterpolationWidthHeightRatio = 8.0f;
167 static constexpr float kGridWidthHeightRatio = 2.0f;
170 int interpolation_width = bounds.getHeight() * kInterpolationWidthHeightRatio;
171 int grid_width = bounds.getHeight() * kGridWidthHeightRatio;
172 int total_width = interpolation_width + 2 * grid_width + 2 * padding;
176 int x = bounds.getX() + (bounds.getWidth() - total_width) / 2;
178 int y = bounds.getY();
179 int y_title = y + title_height;
180 int height = bounds.getHeight();
181 int height_title = height - title_height;
242 std::complex<float> frequency = frequency_domain[i];
243 float amplitude = std::abs(frequency);
265 std::complex<float> value = std::polar(amplitude, phase);
287 for (
int i = start; i <= end; ++i)
@ kWidgetFillFade
Definition skin.h:108
@ kWidgetPrimary1
Definition skin.h:165
@ kWidgetSecondary1
Definition skin.h:168
@ kWidgetSecondary2
Definition skin.h:169
void addSlider(SynthSlider *slider, bool show=true, bool listen=true)
Definition synth_section.cpp:445
virtual void resized() override
Called when the component is resized. Arranges layout of child components.
Definition synth_section.cpp:35
float findValue(Skin::ValueId value_id) const
Finds a value in the skin overrides or from the parent if not found locally.
Definition synth_section.cpp:18
void addOpenGlComponent(OpenGlComponent *open_gl_component, bool to_beginning=false)
Definition synth_section.cpp:489
static TextLookAndFeel * instance()
Singleton instance access.
Definition text_look_and_feel.h:106
void setInterpolationMode(InterpolationMode mode)
Sets the interpolation mode for morphing between keyframes.
Definition wave_source.h:69
vital::WaveFrame * getWaveFrame(int index)
Gets a WaveFrame from a specified keyframe index.
Definition wave_source.cpp:47
InterpolationMode
Defines how keyframes should be interpolated.
Definition wave_source.h:31
@ kTime
Interpolate directly in time domain.
Definition wave_source.h:32
void loadFrequencyDomain()
Loads frequency-domain data from the editors back into the current frame.
Definition wave_source_overlay.cpp:260
std::unique_ptr< SynthSlider > horizontal_grid_
SynthSlider for the number of horizontal grid lines in the WaveSourceEditor.
Definition wave_source_overlay.h:232
void updateFrequencyDomain(std::complex< float > *frequency_domain)
Updates the frequency-domain editors with new data.
Definition wave_source_overlay.cpp:240
std::unique_ptr< BarEditor > frequency_phases_
BarEditor for frequency phases.
Definition wave_source_overlay.h:222
static constexpr int kDefaultYGrid
Default number of vertical grid divisions.
Definition wave_source_overlay.h:34
virtual bool setFrequencyAmplitudeBounds(Rectangle< int > bounds) override
Sets the bounds for the frequency amplitude editor.
Definition wave_source_overlay.cpp:216
vital::WaveFrame * current_frame_
Pointer to the currently selected WaveFrame in the WaveSource.
Definition wave_source_overlay.h:207
virtual bool setTimeDomainBounds(Rectangle< int > bounds) override
Sets the bounds for the time-domain editor.
Definition wave_source_overlay.cpp:205
void barsChanged(int start, int end, bool mouse_up) override
Called when values in the BarEditor are changed.
Definition wave_source_overlay.cpp:354
WaveSource * wave_source_
Pointer to the WaveSource being edited.
Definition wave_source_overlay.h:202
void valuesChanged(int start, int end, bool mouse_up) override
Called when values in the WaveSourceEditor are changed.
Definition wave_source_overlay.cpp:283
std::unique_ptr< Component > vertical_incrementers_
Incrementer button set for vertical grid adjustments.
Definition wave_source_overlay.h:247
std::unique_ptr< TextSelector > interpolation_type_
TextSelector for choosing interpolation style and mode.
Definition wave_source_overlay.h:227
static constexpr float kDefaultPhase
Default phase value for frequency phase editor.
Definition wave_source_overlay.h:41
void resized() override
Called when the component is resized.
Definition wave_source_overlay.cpp:116
std::unique_ptr< Component > horizontal_incrementers_
Incrementer button set for horizontal grid adjustments.
Definition wave_source_overlay.h:242
virtual bool setPhaseBounds(Rectangle< int > bounds) override
Sets the bounds for the frequency phase editor.
Definition wave_source_overlay.cpp:227
std::unique_ptr< BarEditor > frequency_amplitudes_
BarEditor for frequency amplitudes.
Definition wave_source_overlay.h:217
static constexpr int kDefaultXGrid
Default number of horizontal grid divisions.
Definition wave_source_overlay.h:29
virtual void frameSelected(WavetableKeyframe *keyframe) override
Called when a keyframe is selected within the Wavetable.
Definition wave_source_overlay.cpp:140
WaveSourceOverlay()
Constructs a new WaveSourceOverlay.
Definition wave_source_overlay.cpp:30
void setInterpolationType(WaveSource::InterpolationStyle style, WaveSource::InterpolationMode mode)
Sets the interpolation type for the WaveSource.
Definition wave_source_overlay.cpp:336
virtual void setEditBounds(Rectangle< int > bounds) override
Sets the bounds for the editable region of this overlay.
Definition wave_source_overlay.cpp:165
void sliderValueChanged(Slider *moved_slider) override
Called when a slider changes value.
Definition wave_source_overlay.cpp:303
std::unique_ptr< WaveSourceEditor > oscillator_
Editor for time-domain waveforms.
Definition wave_source_overlay.h:212
std::unique_ptr< SynthSlider > vertical_grid_
SynthSlider for the number of vertical grid lines in the WaveSourceEditor.
Definition wave_source_overlay.h:237
InterpolationStyle
Defines how interpolation is performed between keyframes.
Definition wavetable_component.h:38
@ kNone
No interpolation, just jumps between keyframes.
Definition wavetable_component.h:39
void setInterpolationStyle(InterpolationStyle type)
Sets the global interpolation style.
Definition wavetable_component.h:209
void addTitle(const std::string &title)
Adds a title string for the next control section.
Definition wavetable_component_overlay.h:94
void addLine(int position)
Adds a vertical line divider at the given position.
Definition wavetable_component_overlay.h:88
void clearTitles()
Clears all control section titles.
Definition wavetable_component_overlay.h:82
void clearLines()
Clears all line divider positions.
Definition wavetable_component_overlay.h:77
A base overlay component for editing and interacting with a wavetable component's parameters.
Definition wavetable_component_overlay.h:22
void setControlsWidth(int width)
Sets the total width for controls in the overlay.
Definition wavetable_component_overlay.h:267
ControlsBackground controls_background_
Definition wavetable_component_overlay.h:300
virtual void setEditBounds(Rectangle< int > bounds)
Sets the editing bounds within which controls and titles are placed.
Definition wavetable_component_overlay.cpp:67
static constexpr float kTitleHeightRatio
Definition wavetable_component_overlay.h:32
int getPadding()
Gets the current padding value.
Definition wavetable_component_overlay.h:248
static constexpr int kMaxGrid
Maximum grid lines used by some overlays.
Definition wavetable_component_overlay.h:25
void notifyChanged(bool mouse_up)
Notifies listeners that a change has occurred to the frame.
Definition wavetable_component_overlay.cpp:86
Represents a single state of a waveform at a specific position in a wavetable.
Definition wavetable_keyframe.h:35
int index()
Gets the index of this keyframe within its owner component.
Definition wavetable_keyframe.cpp:32
WavetableComponent * owner()
Gets the WavetableComponent that owns this keyframe.
Definition wavetable_keyframe.h:152
std::complex< float > frequency_domain[kWaveformSize]
The frequency-domain representation (complex spectrum).
Definition wave_frame.h:125
void toFrequencyDomain()
Converts the currently loaded time-domain data into frequency-domain representation.
Definition wave_frame.cpp:64
static constexpr int kWaveformSize
The size of the waveform (number of samples per frame).
Definition wave_frame.h:21
mono_float time_domain[2 *kWaveformSize]
The time-domain data, extended buffer size for FFT alignment.
Definition wave_frame.h:124
void toTimeDomain()
Converts the currently loaded frequency-domain data into time-domain representation.
Definition wave_frame.cpp:77
static constexpr int kNumRealComplex
The number of real-valued frequency components (half the size + 1).
Definition wave_frame.h:23
void normalize(bool allow_positive_gain=false)
Normalizes the time-domain waveform samples to have a maximum absolute value of 1....
Definition wave_frame.cpp:38
constexpr mono_float kPi
Pi constant.
Definition common.h:36
Declares the TextSelector class and PaintPatternSelector class for selecting text-based options and d...