Vital
Loading...
Searching...
No Matches
WavetableComponentFactory Class Reference

Factory class for creating and identifying different types of WavetableComponents. More...

#include <wavetable_component_factory.h>

Public Types

enum  ComponentType {
  kWaveSource , kLineSource , kFileSource , kNumSourceTypes ,
  kShepardToneSource = kNumSourceTypes , kBeginModifierTypes = kNumSourceTypes + 1 , kPhaseModifier = kBeginModifierTypes , kWaveWindow ,
  kFrequencyFilter , kSlewLimiter , kWaveFolder , kWaveWarp ,
  kNumComponentTypes
}
 Enumerates all known WavetableComponents, including sources and modifiers. More...
 

Static Public Member Functions

static int numComponentTypes ()
 Returns the total number of component types defined.
 
static int numSourceTypes ()
 Returns the number of source types defined.
 
static int numModifierTypes ()
 Returns the number of modifier types defined.
 
static WavetableComponentcreateComponent (ComponentType type)
 Creates a new WavetableComponent instance of a given enumerated type.
 
static WavetableComponentcreateComponent (const std::string &type)
 Creates a new WavetableComponent instance from a name string.
 
static std::string getComponentName (ComponentType type)
 Gets the human-readable name of a component from its enumerated type.
 
static ComponentType getSourceType (int type)
 Converts an integer index to a source ComponentType.
 
static ComponentType getModifierType (int type)
 Converts an integer index to a modifier ComponentType.
 

Detailed Description

Factory class for creating and identifying different types of WavetableComponents.

WavetableComponentFactory allows creation of source and modifier components by type enumerations or by name strings. It provides:

  • A set of enumerated ComponentTypes representing both wave sources and waveform modifiers.
  • Functions to create a component instance from a ComponentType or a string name.
  • Methods to retrieve human-readable names of components.
  • Separations of components into source and modifier categories.

Member Enumeration Documentation

◆ ComponentType

Enumerates all known WavetableComponents, including sources and modifiers.

Enumerator
kWaveSource 

A basic wave source.

kLineSource 

A line-based wave source.

kFileSource 

A file-based audio source.

kNumSourceTypes 

Marks the end of source types.

kShepardToneSource 
kBeginModifierTypes 
kPhaseModifier 

Modifier that shifts phase.

kWaveWindow 

Modifier that applies window functions to the wave.

kFrequencyFilter 

Modifier that filters frequency components.

kSlewLimiter 

Modifier that limits slew rate.

kWaveFolder 

Modifier that applies wave folding.

kWaveWarp 

Modifier that warps the waveform.

kNumComponentTypes 

Total count of all component types.

Member Function Documentation

◆ createComponent() [1/2]

WavetableComponent * WavetableComponentFactory::createComponent ( ComponentType type)
static

Creates a new WavetableComponent instance of a given enumerated type.

Parameters
typeThe ComponentType enumerated value.
Returns
A pointer to the newly created WavetableComponent.

◆ createComponent() [2/2]

WavetableComponent * WavetableComponentFactory::createComponent ( const std::string & type)
static

Creates a new WavetableComponent instance from a name string.

Parameters
typeThe component name as a string.
Returns
A pointer to the newly created WavetableComponent.

◆ getComponentName()

std::string WavetableComponentFactory::getComponentName ( ComponentType type)
static

Gets the human-readable name of a component from its enumerated type.

Parameters
typeThe ComponentType enumerated value.
Returns
The corresponding component name as a std::string.

◆ getModifierType()

static ComponentType WavetableComponentFactory::getModifierType ( int type)
inlinestatic

Converts an integer index to a modifier ComponentType.

Parameters
typeThe integer index for modifier types.
Returns
The corresponding ComponentType for a modifier.

◆ getSourceType()

static ComponentType WavetableComponentFactory::getSourceType ( int type)
inlinestatic

Converts an integer index to a source ComponentType.

Parameters
typeThe integer index representing a source type.
Returns
The corresponding ComponentType.

◆ numComponentTypes()

static int WavetableComponentFactory::numComponentTypes ( )
inlinestatic

Returns the total number of component types defined.

Returns
The total count of component types.

◆ numModifierTypes()

static int WavetableComponentFactory::numModifierTypes ( )
inlinestatic

Returns the number of modifier types defined.

Returns
The number of modifier component types.

◆ numSourceTypes()

static int WavetableComponentFactory::numSourceTypes ( )
inlinestatic

Returns the number of source types defined.

Returns
The number of source component types.

The documentation for this class was generated from the following files: