engine: platform: add audio capture shutdown functions

This commit is contained in:
Alibek Omarov 2022-08-20 03:17:51 +03:00
parent 905bbf1515
commit 22ff45f5d0
5 changed files with 33 additions and 3 deletions

View File

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

View File

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

View File

@ -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 );

View File

@ -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 )
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
*/
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

View File

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