audio: Added a ThreadDeinit() method to match ThreadInit. Not used by any targets at the moment, but will be shortly!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index 989259c..2893c49 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -222,6 +222,11 @@ SDL_AudioThreadInit_Default(_THIS)
}
static void
+SDL_AudioThreadDeinit_Default(_THIS)
+{ /* no-op. */
+}
+
+static void
SDL_AudioWaitDevice_Default(_THIS)
{ /* no-op. */
}
@@ -340,6 +345,7 @@ finish_audio_entry_points_init(void)
FILL_STUB(DetectDevices);
FILL_STUB(OpenDevice);
FILL_STUB(ThreadInit);
+ FILL_STUB(ThreadDeinit);
FILL_STUB(WaitDevice);
FILL_STUB(PlayDevice);
FILL_STUB(GetPendingBytes);
@@ -712,6 +718,8 @@ SDL_RunAudio(void *devicep)
/* Wait for the audio to drain. */
SDL_Delay(((device->spec.samples * 1000) / device->spec.freq) * 2);
+ current_audio.impl.ThreadDeinit(device);
+
return 0;
}
@@ -810,6 +818,8 @@ SDL_CaptureAudio(void *devicep)
current_audio.impl.FlushCapture(device);
+ current_audio.impl.ThreadDeinit(device);
+
return 0;
}
diff --git a/src/audio/SDL_sysaudio.h b/src/audio/SDL_sysaudio.h
index ca93eb2..45e46df 100644
--- a/src/audio/SDL_sysaudio.h
+++ b/src/audio/SDL_sysaudio.h
@@ -67,6 +67,7 @@ typedef struct SDL_AudioDriverImpl
void (*DetectDevices) (void);
int (*OpenDevice) (_THIS, void *handle, const char *devname, int iscapture);
void (*ThreadInit) (_THIS); /* Called by audio thread at start */
+ void (*ThreadDeinit) (_THIS); /* Called by audio thread at start */
void (*WaitDevice) (_THIS);
void (*PlayDevice) (_THIS);
int (*GetPendingBytes) (_THIS);