use correct audio backend apis

This commit is contained in:
2026-01-13 22:02:36 -06:00
parent a9f474f397
commit 0ec4b4e84d
4 changed files with 8 additions and 10 deletions

View File

@@ -8,6 +8,12 @@
#include "Synth.h"
#include "../KeyboardController.h"
#if defined(_WIN32)
#define AUDIO_API RtAudio::WINDOWS_WASAPI
#else
#define AUDIO_API RtAudio::LINUX_ALSA
#endif
class AudioEngine {
public:
@@ -38,10 +44,10 @@ private:
Synth synth_; // generates audio
ScopeBuffer scope_ { 1024 }; // stores audio samples for visualization
RtAudio audio_; // audio device
RtAudio audio_{AUDIO_API}; // audio device
// TODO: id like a yml config file or something for these
uint32_t sampleRate_ = 44100;
uint32_t bufferFrames_ = 128; // time per buffer = BF/SR (256/44100 = 5.8ms)
uint32_t bufferFrames_ = 256; // time per buffer = BF/SR (256/44100 = 5.8ms)
uint32_t channels_ = 2; // stereo
};

View File

@@ -32,7 +32,6 @@ inline float Synth::getParam(ParamId id) {
void Synth::handleNoteEvent(const NoteEvent& event) {
std::cout << "Synth::handleNoteEvent: " << std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - event.timestamp) << std::endl;
lastTime = event.timestamp;
if(event.type == NoteEventType::NoteOn) {
@@ -110,6 +109,4 @@ void Synth::process(float* out, uint32_t nFrames, uint32_t sampleRate) {
}
}
//std::cout << "Notequeue::push: " << std::chrono::high_resolution_clock::now() - lastTime << std::endl;
}