aboutsummaryrefslogtreecommitdiff
path: root/src/libui_sdl
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2018-12-13 18:51:01 +0100
committerStapleButter <thetotalworm@gmail.com>2018-12-13 18:51:01 +0100
commiteb1289c2fa4e1ab9c0cabb24c5bfe6e27a036f2d (patch)
treea7b04f6b54d3f6b4383d8ed2b9314480e64b92e6 /src/libui_sdl
parentaa8c84f040e05d154918e6b389c98ab73c6ba1b8 (diff)
release audio devices properly
Diffstat (limited to 'src/libui_sdl')
-rw-r--r--src/libui_sdl/main.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp
index fdbe795..75568a5 100644
--- a/src/libui_sdl/main.cpp
+++ b/src/libui_sdl/main.cpp
@@ -1718,14 +1718,14 @@ int main(int argc, char** argv)
whatIwant.channels = 1;
whatIwant.samples = 1024;
whatIwant.callback = MicCallback;
- audio = SDL_OpenAudioDevice(NULL, 1, &whatIwant, &whatIget, 0);
- if (!audio)
+ SDL_AudioDeviceID mic = SDL_OpenAudioDevice(NULL, 1, &whatIwant, &whatIget, 0);
+ if (!mic)
{
printf("Mic init failed: %s\n", SDL_GetError());
}
else
{
- SDL_PauseAudioDevice(audio, 0);
+ SDL_PauseAudioDevice(mic, 0);
}
memset(MicBuffer, 0, sizeof(MicBuffer));
@@ -1770,6 +1770,7 @@ int main(int argc, char** argv)
if (Joystick) SDL_JoystickClose(Joystick);
if (audio) SDL_CloseAudioDevice(audio);
+ if (mic) SDL_CloseAudioDevice(mic);
Config::ScreenRotation = ScreenRotation;
Config::ScreenGap = ScreenGap;