From 7e700531c59bb83daccff9ed4d4afb98698d877e Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Sat, 24 Jun 2023 14:54:05 -0400
Subject: [PATCH] audio: Allow SDL_OpenAudioDevice to accept a NULL spec.
This means "I don't care what format I get at all" and will just use
the device's current (and/or default) format.
This can be useful, since audio streams cover the differences anyhow.
---
src/audio/SDL_audio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index cdd8dbb69b3a..3d791677dbe2 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -1156,7 +1156,7 @@ static int OpenPhysicalAudioDevice(SDL_AudioDevice *device, const SDL_AudioSpec
}
SDL_AudioSpec spec;
- SDL_memcpy(&spec, inspec, sizeof (SDL_AudioSpec));
+ SDL_memcpy(&spec, inspec ? inspec : &device->default_spec, sizeof (SDL_AudioSpec));
PrepareAudioFormat(device->iscapture, &spec);
/* We allow the device format to change if it's better than the current settings (by various definitions of "better"). This prevents