From e6a6edc9fa6081f5fb17a72788a33e29cb103ae5 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sun, 13 Aug 2023 08:28:25 +0100 Subject: These can fail and is reason to not have sound It is better to disable sound completely to avoid crashes or unwanted behaviour. --- src/sound.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/sound.c b/src/sound.c index bf0c7be..86f6388 100644 --- a/src/sound.c +++ b/src/sound.c @@ -56,7 +56,9 @@ uint8_t sound_init() } /* 1 voice for effects */ - MikMod_SetNumVoices(-1, 1); + if (MikMod_SetNumVoices(-1, 1)) + /* has_sound is 0 */ + return 1; /* needs a song playing to get effects; have a "silence" pattern on 0 */ music = Player_LoadMem((const char *)binary_music_start, (size_t)&binary_music_size, 8, 0); @@ -64,7 +66,9 @@ uint8_t sound_init() return 0; Player_Start(music); - MikMod_EnableOutput(); + if (MikMod_EnableOutput()) + /* has_sound is 0 */ + return 1; has_sound = 1; return 1; -- cgit v1.2.3