Get audio output working with LLE DSP ()

* 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:
wheremyfoodat 2024-02-24 01:26:23 +00:00 committed by GitHub
parent 8bca988b55
commit d459cb1d6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 396 additions and 15 deletions

View file

@ -29,6 +29,9 @@ Emulator::Emulator()
dsp = Audio::makeDSPCore(config.dspType, memory, scheduler, dspService);
dspService.setDSPCore(dsp.get());
audioDevice.init(dsp->getSamples());
setAudioEnabled(config.audioEnabled);
#ifdef PANDA3DS_ENABLE_DISCORD_RPC
if (config.discordRpcEnabled) {
discordRpc.init();
@ -102,8 +105,19 @@ void Emulator::step() {}
void Emulator::render() {}
// Only resume if a ROM is properly loaded
void Emulator::resume() { running = (romType != ROMType::None); }
void Emulator::pause() { running = false; }
void Emulator::resume() {
running = (romType != ROMType::None);
if (running) {
audioDevice.start();
}
}
void Emulator::pause() {
running = false;
audioDevice.stop();
}
void Emulator::togglePause() { running ? pause() : resume(); }
void Emulator::runFrame() {
@ -387,4 +401,16 @@ RomFS::DumpingResult Emulator::dumpRomFS(const std::filesystem::path& path) {
dumpRomFSNode(*node, (const char*)&romFS[0], path);
return DumpingResult::Success;
}
void Emulator::setAudioEnabled(bool enable) {
if (!enable) {
audioDevice.stop();
} else if (enable && romType != ROMType::None && running) {
// Don't start the audio device yet if there's no ROM loaded or the emulator is paused
// Resume and Pause will handle it
audioDevice.start();
}
dsp->setAudioEnabled(enable);
}