diff --git a/Desktop/Form1.cs b/Desktop/Form1.cs index 85a77ff..8d79c28 100644 --- a/Desktop/Form1.cs +++ b/Desktop/Form1.cs @@ -65,6 +65,7 @@ namespace Desktop if (_isRunning) return; _isRunning = true; _isPaused = false; + bool wasHighSpeed = false; Task.Run(() => { try @@ -102,6 +103,19 @@ namespace Desktop int elapsedTStates = (int)(_cpu.TotalTStates - tStatesBefore); _tapManager.Update(elapsedTStates); + if(highSpeed) + { + wasHighSpeed = true; + } + else if (wasHighSpeed) + { + stopwatch.Restart(); + fpsStopwatch.Restart(); + scanlineCount = 0; + audioSampleCount = (long)(_cpu.TotalTStates / 79.365); // Snap audio to the current T-State time + wasHighSpeed = false; + } + //Process audio at the correct time if (!highSpeed) {