22 editor_ = std::make_unique<PhaseEditor>();
27 slider_ = std::make_unique<PhaseEditor>();
30 slider_->setMaxTickHeight(1.0f);
40 phase_style_ = std::make_unique<TextSelector>(
"Harmonic Phase");
49 phase_style_->setSliderStyle(Slider::RotaryHorizontalVerticalDrag);
51 mix_ = std::make_unique<SynthSlider>(
"Phase Mix");
53 mix_->setAlwaysOnTop(
true);
54 mix_->getQuadComponent()->setAlwaysOnTop(
true);
55 mix_->setRange(0.0, 1.0);
56 mix_->setDoubleClickReturnValue(
true, 1.0);
57 mix_->addListener(
this);
58 mix_->setSliderStyle(Slider::LinearBar);
67 if (keyframe ==
nullptr) {
85 static constexpr float kPhaseStyleWidthHeightRatio = 4.0f;
86 static constexpr float kPhaseWidthHeightRatio = 8.0f;
87 static constexpr float kMixWidthHeightRatio = 5.0f;
88 static constexpr float kMixPaddingRatio = 0.5f;
91 int phase_style_width = bounds.getHeight() * kPhaseStyleWidthHeightRatio;
92 int phase_width = bounds.getHeight() * kPhaseWidthHeightRatio;
93 int mix_width = bounds.getHeight() * kMixWidthHeightRatio;
94 int mix_padding = bounds.getHeight() * kMixPaddingRatio;
95 int total_width = phase_style_width + phase_width + mix_width + 2 * padding;
99 int x = bounds.getX() + (bounds.getWidth() - total_width) / 2;
101 int y = bounds.getY();
102 int y_title = y + title_height;
103 int height = bounds.getHeight();
104 int height_title = height - title_height;
107 phase_style_->setBounds(x, y_title, phase_style_width, height_title);
109 mix_->setBounds(
slider_->getRight() + padding + mix_padding, y_title, mix_width - 2 * mix_padding, height_title);
157 else if (moved_slider ==
mix_.get()) {
float getMix()
Gets the mix ratio blending between original and modified phases.
Definition phase_modifier.h:68
void setMix(float mix)
Sets the mix ratio.
Definition phase_modifier.h:82
float getPhase()
Gets the phase offset applied to harmonics.
Definition phase_modifier.h:61
void setPhase(float phase)
Sets the phase offset (in radians).
Definition phase_modifier.h:75
PhaseStyle getPhaseStyle() const
Gets the current phase modification style.
Definition phase_modifier.h:131
PhaseModifierKeyframe * getKeyframe(int index)
Retrieves a PhaseModifierKeyframe by index.
Definition phase_modifier.cpp:128
void setPhaseStyle(PhaseStyle style)
Sets the style of phase modification.
Definition phase_modifier.h:124
PhaseStyle
Various methods to modify harmonic phase.
Definition phase_modifier.h:25
@ kNumPhaseStyles
Definition phase_modifier.h:31
PhaseModifier * phase_modifier_
The assigned PhaseModifier.
Definition phase_modifier_overlay.h:120
void sliderDragEnded(Slider *moved_slider) override
Called when a slider drag operation ends.
Definition phase_modifier_overlay.cpp:166
std::unique_ptr< TextSelector > phase_style_
Selector for phase style.
Definition phase_modifier_overlay.h:125
virtual void frameSelected(WavetableKeyframe *keyframe) override
Called when a new frame is selected.
Definition phase_modifier_overlay.cpp:66
std::unique_ptr< SynthSlider > mix_
Slider for phase mix amount.
Definition phase_modifier_overlay.h:126
void phaseChanged(float phase, bool mouse_up) override
Callback from PhaseEditor when the phase has changed.
Definition phase_modifier_overlay.cpp:136
virtual bool setTimeDomainBounds(Rectangle< int > bounds) override
Set the bounds for the time-domain waveform display area.
Definition phase_modifier_overlay.cpp:119
PhaseModifier::PhaseModifierKeyframe * current_frame_
Currently selected frame from the PhaseModifier.
Definition phase_modifier_overlay.h:121
std::unique_ptr< TextEditor > phase_text_
Text editor for manual phase input.
Definition phase_modifier_overlay.h:124
void sliderValueChanged(Slider *moved_slider) override
Called when a slider value changes.
Definition phase_modifier_overlay.cpp:148
virtual void textEditorFocusLost(TextEditor &text_editor) override
Called when the phase text editor loses focus.
Definition phase_modifier_overlay.cpp:131
void setPhase(String phase_string)
Sets the phase from a text string (in degrees).
Definition phase_modifier_overlay.cpp:170
std::unique_ptr< PhaseEditor > editor_
Interactive phase editor.
Definition phase_modifier_overlay.h:122
virtual void textEditorReturnKeyPressed(TextEditor &text_editor) override
Called when the user presses 'Enter' in the phase text editor.
Definition phase_modifier_overlay.cpp:126
virtual void setEditBounds(Rectangle< int > bounds) override
Set the bounds of editing controls within the overlay.
Definition phase_modifier_overlay.cpp:82
std::unique_ptr< PhaseEditor > slider_
Phase editor used as a reference slider line.
Definition phase_modifier_overlay.h:123
PhaseModifierOverlay()
Constructor.
Definition phase_modifier_overlay.cpp:18
@ kLightenScreen
Definition skin.h:141
void addSlider(SynthSlider *slider, bool show=true, bool listen=true)
Definition synth_section.cpp:445
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 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
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
constexpr int kDegreesPerCycle
Degrees in a full rotation (for LFO phases).
Definition common.h:49
constexpr mono_float kPi
Pi constant.
Definition common.h:36