From d06aa1c736d752c9fe31063a134c00a90e686372 Mon Sep 17 00:00:00 2001 From: Muzychenko Andrey <33288308+k4zmu2a@users.noreply.github.com> Date: Sun, 17 Oct 2021 12:00:30 +0300 Subject: [PATCH] Changed SDL_mixer version guard. SDL_MIXER_COMPILEDVERSION is not in Windows release of mixer v2.0.1, so it is back to basics with SDL_MIXER_PATCHLEVEL. MIX_INIT_FLUIDSYNTH was renamed in 2.0.2, according to headers from Windows releases. Ref PR #42, #46 --- SpaceCadetPinball/Sound.cpp | 10 +--------- SpaceCadetPinball/pch.h | 8 ++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/SpaceCadetPinball/Sound.cpp b/SpaceCadetPinball/Sound.cpp index dfcc4bd..4fa9336 100644 --- a/SpaceCadetPinball/Sound.cpp +++ b/SpaceCadetPinball/Sound.cpp @@ -1,21 +1,13 @@ #include "pch.h" #include "Sound.h" -#ifndef SDL_MIXER_VERSION_ATLEAST -#define SDL_MIXER_VERSION_ATLEAST(X, Y, Z) (SDL_MIXER_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) -#endif - int Sound::num_channels; bool Sound::enabled_flag = false; int* Sound::TimeStamps = nullptr; bool Sound::Init(int channels, bool enableFlag) { -#if SDL_MIXER_VERSION_ATLEAST(2, 0, 3) - Mix_Init(MIX_INIT_MID); -#else - Mix_Init(MIX_INIT_FLUIDSYNTH); -#endif + Mix_Init(MIX_INIT_MID_Proxy); auto result = Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, 2, 1024); SetChannels(channels); Enable(enableFlag); diff --git a/SpaceCadetPinball/pch.h b/SpaceCadetPinball/pch.h index c1fa767..9a49af3 100644 --- a/SpaceCadetPinball/pch.h +++ b/SpaceCadetPinball/pch.h @@ -34,6 +34,14 @@ #include "SDL.h" #include +// MIX_INIT_FLUIDSYNTH was renamed to MIX_INIT_MID in SDL_mixer v2.0.2 +constexpr int MIX_INIT_MID_Proxy = +#if SDL_MIXER_PATCHLEVEL >= 2 + MIX_INIT_MID; +#else + MIX_INIT_FLUIDSYNTH; +#endif + //https://github.com/ocornut/imgui 7b913db1ce9dd2fd98e5790aa59974dd4496be3b #include "imgui.h" #include "imgui_internal.h"