Vital
Loading...
Searching...
No Matches
WaveWarpModifier::WaveWarpModifierKeyframe Class Reference

A keyframe class holding horizontal and vertical warp parameters at a given position. More...

#include <wave_warp_modifier.h>

Inheritance diagram for WaveWarpModifier::WaveWarpModifierKeyframe:
WavetableKeyframe

Public Member Functions

 WaveWarpModifierKeyframe ()
 Constructs a WaveWarpModifierKeyframe with default warp powers and symmetric warping.
 
virtual ~WaveWarpModifierKeyframe ()
 
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 getHorizontalPower ()
 Gets the horizontal warp power.
 
float getVerticalPower ()
 Gets the vertical warp power.
 
void setHorizontalPower (float horizontal_power)
 Sets the horizontal warp power.
 
void setVerticalPower (float vertical_power)
 Sets the vertical warp power.
 
void setHorizontalAsymmetric (bool horizontal_asymmetric)
 Sets whether horizontal warping is asymmetric.
 
void setVerticalAsymmetric (bool vertical_asymmetric)
 Sets whether vertical warping is asymmetric.
 
- 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 horizontal_power_
 Controls horizontal (time-axis) warping.
 
float vertical_power_
 Controls vertical (amplitude-axis) warping.
 
bool horizontal_asymmetric_
 If true, horizontal warping is asymmetric.
 
bool vertical_asymmetric_
 If true, vertical warping is asymmetric.
 
- 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 horizontal and vertical warp parameters at a given position.

WaveWarpModifierKeyframe stores two float parameters, horizontal_power_ and vertical_power_, which control how strongly the waveform is warped along the horizontal (time) and vertical (amplitude) axes. By interpolating between keyframes, we can smoothly transition from one warp setting to another.

Asymmetric flags allow treating the waveform differently in its positive/negative or left/right sections.

Constructor & Destructor Documentation

◆ WaveWarpModifierKeyframe()

WaveWarpModifier::WaveWarpModifierKeyframe::WaveWarpModifierKeyframe ( )

Constructs a WaveWarpModifierKeyframe with default warp powers and symmetric warping.

◆ ~WaveWarpModifierKeyframe()

virtual WaveWarpModifier::WaveWarpModifierKeyframe::~WaveWarpModifierKeyframe ( )
inlinevirtual

Member Function Documentation

◆ copy()

void WaveWarpModifier::WaveWarpModifierKeyframe::copy ( const WavetableKeyframe * keyframe)
overridevirtual

Copies the state from another keyframe of the same type.

Parameters
keyframeThe source keyframe to copy from.

Implements WavetableKeyframe.

◆ getHorizontalPower()

float WaveWarpModifier::WaveWarpModifierKeyframe::getHorizontalPower ( )
inline

Gets the horizontal warp power.

Returns
The horizontal warp power.

◆ getVerticalPower()

float WaveWarpModifier::WaveWarpModifierKeyframe::getVerticalPower ( )
inline

Gets the vertical warp power.

Returns
The vertical warp power.

◆ interpolate()

void WaveWarpModifier::WaveWarpModifierKeyframe::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 WaveWarpModifier::WaveWarpModifierKeyframe::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 WaveWarpModifier::WaveWarpModifierKeyframe::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.

◆ setHorizontalAsymmetric()

void WaveWarpModifier::WaveWarpModifierKeyframe::setHorizontalAsymmetric ( bool horizontal_asymmetric)
inline

Sets whether horizontal warping is asymmetric.

If true, the transformation differs for values on different sides of the waveform.

Parameters
horizontal_asymmetricTrue for asymmetric, false for symmetric.

◆ setHorizontalPower()

void WaveWarpModifier::WaveWarpModifierKeyframe::setHorizontalPower ( float horizontal_power)
inline

Sets the horizontal warp power.

Parameters
horizontal_powerThe new horizontal warp power.

◆ setVerticalAsymmetric()

void WaveWarpModifier::WaveWarpModifierKeyframe::setVerticalAsymmetric ( bool vertical_asymmetric)
inline

Sets whether vertical warping is asymmetric.

Parameters
vertical_asymmetricTrue for asymmetric, false for symmetric.

◆ setVerticalPower()

void WaveWarpModifier::WaveWarpModifierKeyframe::setVerticalPower ( float vertical_power)
inline

Sets the vertical warp power.

Parameters
vertical_powerThe new vertical warp power.

◆ stateToJson()

json WaveWarpModifier::WaveWarpModifierKeyframe::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

◆ horizontal_asymmetric_

bool WaveWarpModifier::WaveWarpModifierKeyframe::horizontal_asymmetric_
protected

If true, horizontal warping is asymmetric.

◆ horizontal_power_

float WaveWarpModifier::WaveWarpModifierKeyframe::horizontal_power_
protected

Controls horizontal (time-axis) warping.

◆ vertical_asymmetric_

bool WaveWarpModifier::WaveWarpModifierKeyframe::vertical_asymmetric_
protected

If true, vertical warping is asymmetric.

◆ vertical_power_

float WaveWarpModifier::WaveWarpModifierKeyframe::vertical_power_
protected

Controls vertical (amplitude-axis) warping.


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