mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-07 19:41:38 +12:00
Get audio output working with LLE DSP (#419)
* Implement audio output * Semi-proper audio output * Add audio enable and vsync settings * Add audio enable and vsync settings * Optimize audio output a bit * Make max ring buffer timeout smaller * Make max ring buffer timeout smaller * Revert to spinlocking for audio sync * Sleep emulator thread if too many samples queued * Fix Teakra submodule breaking * Don't start audio device too soon * Fix IWYU errors * Fix compilation errors on GCC/Clang * Ignore std::hardware_destructive_interference_size on Android NDK * Fix more IWYU errors
This commit is contained in:
parent
8bca988b55
commit
d459cb1d6c
16 changed files with 396 additions and 15 deletions
|
@ -9,6 +9,7 @@
|
|||
#include "helpers.hpp"
|
||||
#include "logger.hpp"
|
||||
#include "scheduler.hpp"
|
||||
#include "ring_buffer.hpp"
|
||||
|
||||
// The DSP core must have access to the DSP service to be able to trigger interrupts properly
|
||||
class DSPService;
|
||||
|
@ -23,16 +24,22 @@ namespace Audio {
|
|||
static constexpr u64 lleSlice = 16384;
|
||||
|
||||
class DSPCore {
|
||||
using Samples = Common::RingBuffer<s16, 1024>;
|
||||
|
||||
protected:
|
||||
Memory& mem;
|
||||
Scheduler& scheduler;
|
||||
DSPService& dspService;
|
||||
|
||||
Samples sampleBuffer;
|
||||
bool audioEnabled = false;
|
||||
|
||||
MAKE_LOG_FUNCTION(log, dspLogger)
|
||||
|
||||
public:
|
||||
enum class Type { Null, Teakra };
|
||||
DSPCore(Memory& mem, Scheduler& scheduler, DSPService& dspService) : mem(mem), scheduler(scheduler), dspService(dspService) {}
|
||||
DSPCore(Memory& mem, Scheduler& scheduler, DSPService& dspService)
|
||||
: mem(mem), scheduler(scheduler), dspService(dspService) {}
|
||||
virtual ~DSPCore() {}
|
||||
|
||||
virtual void reset() = 0;
|
||||
|
@ -50,6 +57,9 @@ namespace Audio {
|
|||
|
||||
static Audio::DSPCore::Type typeFromString(std::string inString);
|
||||
static const char* typeToString(Audio::DSPCore::Type type);
|
||||
|
||||
Samples& getSamples() { return sampleBuffer; }
|
||||
virtual void setAudioEnabled(bool enable) { audioEnabled = enable; }
|
||||
};
|
||||
|
||||
std::unique_ptr<DSPCore> makeDSPCore(DSPCore::Type type, Memory& mem, Scheduler& scheduler, DSPService& dspService);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue