Browse Source

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.
Ryan C. Gordon 2 months ago
parent
commit
09f900f66e
1 changed files with 3 additions and 11 deletions
  1. 3 11
      src/audio/SDL_audiocvt.c

+ 3 - 11
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");
         }
     }