This commit is contained in:
2026-01-30 23:54:44 -06:00
parent c7456a6587
commit d1123138a3
6 changed files with 50 additions and 8 deletions

View File

@@ -69,8 +69,6 @@ struct ParamDefault {
float max;
};
// TODO: make these configurable via yml file too
// later TODO: and then when I have full on profile saving there will be a default profile to load from
constexpr std::array<ParamDefault, static_cast<size_t>(ParamId::Count)> PARAM_DEFS {{
{ 100.0f, 20.0f, 600.0f}, // Osc1Freq
{ 2.0f, 0.0f, 0.0f}, // OscWaveSelector1

View File

@@ -35,9 +35,17 @@ bool AudioEngine::start() {
RtAudio::StreamOptions options;
options.flags = RTAUDIO_MINIMIZE_LATENCY;
// TODO: error check this please
audio_.openStream(&params, nullptr, RTAUDIO_FLOAT32, sampleRate_, &bufferFrames_, &AudioEngine::audioCallback, this, &options);
audio_.startStream();
RtAudioErrorType status = audio_.openStream(&params, nullptr, RTAUDIO_FLOAT32, sampleRate_, &bufferFrames_, &AudioEngine::audioCallback, this, &options);
if(status != RTAUDIO_NO_ERROR) {
std::cout << "Error opening RtAudio stream" << std::endl;
return false;
}
status = audio_.startStream();
if(status != RTAUDIO_NO_ERROR) {
std::cout << "Error starting RtAudio stream" << std::endl;
return false;
}
// sanity check
std::cout << "sample rate: " << sampleRate_ << " buffer frames: " << bufferFrames_ << std::endl;

View File

@@ -49,7 +49,8 @@ private:
ScopeBuffer scope_ { 1024 }; // stores audio samples for visualization
RtAudio audio_{AUDIO_API}; // audio device
// TODO: id like a yml config file or something for these
// Configurable in the audio.yaml file, assigned defaults if the file is not found
uint32_t sampleRate_ = 44100;
uint32_t bufferFrames_ = 512; // time per buffer = BF/SR (256/44100 = 5.8ms)
uint32_t channels_ = 2; // stereo

View File

@@ -12,6 +12,7 @@
// TODO: make configurable
#define SYNTH_OSCILLATOR_COUNT 3
// if there's different oscillator amounts then we need to be able to dynamically create the ui for each of them
struct SmoothedParam {
float current = 0.0f;
@@ -63,7 +64,6 @@ private:
// filters
Filter filter1_;
Filter filter2_;
// TODO: I think the filter's state being uninitialized is what's causing popping when a voice starts for the first time
// paramstore pointer
SmoothedParam* params_;