VIDEO: Explicitly initialize and cleanup SDL Audio subsystem

As mentioned in #873, there didn't appear to be a problem at runtime,
but the formal definition suggests SDL_InitSubSystem and its cleanup
should be called.  It is likely that, as a vestige of SDL 1.2,
SDL_OpenAudio is doing this under the covers.  No harm adding it.
This commit is contained in:
Mark Pizzolato 2020-06-10 07:30:36 -07:00
parent 0912a927f4
commit 6c6f66914d

View file

@ -2194,6 +2194,7 @@ if (!vid_beep_data) {
int i; int i;
SDL_AudioSpec desiredSpec; SDL_AudioSpec desiredSpec;
SDL_InitSubSystem (SDL_INIT_AUDIO);
memset (&desiredSpec, 0, sizeof(desiredSpec)); memset (&desiredSpec, 0, sizeof(desiredSpec));
desiredSpec.freq = SAMPLE_FREQUENCY; desiredSpec.freq = SAMPLE_FREQUENCY;
desiredSpec.format = AUDIO_S16SYS; desiredSpec.format = AUDIO_S16SYS;
@ -2216,6 +2217,7 @@ static void vid_beep_cleanup (void)
SDL_CloseAudio(); SDL_CloseAudio();
free (vid_beep_data); free (vid_beep_data);
vid_beep_data = NULL; vid_beep_data = NULL;
SDL_QuitSubSystem (SDL_INIT_AUDIO);
} }
void vid_beep_event (void) void vid_beep_event (void)