A class representing a group of WavetableComponents combined to form part of a wavetable.
More...
#include <wavetable_group.h>
A class representing a group of WavetableComponents combined to form part of a wavetable.
A WavetableGroup holds multiple WavetableComponents (sources or modifiers) that work together to generate or transform a waveform. By combining and averaging their outputs, the group produces a single resulting waveform for any given position. WavetableGroups can be stacked by the WavetableCreator to form complex, layered sounds.
◆ WavetableGroup()
WavetableGroup::WavetableGroup |
( |
| ) |
|
|
inline |
◆ addComponent()
◆ getComponent()
Retrieves a component by index.
- Parameters
-
index | The index of the component. |
- Returns
- A pointer to the WavetableComponent at that index.
◆ getComponentIndex()
Gets the index of a particular WavetableComponent within this group.
- Parameters
-
component | The component to find. |
- Returns
- The index of the component or -1 if not found.
◆ getLastKeyframePosition()
int WavetableGroup::getLastKeyframePosition |
( |
| ) |
|
Gets the largest keyframe position among all components in the group.
- Returns
- The highest keyframe position found.
◆ isShepardTone()
bool WavetableGroup::isShepardTone |
( |
| ) |
|
Determines if all components in this group produce a Shepard tone.
This is used to check if the entire group is producing a special "shepard tone" type table.
- Returns
- True if all components are Shepard tone sources, false otherwise.
◆ jsonToState()
void WavetableGroup::jsonToState |
( |
json | data | ) |
|
Restores this group's state from a JSON object.
Clears existing components and rebuilds them from the JSON data.
- Parameters
-
data | The JSON object containing the group's saved state. |
◆ loadDefaultGroup()
void WavetableGroup::loadDefaultGroup |
( |
| ) |
|
Loads a default group configuration (e.g., a basic wave source).
◆ moveDown()
void WavetableGroup::moveDown |
( |
int | index | ) |
|
Moves a component one position down in the ordering.
- Parameters
-
index | The index of the component to move. |
◆ moveUp()
void WavetableGroup::moveUp |
( |
int | index | ) |
|
Moves a component one position up in the ordering.
- Parameters
-
index | The index of the component to move. |
◆ numComponents()
int WavetableGroup::numComponents |
( |
| ) |
const |
|
inline |
Gets the number of WavetableComponents in this group.
- Returns
- The number of components.
◆ prerender()
void WavetableGroup::prerender |
( |
| ) |
|
Allows components to precompute any necessary data before rendering.
◆ removeComponent()
void WavetableGroup::removeComponent |
( |
int | index | ) |
|
Removes a component at a given index.
- Parameters
-
index | The index of the component to remove. |
◆ render()
void WavetableGroup::render |
( |
vital::WaveFrame * | wave_frame, |
|
|
float | position ) const |
Renders the combined waveform for a given position from all components.
Each component is rendered and their outputs are combined to form a single WaveFrame result.
- Parameters
-
wave_frame | The WaveFrame to fill with the resulting waveform. |
position | The position along the wavetable dimension. |
◆ renderTo()
Renders the entire group directly into a Wavetable object.
This fills all frames of the Wavetable.
- Parameters
-
wavetable | The Wavetable to fill. |
◆ reset()
void WavetableGroup::reset |
( |
| ) |
|
Clears all components and loads a default group configuration.
◆ stateToJson()
json WavetableGroup::stateToJson |
( |
| ) |
|
Serializes this group's state, including all its components, to JSON.
- Returns
- A JSON object representing the group's state.
◆ components_
The list of components in this group.
◆ compute_frame_
Temporary WaveFrame for combining component outputs.
The documentation for this class was generated from the following files: