From 17927f4ab0e67ae055ced6851cb9f37b64336f9d Mon Sep 17 00:00:00 2001 From: tudnai Date: Wed, 27 May 2020 17:27:11 -0700 Subject: [PATCH] Turn off disk acceleration immediately when there is a sound --- src/dev/audio/speaker.c | 7 +++++++ src/dev/disk/disk.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/src/dev/audio/speaker.c b/src/dev/audio/speaker.c index 3461cd8..1477025 100644 --- a/src/dev/audio/speaker.c +++ b/src/dev/audio/speaker.c @@ -16,6 +16,7 @@ #include "speaker.h" #include "6502.h" +#include "disk.h" // to be able to disable disk acceleration #define min(x,y) (x) < (y) ? (x) : (y) @@ -143,6 +144,12 @@ void spkr_toggle() { spkr_play_time = 0; + if ( diskAccelerator_count ) { + // turn off disk acceleration immediately + diskAccelerator_count = 0; + clk_6502_per_frm = clk_6502_per_frm_max = clk_6502_per_frm_set; + } + if ( clk_6502_per_frm_set < clk_6502_per_frm_max_sound ) { spkr_play_time = spkr_play_timeout; diff --git a/src/dev/disk/disk.h b/src/dev/disk/disk.h index 24e9f23..2aa3155 100644 --- a/src/dev/disk/disk.h +++ b/src/dev/disk/disk.h @@ -57,6 +57,9 @@ extern const int diskAccelerator_frames; // number of frames disk acceleratio extern int diskAccelerator_count; // counter for the disk acceleration frames extern int diskAccelerator_speed; // if less than the actual CPU speed, no acceleration +extern int diskAccelerator_count; + + //extern const unsigned long long clk_6502_per_frm_diskAccelerator; //extern const unsigned long long clk_diskAcceleratorTimeout;