A keyframe class holding parameters for phase modification at a given position.
Definition phase_modifier.h:41
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 jsonToState(json data) override
Restores the keyframe's state from a JSON object.
Definition phase_modifier.cpp:95
void copy(const WavetableKeyframe *keyframe) override
Copies the state from another keyframe of the same type.
Definition phase_modifier.cpp:27
PhaseModifierKeyframe()
Constructs a keyframe with default phase and mix values.
Definition phase_modifier.cpp:25
PhaseStyle phase_style_
Selected phase modification style.
Definition phase_modifier.h:94
json stateToJson() override
Serializes the state of this keyframe to a JSON object.
Definition phase_modifier.cpp:88
virtual ~PhaseModifierKeyframe()
Definition phase_modifier.h:47
void setPhase(float phase)
Sets the phase offset (in radians).
Definition phase_modifier.h:75
void interpolate(const WavetableKeyframe *from_keyframe, const WavetableKeyframe *to_keyframe, float t) override
Linearly interpolates between two keyframes.
Definition phase_modifier.cpp:33
void setPhaseStyle(PhaseStyle style)
Sets the phase modification style.
Definition phase_modifier.h:89
void render(vital::WaveFrame *wave_frame) override
Renders the waveform of this keyframe into a WaveFrame.
Definition phase_modifier.cpp:43
float phase_
The phase offset in radians.
Definition phase_modifier.h:92
float mix_
The blend between original and modified harmonic phases.
Definition phase_modifier.h:93
A WavetableComponent that modifies the phase of frequency components in a wavetable frame.
Definition phase_modifier.h:19
PhaseModifier()
Constructs a PhaseModifier with a default normal phase style.
Definition phase_modifier.h:102
PhaseStyle phase_style_
The selected style of phase modification.
Definition phase_modifier.h:135
virtual WavetableKeyframe * createKeyframe(int position) override
Creates a new keyframe at a given position.
Definition phase_modifier.cpp:101
virtual WavetableComponentFactory::ComponentType getType() override
Returns the type of this WavetableComponent.
Definition phase_modifier.cpp:113
virtual ~PhaseModifier()=default
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
PhaseModifierKeyframe compute_frame_
A keyframe for intermediate computation.
Definition phase_modifier.h:134
virtual void render(vital::WaveFrame *wave_frame, float position) override
Renders the waveform at a given position into a WaveFrame.
Definition phase_modifier.cpp:107
virtual json stateToJson() override
Serializes the component’s state and all keyframes to a JSON object.
Definition phase_modifier.cpp:117
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
@ kClear
Clear phase information, making all harmonics in phase.
Definition phase_modifier.h:30
@ kNumPhaseStyles
Definition phase_modifier.h:31
@ kHarmonicEvenOdd
Apply a harmonic-based shift with separate handling of even/odd harmonics.
Definition phase_modifier.h:29
@ kNormal
Apply a harmonic phase shift cumulatively up the harmonic series.
Definition phase_modifier.h:26
@ kEvenOdd
Apply different phase treatments to even and odd harmonics.
Definition phase_modifier.h:27
@ kHarmonic
Uniformly shift phase for all harmonics directly.
Definition phase_modifier.h:28
virtual void jsonToState(json data) override
Restores the component’s state from a JSON object.
Definition phase_modifier.cpp:123
ComponentType
Enumerates all known WavetableComponents, including sources and modifiers.
Definition wavetable_component_factory.h:28
A base class representing a component in a wavetable synthesis chain.
Definition wavetable_component.h:32
Represents a single state of a waveform at a specific position in a wavetable.
Definition wavetable_keyframe.h:35
Represents a single frame of a wavetable, containing both time-domain and frequency-domain data.
Definition wave_frame.h:16
nlohmann::json json
Definition line_generator.h:7