Browse Source

engine: platform: add audio capture shutdown functions

pull/2/head
Alibek Omarov 2 years ago
parent
commit
22ff45f5d0
  1. 5
      engine/platform/android/snd_opensles.c
  2. 5
      engine/platform/linux/s_alsa.c
  3. 1
      engine/platform/platform.h
  4. 20
      engine/platform/sdl/s_sdl.c
  5. 5
      engine/platform/stub/s_stub.c

5
engine/platform/android/snd_opensles.c

@ -268,5 +268,10 @@ qboolean VoiceCapture_RecordStart( void ) @@ -268,5 +268,10 @@ qboolean VoiceCapture_RecordStart( void )
void VoiceCapture_RecordStop( void )
{
}
void VoiceCapture_Shutdown( void )
{
}
#endif

5
engine/platform/linux/s_alsa.c

@ -356,4 +356,9 @@ void VoiceCapture_RecordStop( void ) @@ -356,4 +356,9 @@ void VoiceCapture_RecordStop( void )
}
void VoiceCapture_Shutdown( void )
{
}
#endif

1
engine/platform/platform.h

@ -162,6 +162,7 @@ void SNDDMA_Activate( qboolean active ); // pause audio @@ -162,6 +162,7 @@ void SNDDMA_Activate( qboolean active ); // pause audio
// void SNDDMA_LockSound( void ); // unused
// void SNDDMA_UnlockSound( void ); // unused
qboolean VoiceCapture_Init( void );
void VoiceCapture_Shutdown( void );
qboolean VoiceCapture_RecordStart( void );
void VoiceCapture_RecordStop( void );

20
engine/platform/sdl/s_sdl.c

@ -44,7 +44,7 @@ so it can unlock and free the data block after it has been played. @@ -44,7 +44,7 @@ so it can unlock and free the data block after it has been played.
=======================================================================
*/
static int sdl_dev;
static SDL_AudioDeviceID in_dev;
static SDL_AudioDeviceID in_dev = 0;
static SDL_AudioFormat sdl_format;
//static qboolean snd_firsttime = true;
@ -259,7 +259,7 @@ qboolean VoiceCapture_Init( void ) @@ -259,7 +259,7 @@ qboolean VoiceCapture_Init( void )
in_dev = SDL_OpenAudioDevice( NULL, SDL_TRUE, &wanted, &spec, 0 );
if( SDLash_IsAudioError( in_dev ) )
if( SDLash_IsAudioError( in_dev ))
{
Con_Printf( "VoiceCapture_Init: error creating capture device (%s)\n", SDL_GetError() );
return false;
@ -288,7 +288,21 @@ VoiceCapture_RecordStop @@ -288,7 +288,21 @@ VoiceCapture_RecordStop
*/
void VoiceCapture_RecordStop( void )
{
SDL_PauseAudioDevice( in_dev, SDL_TRUE );
if( in_dev )
SDL_PauseAudioDevice( in_dev, SDL_TRUE );
}
/*
==========
VoiceCapture_Shutdown
==========
*/
void VoiceCapture_Shutdown( void )
{
if( !in_dev )
return;
SDL_CloseAudioDevice( in_dev );
}
#endif // XASH_SOUND == SOUND_SDL

5
engine/platform/stub/s_stub.c

@ -109,5 +109,10 @@ void VoiceCapture_RecordStop( void ) @@ -109,5 +109,10 @@ void VoiceCapture_RecordStop( void )
}
void VoiceCapture_Shutdown( void )
{
}
#endif
#endif

Loading…
Cancel
Save