mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-09 12:31:40 +12:00
Add audio enable and vsync settings
This commit is contained in:
parent
e0c1d4511b
commit
8cba0405b9
12 changed files with 102 additions and 22 deletions
|
@ -25,10 +25,12 @@ Emulator::Emulator()
|
|||
#endif
|
||||
{
|
||||
DSPService& dspService = kernel.getServiceManager().getDSP();
|
||||
|
||||
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) {
|
||||
|
@ -103,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() {
|
||||
|
@ -388,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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue