Use enum class for MVE_sndInit argument

This commit is contained in:
Kp 2023-05-06 19:26:19 +00:00
parent 4bdc31a729
commit 53a9ce8823
3 changed files with 13 additions and 7 deletions

View File

@ -236,7 +236,7 @@ static int mve_audio_bufhead=0;
static int mve_audio_buftail=0;
static int mve_audio_playing=0;
static unsigned mve_audio_flags;
static int mve_audio_enabled = 1;
static MVE_play_sounds mve_audio_enabled;
static std::unique_ptr<SDL_AudioSpec> mve_audio_spec;
static void mve_audio_callback(void *, unsigned char *stream, int len)
@ -307,7 +307,7 @@ int MVESTREAM::handle_mve_segment_initaudiobuffers(unsigned char minor, const un
int sample_rate;
int desired_buffer;
if (!mve_audio_enabled)
if (mve_audio_enabled == MVE_play_sounds::silent)
return 1;
if (mve_audio_spec)
@ -736,7 +736,7 @@ void MVE_rmHoldMovie()
}
void MVE_sndInit(int x)
void MVE_sndInit(MVE_play_sounds x)
{
mve_audio_enabled = (x == -1 ? 0 : 1);
mve_audio_enabled = x;
}

View File

@ -16,6 +16,12 @@ enum class MVE_StepStatus
EndOfFile = 1,
};
enum class MVE_play_sounds : bool
{
silent,
enabled,
};
struct MVESTREAM;
struct MVE_videoSpec {
@ -32,7 +38,7 @@ void MVE_rmEndMovie(std::unique_ptr<MVESTREAM> mve);
void MVE_getVideoSpec(MVE_videoSpec *vSpec);
void MVE_sndInit(int x);
void MVE_sndInit(MVE_play_sounds);
void MovieShowFrame(const uint8_t *buf, int dstx, int dsty, int bufw, int bufh, int sw, int sh);
void MovieSetPalette(const unsigned char *p, unsigned start, unsigned count);

View File

@ -144,7 +144,7 @@ movie_play_status PlayMovie(const std::span<const char> subtitles, const char *c
digi_close();
// Start sound
MVE_sndInit(!CGameArg.SndNoSound ? 1 : -1);
MVE_sndInit(!CGameArg.SndNoSound ? MVE_play_sounds::enabled : MVE_play_sounds::silent);
const auto ret = RunMovie(name, subtitles, !GameArg.GfxSkipHiresMovie, must_have, -1, -1);
@ -444,7 +444,7 @@ const MVESTREAM *InitRobotMovie(const char *filename, MVESTREAM_ptr_t &pMovie)
con_printf(CON_DEBUG, "RoboFile=%s", filename);
MVE_sndInit(-1); //tell movies to play no sound for robots
MVE_sndInit(MVE_play_sounds::silent); //tell movies to play no sound for robots
auto &&[RoboFile, physfserr] = PHYSFSRWOPS_openRead(filename);
if (!RoboFile)