Vital
|
A keyframe class holding horizontal and vertical warp parameters at a given position. More...
#include <wave_warp_modifier.h>
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. | |
![]() | |
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. | |
WavetableComponent * | owner () |
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. | |
![]() | |
int | position_ |
The position of this keyframe along the wavetable dimension. | |
WavetableComponent * | owner_ |
The component that owns this keyframe. | |
Additional Inherited Members | |
![]() | |
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. | |
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.
WaveWarpModifier::WaveWarpModifierKeyframe::WaveWarpModifierKeyframe | ( | ) |
Constructs a WaveWarpModifierKeyframe with default warp powers and symmetric warping.
|
inlinevirtual |
|
overridevirtual |
Copies the state from another keyframe of the same type.
keyframe | The source keyframe to copy from. |
Implements WavetableKeyframe.
|
inline |
Gets the horizontal warp power.
|
inline |
Gets the vertical warp power.
|
overridevirtual |
Linearly interpolates between two keyframes.
from_keyframe | The starting keyframe. |
to_keyframe | The ending keyframe. |
t | The interpolation factor [0,1]. |
Implements WavetableKeyframe.
|
overridevirtual |
Restores the keyframe's state from a JSON object.
data | The JSON object containing the keyframe's state. |
Reimplemented from WavetableKeyframe.
|
overridevirtual |
Renders the waveform of this keyframe into a WaveFrame.
wave_frame | The WaveFrame to fill with this keyframe's waveform data. |
Implements WavetableKeyframe.
|
inline |
Sets whether horizontal warping is asymmetric.
If true, the transformation differs for values on different sides of the waveform.
horizontal_asymmetric | True for asymmetric, false for symmetric. |
|
inline |
Sets the horizontal warp power.
horizontal_power | The new horizontal warp power. |
|
inline |
Sets whether vertical warping is asymmetric.
vertical_asymmetric | True for asymmetric, false for symmetric. |
|
inline |
Sets the vertical warp power.
vertical_power | The new vertical warp power. |
|
overridevirtual |
Serializes the state of this keyframe to a JSON object.
Reimplemented from WavetableKeyframe.
|
protected |
If true, horizontal warping is asymmetric.
|
protected |
Controls horizontal (time-axis) warping.
|
protected |
If true, vertical warping is asymmetric.
|
protected |
Controls vertical (amplitude-axis) warping.