Browse Source

sound: move related function declarations to platform header. Remove unused.

pull/2/head
Alibek Omarov 6 years ago
parent
commit
80fc7209ed
  1. 1
      engine/client/s_main.c
  2. 16
      engine/client/sound.h
  3. 1
      engine/common/common.h
  4. 16
      engine/platform/platform.h
  5. 4
      engine/platform/sdl/events.c
  6. 15
      engine/platform/sdl/s_sdl.c

1
engine/client/s_main.c

@ -19,6 +19,7 @@ GNU General Public License for more details.
#include "con_nprint.h" #include "con_nprint.h"
#include "gl_local.h" #include "gl_local.h"
#include "pm_local.h" #include "pm_local.h"
#include "platform/platform.h"
#define SND_CLIP_DISTANCE 1000.0f #define SND_CLIP_DISTANCE 1000.0f

16
engine/client/sound.h

@ -237,22 +237,6 @@ typedef struct
int source; // may be game, menu, etc int source; // may be game, menu, etc
} bg_track_t; } 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) #define MAX_DYNAMIC_CHANNELS (60 + NUM_AMBIENTS)

1
engine/common/common.h

@ -1080,7 +1080,6 @@ void Cmd_Null_f( void );
// soundlib shared exports // soundlib shared exports
qboolean S_Init( void ); qboolean S_Init( void );
void S_Shutdown( void ); void S_Shutdown( void );
void S_Activate( qboolean active );
void S_StopSound( int entnum, int channel, const char *soundname ); void S_StopSound( int entnum, int channel, const char *soundname );
int S_GetCurrentStaticSounds( soundlist_t *pout, int size ); int S_GetCurrentStaticSounds( soundlist_t *pout, int size );
void S_StopBackgroundTrack( void ); void S_StopBackgroundTrack( void );

16
engine/platform/platform.h

@ -90,6 +90,22 @@ int R_MaxVideoModes();
vidmode_t*R_GetVideoMode( int num ); vidmode_t*R_GetVideoMode( int num );
void* GL_GetProcAddress( const char *name ); // RenderAPI requirement 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 #endif // PLATFORM_H

4
engine/platform/sdl/events.c

@ -408,7 +408,7 @@ static void SDLash_EventFilter( SDL_Event *event )
IN_ActivateMouse(true); IN_ActivateMouse(true);
if( snd_mute_losefocus->value ) if( snd_mute_losefocus->value )
{ {
S_Activate( true ); SNDDMA_Activate( true );
} }
host.force_draw_version = true; host.force_draw_version = true;
host.force_draw_version_time = host.realtime + FORCE_DRAW_VERSION_TIME; host.force_draw_version_time = host.realtime + FORCE_DRAW_VERSION_TIME;
@ -427,7 +427,7 @@ static void SDLash_EventFilter( SDL_Event *event )
IN_DeactivateMouse(); IN_DeactivateMouse();
if( snd_mute_losefocus->value ) if( snd_mute_losefocus->value )
{ {
S_Activate( false ); SNDDMA_Activate( false );
} }
host.force_draw_version = true; host.force_draw_version = true;
host.force_draw_version_time = host.realtime + 2; host.force_draw_version_time = host.realtime + 2;

15
engine/platform/sdl/s_sdl.c

@ -14,6 +14,7 @@ GNU General Public License for more details.
*/ */
#include "common.h" #include "common.h"
#include "platform/platform.h"
#if XASH_SOUND == SOUND_SDL #if XASH_SOUND == SOUND_SDL
#include "sound.h" #include "sound.h"
@ -238,23 +239,13 @@ void SNDDMA_Shutdown( void )
/* /*
=========== ===========
S_PrintDeviceName SNDDMA_Activate
===========
*/
void S_PrintDeviceName( void )
{
Msg( "Audio: SDL (driver: %s)\n", SDL_GetCurrentAudioDriver( ) );
}
/*
===========
S_Activate
Called when the main window gains or loses focus. Called when the main window gains or loses focus.
The window have been destroyed and recreated The window have been destroyed and recreated
between a deactivate and an activate. between a deactivate and an activate.
=========== ===========
*/ */
void S_Activate( qboolean active ) void SNDDMA_Activate( qboolean active )
{ {
SDL_PauseAudioDevice( sdl_dev, !active ); SDL_PauseAudioDevice( sdl_dev, !active );
} }

Loading…
Cancel
Save