From e8cf6c3d326368801bb44d97c4772dbb323087c2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 24 Oct 2019 21:02:07 +0200 Subject: [PATCH] - fixed mus_device CVar and reenabled WinMM device. --- source/CMakeLists.txt | 1 + source/audiolib/src/driver_winmm.h | 33 ++++++++++++++++++++++++++++++ source/audiolib/src/drivers.cpp | 3 +-- source/common/gamecvars.cpp | 4 ++-- 4 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 source/audiolib/src/driver_winmm.h diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index b3b23e303..37ff46e88 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -712,6 +712,7 @@ set (PCH_SOURCES audiolib/src/driver_adlib.cpp audiolib/src/driver_nosound.cpp audiolib/src/driver_sdl.cpp + audiolib/src/driver_winmm.cpp audiolib/src/flac.cpp audiolib/src/formats.cpp audiolib/src/fx_man.cpp diff --git a/source/audiolib/src/driver_winmm.h b/source/audiolib/src/driver_winmm.h new file mode 100644 index 000000000..51c71d2b6 --- /dev/null +++ b/source/audiolib/src/driver_winmm.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2009 Jonathon Fowler + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#include "midifuncs.h" + +int WinMMDrv_GetError(void); +const char *WinMMDrv_ErrorString( int ErrorNumber ); + +int WinMMDrv_MIDI_Init(midifuncs *); +void WinMMDrv_MIDI_Shutdown(void); +int WinMMDrv_MIDI_StartPlayback(void (*service)(void)); +void WinMMDrv_MIDI_HaltPlayback(void); +void WinMMDrv_MIDI_SetTempo(int tempo, int division); +void WinMMDrv_MIDI_Lock(void); +void WinMMDrv_MIDI_Unlock(void); + diff --git a/source/audiolib/src/drivers.cpp b/source/audiolib/src/drivers.cpp index 700fd06de..d33da4c5c 100644 --- a/source/audiolib/src/drivers.cpp +++ b/source/audiolib/src/drivers.cpp @@ -34,6 +34,7 @@ #ifdef _WIN32 # include "driver_directsound.h" +# include "driver_winmm.h" #endif int ASS_PCMSoundDriver = ASS_AutoDetect; @@ -139,7 +140,6 @@ static struct { nullptr, }, -#if 0 // Windows MultiMedia system { "WinMM", @@ -160,7 +160,6 @@ static struct { UNSUPPORTED_COMPLETELY #endif }, -#endif }; diff --git a/source/common/gamecvars.cpp b/source/common/gamecvars.cpp index d8dc6b4c9..038cc5a30 100644 --- a/source/common/gamecvars.cpp +++ b/source/common/gamecvars.cpp @@ -154,12 +154,12 @@ CUSTOM_CVARD(Int, mus_volume, 255, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "controls mus if (self > 255) self = 255; } -int MusicDevice = 1; +int MusicDevice = ASS_WinMM; CUSTOM_CVARD(Int, mus_device, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "selects music device") { if (self < 0) self = 0; else if (self > 1) self = 1; - else MusicDevice = self; // must be copied because it gets altered by the music code. + else MusicDevice = self? ASS_WinMM : ASS_OPL3; // must be copied because it gets altered by the music code. }