mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
- make things compile again.
Let's hope it still works...
This commit is contained in:
parent
082fcfeef0
commit
8730ce552b
17 changed files with 41 additions and 378 deletions
|
@ -510,8 +510,8 @@ set( PLAT_WIN32_SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
set( PLAT_POSIX_SOURCES
|
set( PLAT_POSIX_SOURCES
|
||||||
audiolib/src/driver_sdl.cpp
|
#audiolib/src/driver_sdl.cpp
|
||||||
audiolib/src/sdlmusic.cpp
|
#audiolib/src/sdlmusic.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set( PLAT_SDL_SOURCES
|
set( PLAT_SDL_SOURCES
|
||||||
|
@ -702,11 +702,6 @@ set( FASTMATH_SOURCES
|
||||||
thirdparty/src/lz4.c
|
thirdparty/src/lz4.c
|
||||||
thirdparty/src/xxhash.c
|
thirdparty/src/xxhash.c
|
||||||
|
|
||||||
# Will we need this anymore with ZLib being available?
|
|
||||||
#thirdparty/src/miniz.c
|
|
||||||
#thirdparty/src/miniz_tdef.c
|
|
||||||
#thirdparty/src/miniz_tinfl.c
|
|
||||||
|
|
||||||
# Another bit of cruft just to make S(hit)DL happy...
|
# Another bit of cruft just to make S(hit)DL happy...
|
||||||
sdlappicon.cpp
|
sdlappicon.cpp
|
||||||
)
|
)
|
||||||
|
@ -714,7 +709,9 @@ set( FASTMATH_SOURCES
|
||||||
|
|
||||||
set (PCH_SOURCES
|
set (PCH_SOURCES
|
||||||
audiolib/src/drivers.cpp
|
audiolib/src/drivers.cpp
|
||||||
|
audiolib/src/driver_adlib.cpp
|
||||||
audiolib/src/driver_nosound.cpp
|
audiolib/src/driver_nosound.cpp
|
||||||
|
audiolib/src/driver_sdl.cpp
|
||||||
audiolib/src/flac.cpp
|
audiolib/src/flac.cpp
|
||||||
audiolib/src/formats.cpp
|
audiolib/src/formats.cpp
|
||||||
audiolib/src/fx_man.cpp
|
audiolib/src/fx_man.cpp
|
||||||
|
@ -722,9 +719,9 @@ set (PCH_SOURCES
|
||||||
audiolib/src/midi.cpp
|
audiolib/src/midi.cpp
|
||||||
audiolib/src/mix.cpp
|
audiolib/src/mix.cpp
|
||||||
audiolib/src/mixst.cpp
|
audiolib/src/mixst.cpp
|
||||||
audiolib/src/mpu401.cpp
|
|
||||||
audiolib/src/multivoc.cpp
|
audiolib/src/multivoc.cpp
|
||||||
audiolib/src/music.cpp
|
audiolib/src/music.cpp
|
||||||
|
audiolib/src/opl3.cpp
|
||||||
audiolib/src/pitch.cpp
|
audiolib/src/pitch.cpp
|
||||||
audiolib/src/vorbis.cpp
|
audiolib/src/vorbis.cpp
|
||||||
audiolib/src/xa.cpp
|
audiolib/src/xa.cpp
|
||||||
|
|
|
@ -132,6 +132,4 @@ void MV_UnhookMusicRoutine(void);
|
||||||
|
|
||||||
static inline void MV_SetPrintf(void (*function)(const char *, ...)) { if (function) MV_Printf = function; }
|
static inline void MV_SetPrintf(void (*function)(const char *, ...)) { if (function) MV_Printf = function; }
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -189,7 +189,7 @@ int SDLDrv_PCM_Init(int *mixrate, int *numchannels, void * initdata)
|
||||||
auto drivername = Xstrdup(SDL_GetCurrentAudioDriver());
|
auto drivername = Xstrdup(SDL_GetCurrentAudioDriver());
|
||||||
|
|
||||||
for (int i=0;drivername[i] != 0;++i)
|
for (int i=0;drivername[i] != 0;++i)
|
||||||
drivername[i] = toupperlookup[drivername[i]];
|
drivername[i] = toupper(drivername[i]);
|
||||||
|
|
||||||
auto devname = Xstrdup(SDL_GetAudioDeviceName(0, 0));
|
auto devname = Xstrdup(SDL_GetAudioDeviceName(0, 0));
|
||||||
auto pdevname = Bstrchr(devname, '(');
|
auto pdevname = Bstrchr(devname, '(');
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au>
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# include "driver_directsound.h"
|
# include "driver_directsound.h"
|
||||||
# include "driver_winmm.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int ASS_PCMSoundDriver = ASS_AutoDetect;
|
int ASS_PCMSoundDriver = ASS_AutoDetect;
|
||||||
|
@ -140,6 +139,7 @@ static struct {
|
||||||
nullptr,
|
nullptr,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#if 0
|
||||||
// Windows MultiMedia system
|
// Windows MultiMedia system
|
||||||
{
|
{
|
||||||
"WinMM",
|
"WinMM",
|
||||||
|
@ -160,6 +160,7 @@ static struct {
|
||||||
UNSUPPORTED_COMPLETELY
|
UNSUPPORTED_COMPLETELY
|
||||||
#endif
|
#endif
|
||||||
},
|
},
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,318 +0,0 @@
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
Copyright (C) 2010 EDuke32 developers and contributors
|
|
||||||
|
|
||||||
This file is part of EDuke32.
|
|
||||||
|
|
||||||
EDuke32 is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License version 2
|
|
||||||
as published by the Free Software Foundation.
|
|
||||||
|
|
||||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#include "compat.h"
|
|
||||||
#include "multivoc.h"
|
|
||||||
#include "music.h"
|
|
||||||
#include "vfs.h"
|
|
||||||
#include "winbits.h"
|
|
||||||
|
|
||||||
// fork/exec based external music player
|
|
||||||
#ifndef _WIN32
|
|
||||||
#include <signal.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
|
|
||||||
#define INVALID_HANDLE_VALUE -1
|
|
||||||
typedef pid_t proc_t;
|
|
||||||
#else
|
|
||||||
typedef HANDLE proc_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static char ** g_musicPlayerArgv;
|
|
||||||
static int g_musicPlayerEnabled;
|
|
||||||
static proc_t g_musicPlayerHandle = INVALID_HANDLE_VALUE;
|
|
||||||
static int g_musicPlayerReady;
|
|
||||||
static int8_t g_musicPlayerRestart;
|
|
||||||
static char * g_musicPlayerCommandLine;
|
|
||||||
|
|
||||||
static char g_musicFileName[BMAX_PATH];
|
|
||||||
static int g_musicFileNameArgvPos;
|
|
||||||
|
|
||||||
char const *errorMessage;
|
|
||||||
|
|
||||||
int MUSIC_Init(int SoundCard)
|
|
||||||
{
|
|
||||||
// Use an external music player
|
|
||||||
g_musicPlayerCommandLine = getenv("EDUKE32_MUSIC_CMD");
|
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER(SoundCard);
|
|
||||||
|
|
||||||
if (g_musicPlayerReady)
|
|
||||||
{
|
|
||||||
errorMessage = "MUSIC_Init: external player already initialized!";
|
|
||||||
return MUSIC_Error;
|
|
||||||
} // if
|
|
||||||
|
|
||||||
g_musicPlayerEnabled = (g_musicPlayerCommandLine && g_musicPlayerCommandLine[0]);
|
|
||||||
|
|
||||||
if (!g_musicPlayerEnabled)
|
|
||||||
{
|
|
||||||
errorMessage = "MUSIC_Init: no external player configured!";
|
|
||||||
return MUSIC_Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
MV_Printf("Using external music player: \"%s\"\n", g_musicPlayerCommandLine);
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
int ws=1, numargs=0, pagesize=Bgetpagesize();
|
|
||||||
char *c, *cmd;
|
|
||||||
size_t sz;
|
|
||||||
|
|
||||||
if (pagesize == -1)
|
|
||||||
{
|
|
||||||
errorMessage = "MUSIC_Init: unable to determine system page size";
|
|
||||||
return MUSIC_Error;
|
|
||||||
}
|
|
||||||
for (c=g_musicPlayerCommandLine; *c; c++)
|
|
||||||
{
|
|
||||||
if (isspace(*c))
|
|
||||||
ws = 1;
|
|
||||||
else if (ws)
|
|
||||||
{
|
|
||||||
ws = 0;
|
|
||||||
numargs++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (numargs == 0)
|
|
||||||
{
|
|
||||||
errorMessage = "MUSIC_Init: not enough arguments for external player";
|
|
||||||
return MUSIC_Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
sz = (numargs+2)*sizeof(char *) + (c-g_musicPlayerCommandLine+1);
|
|
||||||
sz = ((sz+pagesize-1)/pagesize)*pagesize;
|
|
||||||
g_musicPlayerArgv = (char **)Xaligned_alloc(pagesize, sz);
|
|
||||||
cmd = (char *)g_musicPlayerArgv + (numargs+2)*sizeof(intptr_t);
|
|
||||||
Bmemcpy(cmd, g_musicPlayerCommandLine, c-g_musicPlayerCommandLine+1);
|
|
||||||
|
|
||||||
ws = 1;
|
|
||||||
numargs = 0;
|
|
||||||
for (c=cmd; *c; c++)
|
|
||||||
{
|
|
||||||
if (isspace(*c))
|
|
||||||
{
|
|
||||||
ws = 1;
|
|
||||||
*c = 0;
|
|
||||||
}
|
|
||||||
else if (ws)
|
|
||||||
{
|
|
||||||
ws = 0;
|
|
||||||
g_musicPlayerArgv[numargs++] = c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g_musicFileNameArgvPos = numargs;
|
|
||||||
g_musicPlayerArgv[numargs] = g_musicFileName;
|
|
||||||
g_musicPlayerArgv[numargs+1] = nullptr;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (mprotect(g_musicPlayerArgv, sz, PROT_READ)==-1) // make argv and command string read-only
|
|
||||||
{
|
|
||||||
initprintf("MUSIC_Init: mprotect(): %s\n");
|
|
||||||
errorMessage = "MUSIC_Init: mprotect() failure";
|
|
||||||
return MUSIC_Error;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_musicPlayerReady = 1;
|
|
||||||
return MUSIC_Ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int MUSIC_Shutdown(void)
|
|
||||||
{
|
|
||||||
MUSIC_StopSong();
|
|
||||||
g_musicPlayerReady = 0;
|
|
||||||
|
|
||||||
return MUSIC_Ok;
|
|
||||||
} // MUSIC_Shutdown
|
|
||||||
|
|
||||||
int MUSIC_StopSong(void)
|
|
||||||
{
|
|
||||||
if (!g_musicPlayerEnabled)
|
|
||||||
return MUSIC_Ok;
|
|
||||||
|
|
||||||
if (g_musicPlayerHandle != INVALID_HANDLE_VALUE)
|
|
||||||
{
|
|
||||||
g_musicPlayerRestart = 0; // make SIGCHLD handler a no-op
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
struct timespec ts;
|
|
||||||
|
|
||||||
ts.tv_sec = 0;
|
|
||||||
ts.tv_nsec = 5000000; // sleep 5ms at most
|
|
||||||
|
|
||||||
kill(g_musicPlayerHandle, SIGTERM);
|
|
||||||
nanosleep(&ts, nullptr);
|
|
||||||
|
|
||||||
if (int ret = waitpid(g_musicPlayerHandle, nullptr, WNOHANG|WUNTRACED) != g_musicPlayerHandle)
|
|
||||||
{
|
|
||||||
if (ret==-1)
|
|
||||||
initprintf("%s: waitpid: %s\n", __func__, strerror(errno));
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// we tried to be nice, but no...
|
|
||||||
kill(g_musicPlayerHandle, SIGKILL);
|
|
||||||
|
|
||||||
initprintf("%s: SIGTERM timed out--trying SIGKILL\n", __func__);
|
|
||||||
|
|
||||||
if (waitpid(g_musicPlayerHandle, nullptr, WUNTRACED)==-1)
|
|
||||||
initprintf("%s: waitpid: %s\n", __func__, strerror(errno));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
TerminateProcess(g_musicPlayerHandle, 0);
|
|
||||||
#endif
|
|
||||||
g_musicPlayerHandle = INVALID_HANDLE_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return MUSIC_Ok;
|
|
||||||
} // MUSIC_StopSong
|
|
||||||
|
|
||||||
static int MUSIC_PlayExternal()
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
|
||||||
STARTUPINFO si;
|
|
||||||
PROCESS_INFORMATION pi;
|
|
||||||
|
|
||||||
ZeroMemory(&si,sizeof(si));
|
|
||||||
ZeroMemory(&pi,sizeof(pi));
|
|
||||||
si.cb = sizeof(si);
|
|
||||||
|
|
||||||
if (!CreateProcess(nullptr,g_musicPlayerCommandLine,nullptr,nullptr,0,0,nullptr,nullptr,&si,&pi))
|
|
||||||
{
|
|
||||||
MV_Printf("%s: CreateProcess: %s\n", __func__, windowsGetErrorMessage(GetLastError()));
|
|
||||||
return MUSIC_Error;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
g_musicPlayerHandle = pi.hProcess;
|
|
||||||
#else
|
|
||||||
proc_t pid = vfork();
|
|
||||||
|
|
||||||
if (pid==-1) // error
|
|
||||||
{
|
|
||||||
initprintf("%s: vfork: %s\n", __func__, strerror(errno));
|
|
||||||
return MUSIC_Error;
|
|
||||||
}
|
|
||||||
else if (pid==0) // child
|
|
||||||
{
|
|
||||||
// exec without PATH lookup
|
|
||||||
if (execv(g_musicPlayerArgv[0], g_musicPlayerArgv) < 0)
|
|
||||||
{
|
|
||||||
initprintf("%s: execv: %s\n", __func__, strerror(errno));
|
|
||||||
_exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // parent
|
|
||||||
{
|
|
||||||
g_musicPlayerHandle = pid;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return MUSIC_Ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
static void sigchld_handler(int signo)
|
|
||||||
{
|
|
||||||
if (g_musicPlayerHandle <= 0 || !g_musicPlayerRestart || signo != SIGCHLD)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int status;
|
|
||||||
|
|
||||||
if (waitpid(g_musicPlayerHandle, &status, WUNTRACED)==-1)
|
|
||||||
initprintf("%s: waitpid: %s\n", __func__, strerror(errno));
|
|
||||||
|
|
||||||
if (WIFEXITED(status) && WEXITSTATUS(status)==0)
|
|
||||||
{
|
|
||||||
// loop ...
|
|
||||||
MUSIC_PlayExternal();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int MUSIC_PlaySong(char *song, int songsize, int loopflag, const char *fn /*= nullptr*/)
|
|
||||||
{
|
|
||||||
if (!g_musicPlayerEnabled)
|
|
||||||
{
|
|
||||||
errorMessage = "MUSIC_Init: no external player configured!";
|
|
||||||
return MUSIC_Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
static int sigchld_handler_set;
|
|
||||||
|
|
||||||
if (!sigchld_handler_set)
|
|
||||||
{
|
|
||||||
struct sigaction sa;
|
|
||||||
sa.sa_handler=sigchld_handler;
|
|
||||||
sa.sa_flags=0;
|
|
||||||
sigemptyset(&sa.sa_mask);
|
|
||||||
|
|
||||||
if (sigaction(SIGCHLD, &sa, nullptr)==-1)
|
|
||||||
initprintf("%s: sigaction: %s\n", __func__, strerror(errno));
|
|
||||||
|
|
||||||
sigchld_handler_set = 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
auto ext = Xstrdup(fn);
|
|
||||||
auto const c = Bsnprintf(g_musicFileName, sizeof(g_musicFileName), "%s/external%s", Bgethomedir(), strtok(ext,"."));
|
|
||||||
g_musicFileName[c] = '\0';
|
|
||||||
Xfree(ext);
|
|
||||||
|
|
||||||
if (auto fp = buildvfs_fopen_write(g_musicFileName))
|
|
||||||
{
|
|
||||||
buildvfs_fwrite(song, 1, songsize, fp);
|
|
||||||
buildvfs_fclose(fp);
|
|
||||||
|
|
||||||
g_musicPlayerRestart = loopflag;
|
|
||||||
g_musicPlayerArgv[g_musicFileNameArgvPos] = g_musicFileName;
|
|
||||||
|
|
||||||
if (int retval = MUSIC_PlayExternal() != MUSIC_Ok)
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MV_Printf("%s: fopen: %s\n", __func__, strerror(errno));
|
|
||||||
return MUSIC_Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
return MUSIC_Ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MUSIC_Update(void)
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
|
||||||
if (g_musicPlayerHandle == INVALID_HANDLE_VALUE || !g_musicPlayerRestart)
|
|
||||||
return;
|
|
||||||
|
|
||||||
DWORD exitCode = -1;
|
|
||||||
|
|
||||||
GetExitCodeProcess(g_musicPlayerHandle, &exitCode);
|
|
||||||
|
|
||||||
if (exitCode != STILL_ACTIVE)
|
|
||||||
MUSIC_PlayExternal();
|
|
||||||
#endif
|
|
||||||
}
|
|
|
@ -1500,7 +1500,6 @@ int app_main(int argc, char const * const * argv)
|
||||||
#ifdef DEBUGGINGAIDS
|
#ifdef DEBUGGINGAIDS
|
||||||
extern int32_t (*check_filename_casing_fn)(void);
|
extern int32_t (*check_filename_casing_fn)(void);
|
||||||
check_filename_casing_fn = check_filename_casing;
|
check_filename_casing_fn = check_filename_casing;
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OSD_SetLogFile(APPBASENAME ".log");
|
OSD_SetLogFile(APPBASENAME ".log");
|
||||||
|
|
|
@ -32,6 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "renderlayer.h"
|
#include "renderlayer.h"
|
||||||
|
#include "al_midi.h"
|
||||||
|
|
||||||
BEGIN_BLD_NS
|
BEGIN_BLD_NS
|
||||||
|
|
||||||
|
@ -451,7 +452,7 @@ void InitMusicDevice(void)
|
||||||
DICTNODE *hTmb = gSoundRes.Lookup("GMTIMBRE", "TMB");
|
DICTNODE *hTmb = gSoundRes.Lookup("GMTIMBRE", "TMB");
|
||||||
if (hTmb)
|
if (hTmb)
|
||||||
AL_RegisterTimbreBank((unsigned char*)gSoundRes.Load(hTmb));
|
AL_RegisterTimbreBank((unsigned char*)gSoundRes.Load(hTmb));
|
||||||
MUSIC_SetVolume(MusicVolume);
|
MUSIC_SetVolume(mus_volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeinitMusicDevice(void)
|
void DeinitMusicDevice(void)
|
||||||
|
|
|
@ -71,6 +71,11 @@ enum {
|
||||||
CACHE1D_FIND_DRIVE = 4,
|
CACHE1D_FIND_DRIVE = 4,
|
||||||
CACHE1D_FIND_NOCURDIR = 8,
|
CACHE1D_FIND_NOCURDIR = 8,
|
||||||
|
|
||||||
|
BUILDVFS_FIND_FILE = 1,
|
||||||
|
BUILDVFS_FIND_DIR = 2,
|
||||||
|
BUILDVFS_FIND_DRIVE = 4,
|
||||||
|
BUILDVFS_FIND_NOCURDIR = 8,
|
||||||
|
|
||||||
CACHE1D_OPT_NOSTACK = 0x100,
|
CACHE1D_OPT_NOSTACK = 0x100,
|
||||||
|
|
||||||
// the lower the number, the higher the priority
|
// the lower the number, the higher the priority
|
||||||
|
@ -79,12 +84,13 @@ enum {
|
||||||
CACHE1D_SOURCE_PATH = 2, // + path stack depth
|
CACHE1D_SOURCE_PATH = 2, // + path stack depth
|
||||||
CACHE1D_SOURCE_ZIP = 0x7ffffffe,
|
CACHE1D_SOURCE_ZIP = 0x7ffffffe,
|
||||||
CACHE1D_SOURCE_GRP = 0x7fffffff,
|
CACHE1D_SOURCE_GRP = 0x7fffffff,
|
||||||
|
BUILDVFS_SOURCE_GRP = 0x7fffffff,
|
||||||
};
|
};
|
||||||
typedef struct _CACHE1D_FIND_REC {
|
typedef struct _CACHE1D_FIND_REC {
|
||||||
char *name;
|
char *name;
|
||||||
int32_t type, source;
|
int32_t type, source;
|
||||||
struct _CACHE1D_FIND_REC *next, *prev, *usera, *userb;
|
struct _CACHE1D_FIND_REC *next, *prev, *usera, *userb;
|
||||||
} CACHE1D_FIND_REC;
|
} CACHE1D_FIND_REC, BUILDVFS_FIND_REC;
|
||||||
int32_t klistaddentry(CACHE1D_FIND_REC **rec, const char *name, int32_t type, int32_t source);
|
int32_t klistaddentry(CACHE1D_FIND_REC **rec, const char *name, int32_t type, int32_t source);
|
||||||
void klistfree(CACHE1D_FIND_REC *rec);
|
void klistfree(CACHE1D_FIND_REC *rec);
|
||||||
CACHE1D_FIND_REC *klistpath(const char *path, const char *mask, int type);
|
CACHE1D_FIND_REC *klistpath(const char *path, const char *mask, int type);
|
||||||
|
|
|
@ -154,6 +154,15 @@ CUSTOM_CVARD(Int, mus_volume, 255, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "controls mus
|
||||||
if (self > 255) self = 255;
|
if (self > 255) self = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int MusicDevice;
|
||||||
|
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.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// HUD
|
// HUD
|
||||||
|
|
||||||
// This was particularly messy. EDuke and Rednukem had no consistent setting for this but a complex combination fo 4 CVARs and lots of mod flags controlling the HUD layout
|
// This was particularly messy. EDuke and Rednukem had no consistent setting for this but a complex combination fo 4 CVARs and lots of mod flags controlling the HUD layout
|
||||||
|
|
|
@ -48,6 +48,7 @@ EXTERN_CVAR(Int, snd_numchannels)
|
||||||
EXTERN_CVAR(Int, snd_numvoices)
|
EXTERN_CVAR(Int, snd_numvoices)
|
||||||
EXTERN_CVAR(Int, snd_speech)
|
EXTERN_CVAR(Int, snd_speech)
|
||||||
EXTERN_CVAR(Int, mus_volume)
|
EXTERN_CVAR(Int, mus_volume)
|
||||||
|
extern int MusicDevice;
|
||||||
|
|
||||||
EXTERN_CVAR(Int, hud_layout)
|
EXTERN_CVAR(Int, hud_layout)
|
||||||
EXTERN_CVAR(Int, hud_scale)
|
EXTERN_CVAR(Int, hud_scale)
|
||||||
|
|
|
@ -3237,7 +3237,7 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
|
||||||
{
|
{
|
||||||
snd_mixrate = soundrate;
|
snd_mixrate = soundrate;
|
||||||
snd_numvoices = soundvoices;
|
snd_numvoices = soundvoices;
|
||||||
ud.config.MusicDevice = musicdevice;
|
MusicDevice = musicdevice;
|
||||||
|
|
||||||
S_SoundShutdown();
|
S_SoundShutdown();
|
||||||
S_MusicShutdown();
|
S_MusicShutdown();
|
||||||
|
@ -4260,7 +4260,7 @@ static void Menu_AboutToStartDisplaying(Menu_t * m)
|
||||||
case MENU_ADVSOUND:
|
case MENU_ADVSOUND:
|
||||||
soundrate = snd_mixrate;
|
soundrate = snd_mixrate;
|
||||||
soundvoices = snd_numvoices;
|
soundvoices = snd_numvoices;
|
||||||
musicdevice = ud.config.MusicDevice;
|
musicdevice = MusicDevice;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -67,7 +67,7 @@ void S_SoundStartup(void)
|
||||||
|
|
||||||
initprintf("Initializing sound... ");
|
initprintf("Initializing sound... ");
|
||||||
|
|
||||||
int status = FX_Init(ud.config.NumVoices, ud.config.NumChannels, ud.config.MixRate, initdata);
|
int status = FX_Init(snd_numvoices, snd_numchannels, snd_mixrate, initdata);
|
||||||
if (status != FX_Ok)
|
if (status != FX_Ok)
|
||||||
{
|
{
|
||||||
initprintf("failed! %s\n", FX_ErrorString(status));
|
initprintf("failed! %s\n", FX_ErrorString(status));
|
||||||
|
@ -118,14 +118,14 @@ void S_MusicStartup(void)
|
||||||
initprintf("Initializing MIDI driver... ");
|
initprintf("Initializing MIDI driver... ");
|
||||||
|
|
||||||
int status;
|
int status;
|
||||||
if ((status = MUSIC_Init(ud.config.MusicDevice)) == MUSIC_Ok)
|
if ((status = MUSIC_Init(MusicDevice)) == MUSIC_Ok)
|
||||||
{
|
{
|
||||||
if (ud.config.MusicDevice == ASS_AutoDetect)
|
if (MusicDevice == ASS_AutoDetect)
|
||||||
ud.config.MusicDevice = MIDI_GetDevice();
|
MusicDevice = MIDI_GetDevice();
|
||||||
}
|
}
|
||||||
else if ((status = MUSIC_Init(ASS_AutoDetect)) == MUSIC_Ok)
|
else if ((status = MUSIC_Init(ASS_AutoDetect)) == MUSIC_Ok)
|
||||||
{
|
{
|
||||||
ud.config.MusicDevice = MIDI_GetDevice();
|
MusicDevice = MIDI_GetDevice();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "vfs.h"
|
#include "vfs.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include "files.h"
|
||||||
|
|
||||||
namespace SmackerCommon {
|
namespace SmackerCommon {
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "FileStream.h"
|
#include "FileStream.h"
|
||||||
|
#include "cache1d.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
namespace SmackerCommon {
|
namespace SmackerCommon {
|
||||||
|
|
|
@ -98,7 +98,7 @@ void S_MusicStartup(void)
|
||||||
{
|
{
|
||||||
initprintf("Initializing music...\n");
|
initprintf("Initializing music...\n");
|
||||||
|
|
||||||
if (MUSIC_Init(0, 0) == MUSIC_Ok || MUSIC_Init(1, 0) == MUSIC_Ok)
|
if (MUSIC_Init(MusicDevice) == MUSIC_Ok)
|
||||||
{
|
{
|
||||||
MUSIC_SetVolume(mus_volume);
|
MUSIC_SetVolume(mus_volume);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1131,7 +1131,7 @@ SoundStartup(void)
|
||||||
//snd_enabled = TRUE;
|
//snd_enabled = TRUE;
|
||||||
|
|
||||||
|
|
||||||
int status = FX_Init(NumVoices, NumChannels, MixRate, initdata);
|
int status = FX_Init(snd_numvoices, snd_numchannels, snd_mixrate, initdata);
|
||||||
if (status != FX_Ok)
|
if (status != FX_Ok)
|
||||||
{
|
{
|
||||||
buildprintf("Sound error: %s\n", FX_ErrorString(status));
|
buildprintf("Sound error: %s\n", FX_ErrorString(status));
|
||||||
|
@ -1199,11 +1199,11 @@ void MusicStartup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
MusicInitialized = TRUE;
|
MusicInitialized = TRUE;
|
||||||
MUSIC_SetVolume(gs.MusicVolume);
|
MUSIC_SetVolume(mus_volume);
|
||||||
|
|
||||||
auto fil = kopenFileReader("swtimbr.tmb", 0);
|
auto fil = kopenFileReader("swtimbr.tmb", 0);
|
||||||
|
|
||||||
if (fil.isOpem())
|
if (fil.isOpen())
|
||||||
{
|
{
|
||||||
auto tmb = fil.Read();
|
auto tmb = fil.Read();
|
||||||
if (tmb.Size())
|
if (tmb.Size())
|
||||||
|
|
Loading…
Reference in a new issue