Vital
Loading...
Searching...
No Matches
wavetable_component_factory.h
Go to the documentation of this file.
1/*
2Summary:
3WavetableComponentFactory provides a centralized means to instantiate various WavetableComponents, both sources and modifiers, and to map between enumerated types, string names, and constructed objects. This makes it easier to integrate new components, handle component-specific UI or preset logic, and maintain a clean separation of concerns for creation and naming of WavetableComponents.
4 */
5
6#pragma once
7
8#include "JuceHeader.h"
9
11
23public:
44
50 static int numComponentTypes() { return kNumComponentTypes; }
51
57 static int numSourceTypes() { return kNumSourceTypes; }
58
65
72 static WavetableComponent* createComponent(ComponentType type);
73
80 static WavetableComponent* createComponent(const std::string& type);
81
88 static std::string getComponentName(ComponentType type);
89
96 static ComponentType getSourceType(int type) { return static_cast<ComponentType>(type); }
97
105 return (ComponentType)(type + kBeginModifierTypes);
106 }
107
108private:
110};
Factory class for creating and identifying different types of WavetableComponents.
Definition wavetable_component_factory.h:22
static WavetableComponent * createComponent(ComponentType type)
Creates a new WavetableComponent instance of a given enumerated type.
Definition wavetable_component_factory.cpp:19
ComponentType
Enumerates all known WavetableComponents, including sources and modifiers.
Definition wavetable_component_factory.h:28
@ kNumComponentTypes
Total count of all component types.
Definition wavetable_component_factory.h:42
@ kWaveFolder
Modifier that applies wave folding.
Definition wavetable_component_factory.h:40
@ kWaveWindow
Modifier that applies window functions to the wave.
Definition wavetable_component_factory.h:37
@ kWaveSource
A basic wave source.
Definition wavetable_component_factory.h:29
@ kFrequencyFilter
Modifier that filters frequency components.
Definition wavetable_component_factory.h:38
@ kPhaseModifier
Modifier that shifts phase.
Definition wavetable_component_factory.h:36
@ kFileSource
A file-based audio source.
Definition wavetable_component_factory.h:31
@ kWaveWarp
Modifier that warps the waveform.
Definition wavetable_component_factory.h:41
@ kLineSource
A line-based wave source.
Definition wavetable_component_factory.h:30
@ kNumSourceTypes
Marks the end of source types.
Definition wavetable_component_factory.h:32
@ kShepardToneSource
Definition wavetable_component_factory.h:33
@ kSlewLimiter
Modifier that limits slew rate.
Definition wavetable_component_factory.h:39
@ kBeginModifierTypes
Definition wavetable_component_factory.h:35
static ComponentType getModifierType(int type)
Converts an integer index to a modifier ComponentType.
Definition wavetable_component_factory.h:104
static ComponentType getSourceType(int type)
Converts an integer index to a source ComponentType.
Definition wavetable_component_factory.h:96
static int numSourceTypes()
Returns the number of source types defined.
Definition wavetable_component_factory.h:57
static std::string getComponentName(ComponentType type)
Gets the human-readable name of a component from its enumerated type.
Definition wavetable_component_factory.cpp:75
static int numModifierTypes()
Returns the number of modifier types defined.
Definition wavetable_component_factory.h:64
static int numComponentTypes()
Returns the total number of component types defined.
Definition wavetable_component_factory.h:50
A base class representing a component in a wavetable synthesis chain.
Definition wavetable_component.h:32