audio: FreeDeviceHandle should pass the whole device, for convenience.

main
Ryan C. Gordon 2023-07-03 20:32:31 -04:00
parent 9e3c5f93e0
commit 22afa5735f
No known key found for this signature in database
GPG Key ID: FA148B892AB48044
3 changed files with 5 additions and 5 deletions

View File

@ -198,7 +198,7 @@ static void DestroyPhysicalAudioDevice(SDL_AudioDevice *device)
// it's safe to not hold the lock for this (we can't anyhow, or the audio thread won't quit), because we shouldn't be in the device list at this point. // it's safe to not hold the lock for this (we can't anyhow, or the audio thread won't quit), because we shouldn't be in the device list at this point.
ClosePhysicalAudioDevice(device); ClosePhysicalAudioDevice(device);
current_audio.impl.FreeDeviceHandle(device->handle); current_audio.impl.FreeDeviceHandle(device);
SDL_DestroyMutex(device->lock); SDL_DestroyMutex(device->lock);
SDL_free(device->work_buffer); SDL_free(device->work_buffer);
@ -418,7 +418,7 @@ static void SDL_AudioWaitCaptureDevice_Default(SDL_AudioDevice *device) { /* no-
static void SDL_AudioFlushCapture_Default(SDL_AudioDevice *device) { /* no-op. */ } static void SDL_AudioFlushCapture_Default(SDL_AudioDevice *device) { /* no-op. */ }
static void SDL_AudioCloseDevice_Default(SDL_AudioDevice *device) { /* no-op. */ } static void SDL_AudioCloseDevice_Default(SDL_AudioDevice *device) { /* no-op. */ }
static void SDL_AudioDeinitialize_Default(void) { /* no-op. */ } static void SDL_AudioDeinitialize_Default(void) { /* no-op. */ }
static void SDL_AudioFreeDeviceHandle_Default(void *handle) { /* no-op. */ } static void SDL_AudioFreeDeviceHandle_Default(SDL_AudioDevice *device) { /* no-op. */ }
static void SDL_AudioDetectDevices_Default(SDL_AudioDevice **default_output, SDL_AudioDevice **default_capture) static void SDL_AudioDetectDevices_Default(SDL_AudioDevice **default_output, SDL_AudioDevice **default_capture)
{ {

View File

@ -114,7 +114,7 @@ typedef struct SDL_AudioDriverImpl
int (*CaptureFromDevice)(SDL_AudioDevice *device, void *buffer, int buflen); int (*CaptureFromDevice)(SDL_AudioDevice *device, void *buffer, int buflen);
void (*FlushCapture)(SDL_AudioDevice *device); void (*FlushCapture)(SDL_AudioDevice *device);
void (*CloseDevice)(SDL_AudioDevice *device); void (*CloseDevice)(SDL_AudioDevice *device);
void (*FreeDeviceHandle)(void *handle); /**< SDL is done with handle from SDL_AddAudioDevice() */ void (*FreeDeviceHandle)(SDL_AudioDevice *handle); // SDL is done with this device; free the handle from SDL_AddAudioDevice()
void (*Deinitialize)(void); void (*Deinitialize)(void);
/* Some flags to push duplicate code into the core and reduce #ifdefs. */ /* Some flags to push duplicate code into the core and reduce #ifdefs. */

View File

@ -149,9 +149,9 @@ static int SetDSerror(const char *function, int code)
return SDL_SetError("%s: %s (0x%x)", function, error, code); return SDL_SetError("%s: %s (0x%x)", function, error, code);
} }
static void DSOUND_FreeDeviceHandle(void *handle) static void DSOUND_FreeDeviceHandle(SDL_AudioDevice *device)
{ {
SDL_free(handle); SDL_free(device->handle);
} }
static int DSOUND_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture) static int DSOUND_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture)