Implement audio output

This commit is contained in:
wheremyfoodat 2024-02-22 02:15:49 +02:00
parent 093364f615
commit 21ced6fae7
11 changed files with 299 additions and 9 deletions

View file

@ -0,0 +1,28 @@
#pragma once
#include <string>
#include <vector>
#include "miniaudio.h"
#include "ring_buffer.hpp"
class MiniAudioDevice {
using Samples = Common::RingBuffer<ma_int16, 1024>;
// static constexpr ma_uint32 sampleRateIn = 32768; // 3DS sample rate
// static constexpr ma_uint32 sampleRateOut = 44100; // Output sample rate
ma_context context;
ma_device_config deviceConfig;
ma_device device;
ma_resampler resampler;
Samples* samples = nullptr;
bool initialized = false;
bool running = false;
std::vector<std::string> audioDevices;
public:
MiniAudioDevice();
// If safe is on, we create a null audio device
void init(Samples& samples, bool safe = false);
void start();
};