12 #include "../stdafx.h"
18 #include "../safeguards.h"
30 MxMixSamples(stream, len / 4);
36 SDL_AudioSpec spec_actual;
40 if (SDL_WasInit(SDL_INIT_EVERYTHING) == 0) {
41 ret_code = SDL_Init(SDL_INIT_AUDIO);
42 }
else if (SDL_WasInit(SDL_INIT_AUDIO) == 0) {
43 ret_code = SDL_InitSubSystem(SDL_INIT_AUDIO);
45 if (ret_code == -1)
return SDL_GetError();
48 spec.format = AUDIO_S16SYS;
52 SDL_AudioDeviceID dev = SDL_OpenAudioDevice(
nullptr, 0, &spec, &spec_actual, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE);
53 MxInitialize(spec_actual.freq);
54 SDL_PauseAudioDevice(dev, 0);
61 SDL_QuitSubSystem(SDL_INIT_AUDIO);
62 if (SDL_WasInit(SDL_INIT_EVERYTHING) == 0) {
Factory for the SDL sound driver.
std::optional< std::string_view > Start(const StringList ¶m) override
Start this driver.
void Stop() override
Stop this driver.
int GetDriverParamInt(const StringList &parm, const char *name, int def)
Get an integer parameter the list of parameters.
static FSoundDriver_SDL iFSoundDriver_SDL
Factory for the SDL sound driver.
static void CDECL fill_sound_buffer(void *, Uint8 *stream, int len)
Callback that fills the sound buffer.
Base for playing sound via SDL.
std::vector< std::string > StringList
Type for a list of strings.