From 80fc7209edf2512fec4c0ecb2f084181d23676ee Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 7 Jan 2019 04:07:01 +0300 Subject: [PATCH] sound: move related function declarations to platform header. Remove unused. --- engine/client/s_main.c | 1 + engine/client/sound.h | 16 ---------------- engine/common/common.h | 1 - engine/platform/platform.h | 16 ++++++++++++++++ engine/platform/sdl/events.c | 4 ++-- engine/platform/sdl/s_sdl.c | 15 +++------------ 6 files changed, 22 insertions(+), 31 deletions(-) diff --git a/engine/client/s_main.c b/engine/client/s_main.c index 8e1d3dac..e8345344 100644 --- a/engine/client/s_main.c +++ b/engine/client/s_main.c @@ -19,6 +19,7 @@ GNU General Public License for more details. #include "con_nprint.h" #include "gl_local.h" #include "pm_local.h" +#include "platform/platform.h" #define SND_CLIP_DISTANCE 1000.0f diff --git a/engine/client/sound.h b/engine/client/sound.h index 7a2194db..9aade622 100644 --- a/engine/client/sound.h +++ b/engine/client/sound.h @@ -237,22 +237,6 @@ typedef struct int source; // may be game, menu, etc } bg_track_t; -/* -==================================================================== - - SYSTEM SPECIFIC FUNCTIONS - -==================================================================== -*/ -// initializes cycling through a DMA buffer and returns information on it -qboolean SNDDMA_Init( void *hInst ); -int SNDDMA_GetSoundtime( void ); -void SNDDMA_Shutdown( void ); -void SNDDMA_BeginPainting( void ); -void SNDDMA_Submit( void ); -void SNDDMA_LockSound( void ); -void SNDDMA_UnlockSound( void ); - //==================================================================== #define MAX_DYNAMIC_CHANNELS (60 + NUM_AMBIENTS) diff --git a/engine/common/common.h b/engine/common/common.h index bdc349fd..301b140a 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -1080,7 +1080,6 @@ void Cmd_Null_f( void ); // soundlib shared exports qboolean S_Init( void ); void S_Shutdown( void ); -void S_Activate( qboolean active ); void S_StopSound( int entnum, int channel, const char *soundname ); int S_GetCurrentStaticSounds( soundlist_t *pout, int size ); void S_StopBackgroundTrack( void ); diff --git a/engine/platform/platform.h b/engine/platform/platform.h index 551f05a8..9506fbef 100644 --- a/engine/platform/platform.h +++ b/engine/platform/platform.h @@ -90,6 +90,22 @@ int R_MaxVideoModes(); vidmode_t*R_GetVideoMode( int num ); void* GL_GetProcAddress( const char *name ); // RenderAPI requirement +/* +============================================================================== + + AUDIO INPUT/OUTPUT +============================================================================== +*/ +// initializes cycling through a DMA buffer and returns information on it +qboolean SNDDMA_Init( void *hInst ); +int SNDDMA_GetSoundtime( void ); +void SNDDMA_Shutdown( void ); +void SNDDMA_BeginPainting( void ); +void SNDDMA_Submit( void ); +void SNDDMA_Activate( qboolean active ); // pause audio +// void SNDDMA_PrintDeviceName( void ); // unused +// void SNDDMA_LockSound( void ); // unused +// void SNDDMA_UnlockSound( void ); // unused #endif // PLATFORM_H diff --git a/engine/platform/sdl/events.c b/engine/platform/sdl/events.c index ee8523b0..d7f1d70a 100644 --- a/engine/platform/sdl/events.c +++ b/engine/platform/sdl/events.c @@ -408,7 +408,7 @@ static void SDLash_EventFilter( SDL_Event *event ) IN_ActivateMouse(true); if( snd_mute_losefocus->value ) { - S_Activate( true ); + SNDDMA_Activate( true ); } host.force_draw_version = true; host.force_draw_version_time = host.realtime + FORCE_DRAW_VERSION_TIME; @@ -427,7 +427,7 @@ static void SDLash_EventFilter( SDL_Event *event ) IN_DeactivateMouse(); if( snd_mute_losefocus->value ) { - S_Activate( false ); + SNDDMA_Activate( false ); } host.force_draw_version = true; host.force_draw_version_time = host.realtime + 2; diff --git a/engine/platform/sdl/s_sdl.c b/engine/platform/sdl/s_sdl.c index 7908678c..0c68a64b 100644 --- a/engine/platform/sdl/s_sdl.c +++ b/engine/platform/sdl/s_sdl.c @@ -14,6 +14,7 @@ GNU General Public License for more details. */ #include "common.h" +#include "platform/platform.h" #if XASH_SOUND == SOUND_SDL #include "sound.h" @@ -238,23 +239,13 @@ void SNDDMA_Shutdown( void ) /* =========== -S_PrintDeviceName -=========== -*/ -void S_PrintDeviceName( void ) -{ - Msg( "Audio: SDL (driver: %s)\n", SDL_GetCurrentAudioDriver( ) ); -} - -/* -=========== -S_Activate +SNDDMA_Activate Called when the main window gains or loses focus. The window have been destroyed and recreated between a deactivate and an activate. =========== */ -void S_Activate( qboolean active ) +void SNDDMA_Activate( qboolean active ) { SDL_PauseAudioDevice( sdl_dev, !active ); }