aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-08-13 08:28:25 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-08-13 08:28:25 +0100
commite6a6edc9fa6081f5fb17a72788a33e29cb103ae5 (patch)
tree9d680a90079a5d53656e1b2514ca234135216aaa
parenteab72cafb0ffb04d139beabd34be83a7e6480410 (diff)
downloadgold-mine-run-e6a6edc9fa6081f5fb17a72788a33e29cb103ae5.tar.gz
gold-mine-run-e6a6edc9fa6081f5fb17a72788a33e29cb103ae5.zip
These can fail and is reason to not have sound1.5
It is better to disable sound completely to avoid crashes or unwanted behaviour.
-rw-r--r--src/sound.c8
1 files changed, 6 insertions, 2 deletions
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;