SDL: audio: Remove resampling limits.

From 09f900f66ed81c2681c2cd525fda059c267f77ab Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Mon, 27 Jan 2025 01:11:22 -0500
Subject: [PATCH] audio: Remove resampling limits.

Audio streams used to accept audio with a src or dest frequency between
4000Hz and 384000Hz. It was arbitrary (or perhaps a relic of older
resampler revisions), and testing shows unnecessary, so remove it.

Fixes #12098.
---
 src/audio/SDL_audiocvt.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c
index f128f8b5ae5f8..08beb480b78ea 100644
--- a/src/audio/SDL_audiocvt.c
+++ b/src/audio/SDL_audiocvt.c
@@ -558,9 +558,9 @@ bool SDL_SetAudioStreamFormat(SDL_AudioStream *stream, const SDL_AudioSpec *src_
         return SDL_InvalidParamError("stream");
     }
 
-    // Picked mostly arbitrarily.
-    static const int min_freq = 4000;
-    static const int max_freq = 384000;
+    // note that while we've removed the maximum frequency checks, SDL _will_
+    // fail to resample to extremely high sample rates correctly. Really high,
+    // like 196608000Hz. File a bug.  :P
 
     if (src_spec) {
         if (!SDL_IsSupportedAudioFormat(src_spec->format)) {
@@ -569,10 +569,6 @@ bool SDL_SetAudioStreamFormat(SDL_AudioStream *stream, const SDL_AudioSpec *src_
             return SDL_InvalidParamError("src_spec->channels");
         } else if (src_spec->freq <= 0) {
             return SDL_InvalidParamError("src_spec->freq");
-        } else if (src_spec->freq < min_freq) {
-            return SDL_SetError("Source rate is too low");
-        } else if (src_spec->freq > max_freq) {
-            return SDL_SetError("Source rate is too high");
         }
     }
 
@@ -583,10 +579,6 @@ bool SDL_SetAudioStreamFormat(SDL_AudioStream *stream, const SDL_AudioSpec *src_
             return SDL_InvalidParamError("dst_spec->channels");
         } else if (dst_spec->freq <= 0) {
             return SDL_InvalidParamError("dst_spec->freq");
-        } else if (dst_spec->freq < min_freq) {
-            return SDL_SetError("Destination rate is too low");
-        } else if (dst_spec->freq > max_freq) {
-            return SDL_SetError("Destination rate is too high");
         }
     }