mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-05-30 02:19:10 +12:00
Adding audio interface part 1
This commit is contained in:
parent
be071ffb78
commit
486e2ea5cb
7 changed files with 91 additions and 51 deletions
include/audio
31
include/audio/audio_device.hpp
Normal file
31
include/audio/audio_device.hpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
#pragma once
|
||||
#include <array>
|
||||
|
||||
#include "config.hpp"
|
||||
#include "helpers.hpp"
|
||||
#include "ring_buffer.hpp"
|
||||
|
||||
class AudioDeviceInterface {
|
||||
protected:
|
||||
using Samples = Common::RingBuffer<s16, 0x2000 * 2>;
|
||||
Samples* samples = nullptr;
|
||||
|
||||
const AudioDeviceConfig& audioSettings;
|
||||
|
||||
public:
|
||||
AudioDeviceInterface(Samples* samples, const AudioDeviceConfig& audioSettings) : samples(samples), audioSettings(audioSettings) {}
|
||||
|
||||
// Store the last stereo sample we output. We play this when underruning to avoid pops.
|
||||
// TODO: Make this protected again before merging!!!
|
||||
std::array<s16, 2> lastStereoSample{};
|
||||
|
||||
bool running = false;
|
||||
Samples* getSamples() { return samples; }
|
||||
|
||||
// If safe is on, we create a null audio device
|
||||
virtual void init(Samples& samples, bool safe = false) = 0;
|
||||
virtual void close() = 0;
|
||||
|
||||
virtual void start() = 0;
|
||||
virtual void stop() = 0;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue