Vital
Loading...
Searching...
No Matches
WaveWindowModifier::WaveWindowModifierKeyframe Class Reference

A keyframe class that stores the window shape and positions at a given table position. More...

#include <wave_window_modifier.h>

Inheritance diagram for WaveWindowModifier::WaveWindowModifierKeyframe:
WavetableKeyframe

Public Member Functions

 WaveWindowModifierKeyframe ()
 Constructs a WaveWindowModifierKeyframe with a default window shape and positions.
 
virtual ~WaveWindowModifierKeyframe ()
 
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.
 
void setLeft (float left)
 Sets the left position of the window (0 to 1).
 
void setRight (float right)
 Sets the right position of the window (0 to 1).
 
float getLeft ()
 Gets the left window position.
 
float getRight ()
 Gets the right window position.
 
void setWindowShape (WindowShape window_shape)
 Sets the window shape for this keyframe.
 
- 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 Member Functions

float applyWindow (float t)
 Applies the currently selected window shape at a given normalized time t.
 

Protected Attributes

float left_position_
 The left boundary of the windowing region.
 
float right_position_
 The right boundary of the windowing region.
 
WindowShape window_shape_
 The chosen window shape for this keyframe.
 
- 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 that stores the window shape and positions at a given table position.

The WaveWindowModifierKeyframe holds parameters for the left and right positions along the wave where the window begins and ends, as well as which window shape to use. Interpolating between keyframes allows the windowed portion of the wave to change shape or size smoothly across the wavetable dimension.

Constructor & Destructor Documentation

◆ WaveWindowModifierKeyframe()

WaveWindowModifier::WaveWindowModifierKeyframe::WaveWindowModifierKeyframe ( )

Constructs a WaveWindowModifierKeyframe with a default window shape and positions.

◆ ~WaveWindowModifierKeyframe()

virtual WaveWindowModifier::WaveWindowModifierKeyframe::~WaveWindowModifierKeyframe ( )
inlinevirtual

Member Function Documentation

◆ applyWindow()

float WaveWindowModifier::WaveWindowModifierKeyframe::applyWindow ( float t)
inlineprotected

Applies the currently selected window shape at a given normalized time t.

Parameters
tThe normalized time parameter [0,1].
Returns
The windowed amplitude.

◆ copy()

void WaveWindowModifier::WaveWindowModifierKeyframe::copy ( const WavetableKeyframe * keyframe)
overridevirtual

Copies the state from another keyframe of the same type.

Parameters
keyframeThe source keyframe to copy from.

Implements WavetableKeyframe.

◆ getLeft()

float WaveWindowModifier::WaveWindowModifierKeyframe::getLeft ( )
inline

Gets the left window position.

Returns
The left position parameter.

◆ getRight()

float WaveWindowModifier::WaveWindowModifierKeyframe::getRight ( )
inline

Gets the right window position.

Returns
The right position parameter.

◆ interpolate()

void WaveWindowModifier::WaveWindowModifierKeyframe::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 WaveWindowModifier::WaveWindowModifierKeyframe::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 WaveWindowModifier::WaveWindowModifierKeyframe::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.

◆ setLeft()

void WaveWindowModifier::WaveWindowModifierKeyframe::setLeft ( float left)
inline

Sets the left position of the window (0 to 1).

The portion of the wave before this position will be gradually introduced from 0 amplitude.

Parameters
leftThe new left position.

◆ setRight()

void WaveWindowModifier::WaveWindowModifierKeyframe::setRight ( float right)
inline

Sets the right position of the window (0 to 1).

The portion of the wave after this position will be gradually tapered to 0 amplitude.

Parameters
rightThe new right position.

◆ setWindowShape()

void WaveWindowModifier::WaveWindowModifierKeyframe::setWindowShape ( WindowShape window_shape)
inline

Sets the window shape for this keyframe.

Parameters
window_shapeThe WindowShape to apply.

◆ stateToJson()

json WaveWindowModifier::WaveWindowModifierKeyframe::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

◆ left_position_

float WaveWindowModifier::WaveWindowModifierKeyframe::left_position_
protected

The left boundary of the windowing region.

◆ right_position_

float WaveWindowModifier::WaveWindowModifierKeyframe::right_position_
protected

The right boundary of the windowing region.

◆ window_shape_

WindowShape WaveWindowModifier::WaveWindowModifierKeyframe::window_shape_
protected

The chosen window shape for this keyframe.


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