allow audio engine to react to keyboard inputs
This commit is contained in:
@@ -4,8 +4,9 @@
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include <numbers>
|
||||
#include <string>
|
||||
|
||||
AudioEngine::AudioEngine(LoggerService* logger) : logger_(logger) {
|
||||
AudioEngine::AudioEngine(ConfigService* config, LoggerService* logger, NoteQueue* noteQueue) : config_(config), logger_(logger), noteQueue_(noteQueue) {
|
||||
|
||||
if(audioDevice_.getDeviceCount() < 1) {
|
||||
std::cout << "No audio devices found" << std::endl;
|
||||
@@ -69,6 +70,12 @@ int32_t AudioEngine::audioCallback(void* outputBuffer, void* inputBuffer, uint32
|
||||
|
||||
int32_t AudioEngine::process(float* out, size_t nFrames) {
|
||||
|
||||
NoteEvent noteEvent;
|
||||
while(noteQueue_->pop(noteEvent)) {
|
||||
std::string msg = "[NoteEvent] Type: " + std::to_string(noteEvent.type) +" Velocity: " + std::to_string(noteEvent.velocity) + " Note:" + std::to_string(noteEvent.note);
|
||||
logger_->log("Audio", LogFlag::Debug, msg);
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < nFrames; i++) {
|
||||
|
||||
// simulate a sine wave
|
||||
|
||||
Reference in New Issue
Block a user