From 572ef0abec6575b82583c90c54032efa5f2dfdbb Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Thu, 19 May 2016 03:23:55 -0500 Subject: [PATCH] Fixes bug where Peeking + Popping into a game resulted in slightly delayed audio --- Delta/Emulation/EmulationViewController.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Delta/Emulation/EmulationViewController.swift b/Delta/Emulation/EmulationViewController.swift index 3d81d94..96ead10 100644 --- a/Delta/Emulation/EmulationViewController.swift +++ b/Delta/Emulation/EmulationViewController.swift @@ -106,6 +106,11 @@ class EmulationViewController: UIViewController self.deferredPreparationHandler?() self.deferredPreparationHandler = nil + // Toggle audioManager.enabled to reset the audio buffer and ensure the audio isn't delayed from the beginning + // This is especially noticeable when peeking a game + self.emulatorCore.audioManager.enabled = false + self.emulatorCore.audioManager.enabled = true + switch self.emulatorCore.state { case .Stopped: self.emulatorCore.startEmulation()