Codechange: Remove ability for SDL to be dynamically loaded on Windows
This commit is contained in:

committed by
Patric Stout

parent
63fe6c6598
commit
c3bc7d657e
@@ -14,7 +14,6 @@
|
||||
#include "../stdafx.h"
|
||||
|
||||
#include "../mixer.h"
|
||||
#include "../sdl.h"
|
||||
#include "sdl_s.h"
|
||||
#include <SDL.h>
|
||||
|
||||
@@ -38,8 +37,14 @@ const char *SoundDriver_SDL::Start(const char * const *parm)
|
||||
{
|
||||
SDL_AudioSpec spec;
|
||||
|
||||
const char *s = SdlOpen(SDL_INIT_AUDIO);
|
||||
if (s != NULL) return s;
|
||||
/* Only initialise SDL if the video driver hasn't done it already */
|
||||
int ret_code = 0;
|
||||
if (SDL_WasInit(SDL_INIT_EVERYTHING) == 0) {
|
||||
ret_code = SDL_Init(SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE);
|
||||
} else if (SDL_WasInit(SDL_INIT_AUDIO) == 0) {
|
||||
ret_code = SDL_InitSubSystem(SDL_INIT_AUDIO);
|
||||
}
|
||||
if (ret_code == -1) return SDL_GetError();
|
||||
|
||||
spec.freq = GetDriverParamInt(parm, "hz", 44100);
|
||||
spec.format = AUDIO_S16SYS;
|
||||
@@ -47,15 +52,18 @@ const char *SoundDriver_SDL::Start(const char * const *parm)
|
||||
spec.samples = GetDriverParamInt(parm, "samples", 1024);
|
||||
spec.callback = fill_sound_buffer;
|
||||
MxInitialize(spec.freq);
|
||||
SDL_CALL SDL_OpenAudio(&spec, &spec);
|
||||
SDL_CALL SDL_PauseAudio(0);
|
||||
SDL_OpenAudio(&spec, &spec);
|
||||
SDL_PauseAudio(0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void SoundDriver_SDL::Stop()
|
||||
{
|
||||
SDL_CALL SDL_CloseAudio();
|
||||
SdlClose(SDL_INIT_AUDIO);
|
||||
SDL_CloseAudio();
|
||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||
if (SDL_WasInit(SDL_INIT_EVERYTHING) == 0) {
|
||||
SDL_Quit(); // If there's nothing left, quit SDL
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* WITH_SDL */
|
||||
|
Reference in New Issue
Block a user