mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
Audiolib: Re-add a fixed version of old code for the SDL driver to initialize SDL as a whole or its audio subsystem if it has not yet been initialized.
Patch from NY00123. DONT_BUILD. git-svn-id: https://svn.eduke32.com/eduke32@6080 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
d5bd7681a0
commit
06a38e3873
1 changed files with 25 additions and 1 deletions
|
@ -45,7 +45,7 @@ enum {
|
|||
static int32_t ErrorCode = SDLErr_Ok;
|
||||
static int32_t Initialised = 0;
|
||||
static int32_t Playing = 0;
|
||||
// static int32_t StartedSDL = -1;
|
||||
static int32_t StartedSDL = -1;
|
||||
|
||||
static char *MixBuffer = 0;
|
||||
static int32_t MixBufferSize = 0;
|
||||
|
@ -144,6 +144,7 @@ const char *SDLDrv_ErrorString( int32_t ErrorNumber )
|
|||
|
||||
int32_t SDLDrv_PCM_Init(int32_t *mixrate, int32_t *numchannels, void * initdata)
|
||||
{
|
||||
uint32_t inited;
|
||||
int32_t err = 0;
|
||||
int32_t chunksize;
|
||||
uint16_t fmt;
|
||||
|
@ -155,6 +156,22 @@ int32_t SDLDrv_PCM_Init(int32_t *mixrate, int32_t *numchannels, void * initdata)
|
|||
SDLDrv_PCM_Shutdown();
|
||||
}
|
||||
|
||||
inited = SDL_WasInit(SDL_INIT_EVERYTHING);
|
||||
|
||||
if (inited == 0) {
|
||||
// nothing was initialised
|
||||
err = SDL_Init(SDL_INIT_AUDIO);
|
||||
StartedSDL = 0;
|
||||
} else if (!(inited & SDL_INIT_AUDIO)) {
|
||||
err = SDL_InitSubSystem(SDL_INIT_AUDIO);
|
||||
StartedSDL = 1;
|
||||
}
|
||||
|
||||
if (err < 0) {
|
||||
ErrorCode = SDLErr_InitSubSystem;
|
||||
return SDLErr_Error;
|
||||
}
|
||||
|
||||
chunksize = 512;
|
||||
#ifdef __ANDROID__
|
||||
chunksize = droidinfo.audio_buffer_size;
|
||||
|
@ -221,6 +238,13 @@ void SDLDrv_PCM_Shutdown(void)
|
|||
|
||||
SDL_DestroyMutex(EffectFence);
|
||||
|
||||
if (StartedSDL > 0) {
|
||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||
} else if (StartedSDL == 0) {
|
||||
SDL_Quit();
|
||||
}
|
||||
|
||||
StartedSDL = -1;
|
||||
Initialised = 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue