diff --git a/libmve/mvelib.h b/libmve/mvelib.h index 114a6035..abb1d34f 100644 --- a/libmve/mvelib.h +++ b/libmve/mvelib.h @@ -75,7 +75,8 @@ void MVE_rmEndMovie(MVESTREAM *mve); void MVE_getVideoSpec(MVE_videoSpec *vSpec); -void MVE_sndInit(int x); +// Initialize MVE sound. Set `enable` to false if sound should not be enabled. +void MVE_sndInit(const bool enable); void MVE_ioCallbacks(mve_cb_Read io_read); void MVE_memCallbacks(mve_cb_Alloc mem_alloc, mve_cb_Free mem_free); diff --git a/libmve/mveplay.cpp b/libmve/mveplay.cpp index 7c672d13..272e47fa 100644 --- a/libmve/mveplay.cpp +++ b/libmve/mveplay.cpp @@ -202,7 +202,7 @@ static int play_audio_handler(unsigned char major, unsigned char minor, unsigned static int audio_data_handler(unsigned char major, unsigned char minor, unsigned char *data, int len, void *context) { #ifdef AUDIO static const int selected_chan = 1; - if (snd_ds->IsInitialized()) { + if (snd_ds && snd_ds->IsInitialized()) { int chan = get_ushort(data + 2); int size = get_ushort(data + 4); if (chan & selected_chan) { @@ -470,11 +470,12 @@ void MVE_rmEndMovie(MVESTREAM *mve) { void MVE_rmHoldMovie() { timer_started = 0; } -void MVE_sndInit(int x) { +void MVE_sndInit(const bool enable) { #ifdef AUDIO - if (x == -1) - mve_audio_enabled = 0; - else + if (enable) { mve_audio_enabled = 1; + } else { + mve_audio_enabled = 0; + } #endif } diff --git a/movie/d3movie.cpp b/movie/d3movie.cpp index 01aa91b6..7832f6cf 100644 --- a/movie/d3movie.cpp +++ b/movie/d3movie.cpp @@ -18,6 +18,7 @@ #include +#include "args.h" #include "movie.h" #include "mvelib.h" #include "pserror.h" @@ -479,7 +480,7 @@ void mve_ClearRect(int16_t x1, int16_t y1, int16_t x2, int16_t y2) { #ifndef NO_MOVIES bool mve_InitSound() { - MVE_sndInit(1); + MVE_sndInit(FindArg("-nosound") == 0); return true; }