engine: move soundlib onto client, only leave snd_utils with some functions that's engine core or server are dependent on
This commit is contained in:
parent
2d52dae69c
commit
6d00aef398
33 changed files with 28 additions and 32 deletions
|
@ -15,9 +15,6 @@ GNU General Public License for more details.
|
||||||
|
|
||||||
#include "soundlib.h"
|
#include "soundlib.h"
|
||||||
|
|
||||||
// global sound variables
|
|
||||||
sndlib_t sound;
|
|
||||||
|
|
||||||
static void Sound_Reset( void )
|
static void Sound_Reset( void )
|
||||||
{
|
{
|
||||||
// reset global variables
|
// reset global variables
|
|
@ -18,6 +18,9 @@ GNU General Public License for more details.
|
||||||
#include <SDL_audio.h>
|
#include <SDL_audio.h>
|
||||||
#endif // XASH_SDL
|
#endif // XASH_SDL
|
||||||
|
|
||||||
|
// global sound variables
|
||||||
|
sndlib_t sound;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============================================================================
|
=============================================================================
|
||||||
|
|
||||||
|
@ -25,14 +28,9 @@ GNU General Public License for more details.
|
||||||
|
|
||||||
=============================================================================
|
=============================================================================
|
||||||
*/
|
*/
|
||||||
// stub
|
|
||||||
static const loadwavfmt_t load_null[] =
|
|
||||||
{
|
|
||||||
{ NULL, NULL, NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
static const loadwavfmt_t load_game[] =
|
static const loadwavfmt_t load_game[] =
|
||||||
{
|
{
|
||||||
|
#ifndef XASH_DEDICATED
|
||||||
{ DEFAULT_SOUNDPATH "%s%s.%s", "wav", Sound_LoadWAV },
|
{ DEFAULT_SOUNDPATH "%s%s.%s", "wav", Sound_LoadWAV },
|
||||||
{ "%s%s.%s", "wav", Sound_LoadWAV },
|
{ "%s%s.%s", "wav", Sound_LoadWAV },
|
||||||
{ DEFAULT_SOUNDPATH "%s%s.%s", "mp3", Sound_LoadMPG },
|
{ DEFAULT_SOUNDPATH "%s%s.%s", "mp3", Sound_LoadMPG },
|
||||||
|
@ -41,7 +39,13 @@ static const loadwavfmt_t load_game[] =
|
||||||
{ "%s%s.%s", "ogg", Sound_LoadOggVorbis },
|
{ "%s%s.%s", "ogg", Sound_LoadOggVorbis },
|
||||||
{ DEFAULT_SOUNDPATH "%s%s.%s", "opus", Sound_LoadOggOpus },
|
{ DEFAULT_SOUNDPATH "%s%s.%s", "opus", Sound_LoadOggOpus },
|
||||||
{ "%s%s.%s", "opus", Sound_LoadOggOpus },
|
{ "%s%s.%s", "opus", Sound_LoadOggOpus },
|
||||||
{ NULL, NULL, NULL }
|
#else // we only need extensions
|
||||||
|
{ NULL, "wav" },
|
||||||
|
{ NULL, "mp3" },
|
||||||
|
{ NULL, "ogg" },
|
||||||
|
{ NULL, "opus" },
|
||||||
|
#endif
|
||||||
|
{ NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -51,19 +55,20 @@ static const loadwavfmt_t load_game[] =
|
||||||
|
|
||||||
=============================================================================
|
=============================================================================
|
||||||
*/
|
*/
|
||||||
// stub
|
|
||||||
static const streamfmt_t stream_null[] =
|
|
||||||
{
|
|
||||||
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
static const streamfmt_t stream_game[] =
|
static const streamfmt_t stream_game[] =
|
||||||
{
|
{
|
||||||
|
#ifndef XASH_DEDICATED
|
||||||
{ "%s%s.%s", "mp3", Stream_OpenMPG, Stream_ReadMPG, Stream_SetPosMPG, Stream_GetPosMPG, Stream_FreeMPG },
|
{ "%s%s.%s", "mp3", Stream_OpenMPG, Stream_ReadMPG, Stream_SetPosMPG, Stream_GetPosMPG, Stream_FreeMPG },
|
||||||
{ "%s%s.%s", "wav", Stream_OpenWAV, Stream_ReadWAV, Stream_SetPosWAV, Stream_GetPosWAV, Stream_FreeWAV },
|
{ "%s%s.%s", "wav", Stream_OpenWAV, Stream_ReadWAV, Stream_SetPosWAV, Stream_GetPosWAV, Stream_FreeWAV },
|
||||||
{ "%s%s.%s", "ogg", Stream_OpenOggVorbis, Stream_ReadOggVorbis, Stream_SetPosOggVorbis, Stream_GetPosOggVorbis, Stream_FreeOggVorbis },
|
{ "%s%s.%s", "ogg", Stream_OpenOggVorbis, Stream_ReadOggVorbis, Stream_SetPosOggVorbis, Stream_GetPosOggVorbis, Stream_FreeOggVorbis },
|
||||||
{ "%s%s.%s", "opus", Stream_OpenOggOpus, Stream_ReadOggOpus, Stream_SetPosOggOpus, Stream_GetPosOggOpus, Stream_FreeOggOpus },
|
{ "%s%s.%s", "opus", Stream_OpenOggOpus, Stream_ReadOggOpus, Stream_SetPosOggOpus, Stream_GetPosOggOpus, Stream_FreeOggOpus },
|
||||||
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL }
|
#else // we only need extensions
|
||||||
|
{ NULL, "mp3" },
|
||||||
|
{ NULL, "wav" },
|
||||||
|
{ NULL, "ogg" },
|
||||||
|
{ NULL, "opus" },
|
||||||
|
#endif
|
||||||
|
{ NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
void Sound_Init( void )
|
void Sound_Init( void )
|
||||||
|
@ -71,18 +76,10 @@ void Sound_Init( void )
|
||||||
// init pools
|
// init pools
|
||||||
host.soundpool = Mem_AllocPool( "SoundLib Pool" );
|
host.soundpool = Mem_AllocPool( "SoundLib Pool" );
|
||||||
|
|
||||||
// install image formats (can be re-install later by Sound_Setup)
|
// install sound formats
|
||||||
switch( host.type )
|
sound.loadformats = load_game;
|
||||||
{
|
sound.streamformat = stream_game;
|
||||||
case HOST_NORMAL:
|
|
||||||
sound.loadformats = load_game;
|
|
||||||
sound.streamformat = stream_game;
|
|
||||||
break;
|
|
||||||
default: // all other instances not using soundlib or will be reinstalling later
|
|
||||||
sound.loadformats = load_null;
|
|
||||||
sound.streamformat = stream_null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
sound.tempbuffer = NULL;
|
sound.tempbuffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,6 @@ def build(bld):
|
||||||
'common/*.c',
|
'common/*.c',
|
||||||
'common/imagelib/*.c',
|
'common/imagelib/*.c',
|
||||||
'common/soundlib/*.c',
|
'common/soundlib/*.c',
|
||||||
'common/soundlib/libmpg/*.c',
|
|
||||||
'server/*.c'])
|
'server/*.c'])
|
||||||
|
|
||||||
if bld.env.ENGINE_TESTS:
|
if bld.env.ENGINE_TESTS:
|
||||||
|
@ -234,7 +233,10 @@ def build(bld):
|
||||||
source += bld.path.ant_glob([
|
source += bld.path.ant_glob([
|
||||||
'client/*.c',
|
'client/*.c',
|
||||||
'client/vgui/*.c',
|
'client/vgui/*.c',
|
||||||
'client/avi/*.c'])
|
'client/avi/*.c',
|
||||||
|
'client/soundlib/*.c',
|
||||||
|
'client/soundlib/libmpg/*.c',
|
||||||
|
])
|
||||||
is_cxx_link = True
|
is_cxx_link = True
|
||||||
libs += ['bzip2', 'MultiEmulator']
|
libs += ['bzip2', 'MultiEmulator']
|
||||||
|
|
||||||
|
@ -264,7 +266,7 @@ def build(bld):
|
||||||
bld(source = source,
|
bld(source = source,
|
||||||
target = 'xash',
|
target = 'xash',
|
||||||
features = features,
|
features = features,
|
||||||
includes = 'server client client/vgui',
|
includes = 'server client client/vgui common/soundlib',
|
||||||
use = libs,
|
use = libs,
|
||||||
install_path = install_path,
|
install_path = install_path,
|
||||||
nro_install_path = bld.env.BINDIR,
|
nro_install_path = bld.env.BINDIR,
|
||||||
|
|
Loading…
Add table
Reference in a new issue