Vital
|
A specific WavetableKeyframe that uses the FileSource’s audio buffer. More...
#include <file_source.h>
Public Member Functions | |
FileSourceKeyframe (SampleBuffer *sample_buffer) | |
Constructs a keyframe tied to a given SampleBuffer. | |
virtual | ~FileSourceKeyframe () |
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. | |
float | getNormalizationScale () |
Computes the normalization scale factor for the current wave segment. | |
void | render (vital::WaveFrame *wave_frame) override |
Renders the waveform of this keyframe into a WaveFrame. | |
void | renderWaveBlend (vital::WaveFrame *wave_frame) |
void | renderNoInterpolate (vital::WaveFrame *wave_frame) |
void | renderTimeInterpolate (vital::WaveFrame *wave_frame) |
void | renderFreqInterpolate (vital::WaveFrame *wave_frame) |
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. | |
double | getStartPosition () |
Gets the current start position of the wave segment in samples. | |
double | getWindowSize () |
Gets the size of the extracted window in samples. | |
double | getWindowFade () |
Gets the fade size for window blending. | |
double | getWindowFadeSamples () |
int | getSamplesNeeded () |
force_inline void | setStartPosition (double start_position) |
force_inline void | setWindowFade (double window_fade) |
force_inline void | setWindowSize (double window_size) |
force_inline void | setFadeStyle (FadeStyle fade_style) |
force_inline void | setPhaseStyle (PhaseStyle phase_style) |
force_inline void | setOverriddenPhaseBuffer (const float *buffer) |
force_inline const float * | getDataBuffer () |
force_inline const float * | getCubicInterpolationBuffer () |
float | getScaledInterpolatedSample (float time) |
void | setInterpolateFromFrame (WaveSourceKeyframe *frame) |
void | setInterpolateToFrame (WaveSourceKeyframe *frame) |
![]() | |
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 | |
SampleBuffer * | sample_buffer_ |
const float * | overridden_phase_ |
WaveSourceKeyframe * | interpolate_from_frame_ |
WaveSourceKeyframe * | interpolate_to_frame_ |
double | start_position_ |
double | window_fade_ |
double | window_size_ |
FadeStyle | fade_style_ |
PhaseStyle | phase_style_ |
![]() | |
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 specific WavetableKeyframe that uses the FileSource’s audio buffer.
FileSourceKeyframe represents one "snapshot" of the file-based wavetable. It provides methods to render the wave frame based on a chosen fade/interpolation style and phase style, and can interpolate between keyframes or compute normalization scales.
FileSource::FileSourceKeyframe::FileSourceKeyframe | ( | SampleBuffer * | sample_buffer | ) |
Constructs a keyframe tied to a given SampleBuffer.
Constructs a FileSourceKeyframe tied to a sample buffer.
sample_buffer | A pointer to the buffer of audio samples associated with this file source. |
Initializes default parameters for window size, fade, and phase style.
|
inlinevirtual |
|
overridevirtual |
Copies the state from another keyframe of the same type.
keyframe | The source keyframe to copy from. |
Implements WavetableKeyframe.
|
inline |
|
inline |
float FileSource::FileSourceKeyframe::getNormalizationScale | ( | ) |
Computes the normalization scale factor for the current wave segment.
Ensures consistent amplitude for rendering.
|
inline |
force_inline float FileSource::FileSourceKeyframe::getScaledInterpolatedSample | ( | float | time | ) |
|
inline |
Gets the current start position of the wave segment in samples.
|
inline |
Gets the fade size for window blending.
|
inline |
|
inline |
Gets the size of the extracted window in samples.
|
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.
void FileSource::FileSourceKeyframe::renderFreqInterpolate | ( | vital::WaveFrame * | wave_frame | ) |
void FileSource::FileSourceKeyframe::renderNoInterpolate | ( | vital::WaveFrame * | wave_frame | ) |
void FileSource::FileSourceKeyframe::renderTimeInterpolate | ( | vital::WaveFrame * | wave_frame | ) |
void FileSource::FileSourceKeyframe::renderWaveBlend | ( | vital::WaveFrame * | wave_frame | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
overridevirtual |
Serializes the state of this keyframe to a JSON object.
Reimplemented from WavetableKeyframe.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |