82 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
WaveSource)
134 float range_prev,
float range,
float range_next,
float t);
163 float range_prev,
float range,
float range_next,
float t);
A WavetableComponent that acts as a direct source of waveforms.
Definition wave_source.h:25
json stateToJson() override
Serializes the component’s state and all keyframes to a JSON object.
Definition wave_source.cpp:35
std::unique_ptr< WaveSourceKeyframe > compute_frame_
A keyframe for intermediate interpolation computations.
Definition wave_source.h:79
virtual ~WaveSource()
Definition wave_source.cpp:15
void setInterpolationMode(InterpolationMode mode)
Sets the interpolation mode for morphing between keyframes.
Definition wave_source.h:69
InterpolationMode interpolation_mode_
The mode of interpolation.
Definition wave_source.h:80
void jsonToState(json data) override
Restores the component’s state from a JSON object.
Definition wave_source.cpp:41
vital::WaveFrame * getWaveFrame(int index)
Gets a WaveFrame from a specified keyframe index.
Definition wave_source.cpp:47
void render(vital::WaveFrame *wave_frame, float position) override
Renders the waveform at a given position into a WaveFrame.
Definition wave_source.cpp:24
WaveSourceKeyframe * getKeyframe(int index)
Retrieves a WaveSourceKeyframe by index.
Definition wave_source.cpp:51
InterpolationMode getInterpolationMode() const
Gets the current interpolation mode.
Definition wave_source.h:76
WavetableKeyframe * createKeyframe(int position) override
Creates a new keyframe at a given position.
Definition wave_source.cpp:17
InterpolationMode
Defines how keyframes should be interpolated.
Definition wave_source.h:31
@ kTime
Interpolate directly in time domain.
Definition wave_source.h:32
@ kFrequency
Interpolate in frequency domain.
Definition wave_source.h:33
WaveSource()
Constructs a WaveSource with a default frequency-domain interpolation mode.
Definition wave_source.cpp:10
WavetableComponentFactory::ComponentType getType() override
Returns the type of this WavetableComponent.
Definition wave_source.cpp:31
A keyframe that holds a single WaveFrame and supports various interpolation methods.
Definition wave_source.h:92
WaveSourceKeyframe()
Constructs a WaveSourceKeyframe with frequency-domain interpolation mode by default.
Definition wave_source.h:97
WaveSource::InterpolationMode interpolation_mode_
The mode (time or frequency) used for this keyframe's interpolation.
Definition wave_source.h:199
void copy(const WavetableKeyframe *keyframe) override
Copies the state from another keyframe of the same type.
Definition wave_source.cpp:56
void smoothInterpolate(const WavetableKeyframe *prev_keyframe, const WavetableKeyframe *from_keyframe, const WavetableKeyframe *to_keyframe, const WavetableKeyframe *next_keyframe, float t) override
Performs a smooth (cubic) interpolation using four keyframes for even smoother transitions.
Definition wave_source.cpp:173
virtual ~WaveSourceKeyframe()
Definition wave_source.h:100
void cubicTimeInterpolate(const vital::WaveFrame *prev, const vital::WaveFrame *from, const vital::WaveFrame *to, const vital::WaveFrame *next, float range_prev, float range, float range_next, float t)
Cubic interpolation in time domain using four WaveFrames for smooth transitions.
Definition wave_source.cpp:69
void linearFrequencyInterpolate(const vital::WaveFrame *from, const vital::WaveFrame *to, float t)
Linear interpolation in frequency domain.
Definition wave_source.cpp:82
json stateToJson() override
Serializes the state of this keyframe to a JSON object.
Definition wave_source.cpp:193
void setInterpolationMode(WaveSource::InterpolationMode mode)
Sets the interpolation mode for this keyframe.
Definition wave_source.h:188
void jsonToState(json data) override
Restores the keyframe's state from a JSON object.
Definition wave_source.cpp:201
void linearTimeInterpolate(const vital::WaveFrame *from, const vital::WaveFrame *to, float t)
Linearly interpolate two WaveFrames in the time domain.
Definition wave_source.cpp:62
std::unique_ptr< vital::WaveFrame > wave_frame_
The WaveFrame representing this keyframe’s waveform.
Definition wave_source.h:198
WaveSource::InterpolationMode getInterpolationMode() const
Gets the current interpolation mode for this keyframe.
Definition wave_source.h:195
vital::WaveFrame * wave_frame()
Provides direct access to the stored WaveFrame.
Definition wave_source.h:107
void cubicFrequencyInterpolate(const vital::WaveFrame *prev, const vital::WaveFrame *from, const vital::WaveFrame *to, const vital::WaveFrame *next, float range_prev, float range, float range_next, float t)
Cubic interpolation in frequency domain using four WaveFrames.
Definition wave_source.cpp:112
void render(vital::WaveFrame *wave_frame) override
Renders the WaveFrame into the provided wave_frame without modification.
Definition wave_source.h:176
void interpolate(const WavetableKeyframe *from_keyframe, const WavetableKeyframe *to_keyframe, float t) override
Linearly interpolates between two keyframes.
Definition wave_source.cpp:162
ComponentType
Enumerates all known WavetableComponents, including sources and modifiers.
Definition wavetable_component_factory.h:28
A base class representing a component in a wavetable synthesis chain.
Definition wavetable_component.h:32
Represents a single state of a waveform at a specific position in a wavetable.
Definition wavetable_keyframe.h:35
Represents a single frame of a wavetable, containing both time-domain and frequency-domain data.
Definition wave_frame.h:16
void copy(const WaveFrame *other)
Copies another WaveFrame's time and frequency domain data into this one.
Definition wave_frame.cpp:57
nlohmann::json json
Definition line_generator.h:7