comments
This commit is contained in:
@@ -32,7 +32,7 @@ struct ParamDef {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// TODO: make these configurable via yml file too
|
// TODO: make these configurable via yml file too
|
||||||
// TODO: and then when I have full on profile saving there will be a default profile to load from
|
// later TODO: and then when I have full on profile saving there will be a default profile to load from
|
||||||
constexpr std::array<ParamDef, static_cast<size_t>(ParamId::Count)> PARAM_DEFS {{
|
constexpr std::array<ParamDef, static_cast<size_t>(ParamId::Count)> PARAM_DEFS {{
|
||||||
{ 100.0f, 20.0f, 600.0f}, // Osc1Freq
|
{ 100.0f, 20.0f, 600.0f}, // Osc1Freq
|
||||||
{ 0.8f, 0.0f, 1.0f}, // Osc1Gain
|
{ 0.8f, 0.0f, 1.0f}, // Osc1Gain
|
||||||
|
|||||||
@@ -13,12 +13,21 @@ public:
|
|||||||
AudioEngine();
|
AudioEngine();
|
||||||
~AudioEngine();
|
~AudioEngine();
|
||||||
|
|
||||||
|
// starts the audio stream. returns true on success and false on failure
|
||||||
bool start();
|
bool start();
|
||||||
|
|
||||||
|
// stops the audio stream.
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
|
// params getter
|
||||||
ParameterStore* parameters() { return ¶ms_; }
|
ParameterStore* parameters() { return ¶ms_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
// RtAudio binding for passing samples
|
||||||
static int32_t audioCallback(void* outputBuffer, void* inputBuffer, uint32_t nFrames, double streamTime, RtAudioStreamStatus status, void* userData);
|
static int32_t audioCallback(void* outputBuffer, void* inputBuffer, uint32_t nFrames, double streamTime, RtAudioStreamStatus status, void* userData);
|
||||||
|
|
||||||
|
// calls the synth.process to generate a buffer audio samples
|
||||||
int32_t process(float* out, uint32_t nFrames);
|
int32_t process(float* out, uint32_t nFrames);
|
||||||
|
|
||||||
ParameterStore params_;
|
ParameterStore params_;
|
||||||
|
|||||||
@@ -21,12 +21,18 @@ public:
|
|||||||
Synth(const ParameterStore& params);
|
Synth(const ParameterStore& params);
|
||||||
~Synth() = default;
|
~Synth() = default;
|
||||||
|
|
||||||
|
// generates a buffer of audio samples nFrames long
|
||||||
void process(float* out, uint32_t nFrames, uint32_t sampleRate);
|
void process(float* out, uint32_t nFrames, uint32_t sampleRate);
|
||||||
|
|
||||||
|
// sample rate setter
|
||||||
void setSampleRate(uint32_t sampleRate) { sampleRate_ = sampleRate; }
|
void setSampleRate(uint32_t sampleRate) { sampleRate_ = sampleRate; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void updateParams();
|
// update internal params to the paramStore. not an immediate sync, its buffered for smoothing
|
||||||
|
void updateParams(); // (might remove the smoothing later)
|
||||||
|
|
||||||
|
// small getter that abstracts all the static casts and such
|
||||||
inline float getParam(ParamId);
|
inline float getParam(ParamId);
|
||||||
|
|
||||||
const ParameterStore& paramStore_;
|
const ParameterStore& paramStore_;
|
||||||
|
|||||||
Reference in New Issue
Block a user