From 1427e04e126c90810164bee34dd4f898d2f39f91 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 16 Feb 2024 01:07:24 +0100 Subject: Implement sound support --- src/ahoy/gui.c | 6 ++++++ src/ahoy/gui.h | 1 + src/ahoy/main.c | 7 +++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/ahoy/gui.c b/src/ahoy/gui.c index fd6a660..82a351e 100644 --- a/src/ahoy/gui.c +++ b/src/ahoy/gui.c @@ -111,6 +111,12 @@ noclr: SDL_RenderPresent(rndr); } +void +auplay(bool stop) +{ + SDL_PauseAudioDevice(adev, stop); +} + void readkb(void) { diff --git a/src/ahoy/gui.h b/src/ahoy/gui.h index e262620..5312d4e 100644 --- a/src/ahoy/gui.h +++ b/src/ahoy/gui.h @@ -14,6 +14,7 @@ void wininit(void); void winfree(void); void winclr(void); void windrw(void); +void auplay(bool); void readkb(void); extern guistate gs; diff --git a/src/ahoy/main.c b/src/ahoy/main.c index 10e79e6..69a7946 100644 --- a/src/ahoy/main.c +++ b/src/ahoy/main.c @@ -86,10 +86,9 @@ update_timers(void) if (c8.ST > 0) { c8.ST--; - // SDL_PauseAudioDevice(adev, 0); // Play sound - } else { - // SDL_PauseAudioDevice(adev, 1); // Pause sound - } + auplay(false); + } else + auplay(true); } void -- cgit v1.2.3