Vital
Loading...
Searching...
No Matches
PhaseModifier::PhaseModifierKeyframe Class Reference

A keyframe class holding parameters for phase modification at a given position. More...

#include <phase_modifier.h>

Inheritance diagram for PhaseModifier::PhaseModifierKeyframe:
WavetableKeyframe

Public Member Functions

 PhaseModifierKeyframe ()
 Constructs a keyframe with default phase and mix values.
 
virtual ~PhaseModifierKeyframe ()
 
void copy (const WavetableKeyframe *keyframe) override
 Copies the state from another keyframe of the same type.
 
void interpolate (const WavetableKeyframe *from_keyframe, const WavetableKeyframe *to_keyframe, float t) override
 Linearly interpolates between two keyframes.
 
void render (vital::WaveFrame *wave_frame) override
 Renders the waveform of this keyframe into a WaveFrame.
 
json stateToJson () override
 Serializes the state of this keyframe to a JSON object.
 
void jsonToState (json data) override
 Restores the keyframe's state from a JSON object.
 
float getPhase ()
 Gets the phase offset applied to harmonics.
 
float getMix ()
 Gets the mix ratio blending between original and modified phases.
 
void setPhase (float phase)
 Sets the phase offset (in radians).
 
void setMix (float mix)
 Sets the mix ratio.
 
void setPhaseStyle (PhaseStyle style)
 Sets the phase modification style.
 
- Public Member Functions inherited from WavetableKeyframe
 WavetableKeyframe ()
 Constructs a WavetableKeyframe with a default position of 0 and no owner.
 
virtual ~WavetableKeyframe ()
 
int index ()
 Gets the index of this keyframe within its owner component.
 
int position () const
 Gets the wavetable frame position of this keyframe.
 
void setPosition (int position)
 Sets the frame position of this keyframe.
 
virtual void smoothInterpolate (const WavetableKeyframe *prev_keyframe, const WavetableKeyframe *from_keyframe, const WavetableKeyframe *to_keyframe, const WavetableKeyframe *next_keyframe, float t)
 Performs a smooth (cubic) interpolation using four keyframes for even smoother transitions.
 
WavetableComponentowner ()
 Gets the WavetableComponent that owns this keyframe.
 
void setOwner (WavetableComponent *owner)
 Sets the owner of this keyframe.
 

Protected Attributes

float phase_
 The phase offset in radians.
 
float mix_
 The blend between original and modified harmonic phases.
 
PhaseStyle phase_style_
 Selected phase modification style.
 
- Protected Attributes inherited from WavetableKeyframe
int position_
 The position of this keyframe along the wavetable dimension.
 
WavetableComponentowner_
 The component that owns this keyframe.
 

Additional Inherited Members

- Static Public Member Functions inherited from WavetableKeyframe
static float linearTween (float point_from, float point_to, float t)
 Performs linear interpolation between two points.
 
static float cubicTween (float point_prev, float point_from, float point_to, float point_next, float range_prev, float range, float range_next, float t)
 Performs cubic interpolation taking into account a previous and next point for smoother curves.
 

Detailed Description

A keyframe class holding parameters for phase modification at a given position.

PhaseModifierKeyframe stores a phase offset and a mix amount. It can apply various phase modification styles to a WaveFrame’s frequency domain. Interpolation between keyframes allows animating phase changes over a wavetable.

Constructor & Destructor Documentation

◆ PhaseModifierKeyframe()

PhaseModifier::PhaseModifierKeyframe::PhaseModifierKeyframe ( )

Constructs a keyframe with default phase and mix values.

◆ ~PhaseModifierKeyframe()

virtual PhaseModifier::PhaseModifierKeyframe::~PhaseModifierKeyframe ( )
inlinevirtual

Member Function Documentation

◆ copy()

void PhaseModifier::PhaseModifierKeyframe::copy ( const WavetableKeyframe * keyframe)
overridevirtual

Copies the state from another keyframe of the same type.

Parameters
keyframeThe source keyframe to copy from.

Implements WavetableKeyframe.

◆ getMix()

float PhaseModifier::PhaseModifierKeyframe::getMix ( )
inline

Gets the mix ratio blending between original and modified phases.

Returns
The mix ratio (0 to 1).

◆ getPhase()

float PhaseModifier::PhaseModifierKeyframe::getPhase ( )
inline

Gets the phase offset applied to harmonics.

Returns
The phase offset in radians.

◆ interpolate()

void PhaseModifier::PhaseModifierKeyframe::interpolate ( const WavetableKeyframe * from_keyframe,
const WavetableKeyframe * to_keyframe,
float t )
overridevirtual

Linearly interpolates between two keyframes.

Parameters
from_keyframeThe starting keyframe.
to_keyframeThe ending keyframe.
tThe interpolation factor [0,1].

Implements WavetableKeyframe.

◆ jsonToState()

void PhaseModifier::PhaseModifierKeyframe::jsonToState ( json data)
overridevirtual

Restores the keyframe's state from a JSON object.

Parameters
dataThe JSON object containing the keyframe's state.

Reimplemented from WavetableKeyframe.

◆ render()

void PhaseModifier::PhaseModifierKeyframe::render ( vital::WaveFrame * wave_frame)
overridevirtual

Renders the waveform of this keyframe into a WaveFrame.

Parameters
wave_frameThe WaveFrame to fill with this keyframe's waveform data.

Implements WavetableKeyframe.

◆ setMix()

void PhaseModifier::PhaseModifierKeyframe::setMix ( float mix)
inline

Sets the mix ratio.

Parameters
mixThe blend between original and modified signal.

◆ setPhase()

void PhaseModifier::PhaseModifierKeyframe::setPhase ( float phase)
inline

Sets the phase offset (in radians).

Parameters
phaseThe new phase offset.

◆ setPhaseStyle()

void PhaseModifier::PhaseModifierKeyframe::setPhaseStyle ( PhaseStyle style)
inline

Sets the phase modification style.

Parameters
styleThe chosen PhaseStyle.

◆ stateToJson()

json PhaseModifier::PhaseModifierKeyframe::stateToJson ( )
overridevirtual

Serializes the state of this keyframe to a JSON object.

Returns
A JSON object representing the keyframe.

Reimplemented from WavetableKeyframe.

Member Data Documentation

◆ mix_

float PhaseModifier::PhaseModifierKeyframe::mix_
protected

The blend between original and modified harmonic phases.

◆ phase_

float PhaseModifier::PhaseModifierKeyframe::phase_
protected

The phase offset in radians.

◆ phase_style_

PhaseStyle PhaseModifier::PhaseModifierKeyframe::phase_style_
protected

Selected phase modification style.


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