38 float adjusted_value = max_value * wave_fold_boost_ * asinf(value);
47 data[
"fold_boost"] = wave_fold_boost_;
53 wave_fold_boost_ = data[
"fold_boost"];
A keyframe class that stores the fold boost parameter for wave-folding at a given position.
Definition wave_fold_modifier.h:28
void render(vital::WaveFrame *wave_frame) override
Renders the waveform of this keyframe into a WaveFrame.
Definition wave_fold_modifier.cpp:31
void copy(const WavetableKeyframe *keyframe) override
Copies the state from another keyframe of the same type.
Definition wave_fold_modifier.cpp:16
json stateToJson() override
Serializes the state of this keyframe to a JSON object.
Definition wave_fold_modifier.cpp:45
WaveFoldModifierKeyframe()
Constructs a keyframe with a default wave fold boost value of 1.0.
Definition wave_fold_modifier.cpp:11
void jsonToState(json data) override
Restores the keyframe's state from a JSON object.
Definition wave_fold_modifier.cpp:51
float wave_fold_boost_
The factor by which the wave is folded.
Definition wave_fold_modifier.h:60
void interpolate(const WavetableKeyframe *from_keyframe, const WavetableKeyframe *to_keyframe, float t) override
Linearly interpolates between two keyframes.
Definition wave_fold_modifier.cpp:21
WaveFoldModifierKeyframe * getKeyframe(int index)
Retrieves a WaveFoldModifierKeyframe at a given index.
Definition wave_fold_modifier.cpp:73
WavetableKeyframe * createKeyframe(int position) override
Creates a new keyframe at a given position.
Definition wave_fold_modifier.cpp:56
WavetableComponentFactory::ComponentType getType() override
Returns the type of this WavetableComponent.
Definition wave_fold_modifier.cpp:69
void render(vital::WaveFrame *wave_frame, float position) override
Renders the waveform at a given position into a WaveFrame.
Definition wave_fold_modifier.cpp:63
WaveFoldModifierKeyframe compute_frame_
A keyframe for intermediate computations.
Definition wave_fold_modifier.h:84
ComponentType
Enumerates all known WavetableComponents, including sources and modifiers.
Definition wavetable_component_factory.h:28
@ kWaveFolder
Modifier that applies wave folding.
Definition wavetable_component_factory.h:40
void interpolate(WavetableKeyframe *dest, float position)
Interpolates a destination keyframe at a given position.
Definition wavetable_component.cpp:68
std::vector< std::unique_ptr< WavetableKeyframe > > keyframes_
The list of keyframes sorted by position.
Definition wavetable_component.h:219
Represents a single state of a waveform at a specific position in a wavetable.
Definition wavetable_keyframe.h:35
virtual json stateToJson()
Serializes the state of this keyframe to a JSON object.
Definition wavetable_keyframe.cpp:37
virtual void jsonToState(json data)
Restores the keyframe's state from a JSON object.
Definition wavetable_keyframe.cpp:41
Represents a single frame of a wavetable, containing both time-domain and frequency-domain data.
Definition wave_frame.h:16
void toFrequencyDomain()
Converts the currently loaded time-domain data into frequency-domain representation.
Definition wave_frame.cpp:64
static constexpr int kWaveformSize
The size of the waveform (number of samples per frame).
Definition wave_frame.h:21
mono_float time_domain[2 *kWaveformSize]
The time-domain data, extended buffer size for FFT alignment.
Definition wave_frame.h:124
mono_float getMaxZeroOffset() const
Retrieves the maximum absolute amplitude in the time-domain waveform.
Definition wave_frame.cpp:30
nlohmann::json json
Definition line_generator.h:7
force_inline poly_float clamp(poly_float value, mono_float min, mono_float max)
Clamps each lane of a vector to [min, max].
Definition poly_utils.h:306
Provides various utility functions, classes, and constants for audio, math, and general-purpose opera...