This commit is contained in:
2025-12-23 23:24:05 -06:00
parent 4d5cb4974b
commit 0dc37b0efa
3 changed files with 18 additions and 3 deletions

View File

@@ -32,7 +32,7 @@ struct ParamDef {
};
// 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 {{
{ 100.0f, 20.0f, 600.0f}, // Osc1Freq
{ 0.8f, 0.0f, 1.0f}, // Osc1Gain

View File

@@ -13,12 +13,21 @@ public:
AudioEngine();
~AudioEngine();
// starts the audio stream. returns true on success and false on failure
bool start();
// stops the audio stream.
void stop();
// params getter
ParameterStore* parameters() { return &params_; }
private:
private:
// RtAudio binding for passing samples
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);
ParameterStore params_;

View File

@@ -21,12 +21,18 @@ public:
Synth(const ParameterStore& params);
~Synth() = default;
// generates a buffer of audio samples nFrames long
void process(float* out, uint32_t nFrames, uint32_t sampleRate);
// sample rate setter
void setSampleRate(uint32_t sampleRate) { sampleRate_ = sampleRate; }
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);
const ParameterStore& paramStore_;