mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-21 12:59:14 +12:00
Implement audio output
This commit is contained in:
parent
093364f615
commit
21ced6fae7
11 changed files with 299 additions and 9 deletions
28
include/audio/miniaudio_device.hpp
Normal file
28
include/audio/miniaudio_device.hpp
Normal 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();
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue