Vital
|
A class responsible for creating complete wavetables from groups of wavetable components. More...
#include <wavetable_creator.h>
Public Types | |
enum | AudioFileLoadStyle { kNone , kWavetableSplice , kVocoded , kTtwt , kPitched , kNumDragLoadStyles } |
Defines how audio files are interpreted when loading into a wavetable. More... | |
Public Member Functions | |
WavetableCreator (vital::Wavetable *wavetable) | |
Constructs a WavetableCreator associated with a given Wavetable object. | |
int | getGroupIndex (WavetableGroup *group) |
void | addGroup (WavetableGroup *group) |
void | removeGroup (int index) |
void | moveUp (int index) |
void | moveDown (int index) |
int | numGroups () const |
Gets the total number of WavetableGroups. | |
WavetableGroup * | getGroup (int index) const |
Retrieves a WavetableGroup by index. | |
float | render (int position) |
void | render () |
void | postRender (float max_span) |
void | renderToBuffer (float *buffer, int num_frames, int frame_size) |
void | init () |
void | clear () |
void | loadDefaultCreator () |
void | initPredefinedWaves () |
void | initFromAudioFile (const float *audio_buffer, int num_samples, int sample_rate, AudioFileLoadStyle load_style, FileSource::FadeStyle fade_style) |
void | setName (const std::string &name) |
Sets the name of the wavetable. | |
void | setAuthor (const std::string &author) |
Sets the author of the wavetable. | |
void | setFileLoaded (const std::string &path) |
Records the path of the last file loaded to create this wavetable. | |
std::string | getName () const |
Gets the name of the wavetable. | |
std::string | getAuthor () const |
Gets the author of the wavetable. | |
std::string | getLastFileLoaded () |
Gets the last loaded file path. | |
json | updateJson (json data) |
json | stateToJson () |
void | jsonToState (json data) |
vital::Wavetable * | getWavetable () |
Gets the internal wavetable object being created. | |
Static Public Member Functions | |
static bool | isValidJson (json data) |
Checks if a given JSON data represents a valid wavetable creator state. | |
Protected Member Functions | |
void | initFromSplicedAudioFile (const float *audio_buffer, int num_samples, int sample_rate, FileSource::FadeStyle fade_style) |
void | initFromVocodedAudioFile (const float *audio_buffer, int num_samples, int sample_rate, bool ttwt) |
void | initFromPitchedAudioFile (const float *audio_buffer, int num_samples, int sample_rate) |
void | initFromLineGenerator (LineGenerator *line_generator) |
Protected Attributes | |
vital::WaveFrame | compute_frame_combine_ |
vital::WaveFrame | compute_frame_ |
std::vector< std::unique_ptr< WavetableGroup > > | groups_ |
std::string | last_file_loaded_ |
vital::Wavetable * | wavetable_ |
bool | full_normalize_ |
bool | remove_all_dc_ |
A class responsible for creating complete wavetables from groups of wavetable components.
WavetableCreator combines multiple WavetableGroups (each containing sources and modifiers) to produce a final Wavetable object. It supports:
The creator can serialize its state to JSON and restore it, integrating with preset/loading systems.
Defines how audio files are interpreted when loading into a wavetable.
|
inline |
Constructs a WavetableCreator associated with a given Wavetable object.
By default, full normalization and DC removal are enabled.
wavetable | A pointer to the Wavetable to be created or modified. |
|
inline |
void WavetableCreator::clear | ( | ) |
|
inline |
Gets the author of the wavetable.
|
inline |
Retrieves a WavetableGroup by index.
index | The index of the desired group. |
int WavetableCreator::getGroupIndex | ( | WavetableGroup * | group | ) |
|
inline |
Gets the last loaded file path.
|
inline |
Gets the name of the wavetable.
|
inline |
Gets the internal wavetable object being created.
void WavetableCreator::init | ( | ) |
void WavetableCreator::initFromAudioFile | ( | const float * | audio_buffer, |
int | num_samples, | ||
int | sample_rate, | ||
AudioFileLoadStyle | load_style, | ||
FileSource::FadeStyle | fade_style ) |
|
protected |
|
protected |
|
protected |
|
protected |
void WavetableCreator::initPredefinedWaves | ( | ) |
|
static |
Checks if a given JSON data represents a valid wavetable creator state.
data | The JSON object to validate. |
void WavetableCreator::jsonToState | ( | json | data | ) |
void WavetableCreator::loadDefaultCreator | ( | ) |
void WavetableCreator::moveDown | ( | int | index | ) |
void WavetableCreator::moveUp | ( | int | index | ) |
|
inline |
Gets the total number of WavetableGroups.
void WavetableCreator::postRender | ( | float | max_span | ) |
void WavetableCreator::removeGroup | ( | int | index | ) |
void WavetableCreator::render | ( | ) |
float WavetableCreator::render | ( | int | position | ) |
void WavetableCreator::renderToBuffer | ( | float * | buffer, |
int | num_frames, | ||
int | frame_size ) |
|
inline |
Sets the author of the wavetable.
author | The author name. |
|
inline |
Records the path of the last file loaded to create this wavetable.
path | The file path. |
|
inline |
Sets the name of the wavetable.
name | The name to assign. |
json WavetableCreator::stateToJson | ( | ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |