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.
This commit is contained in:
Ryan C. Gordon 2025-01-27 01:11:22 -05:00
parent 5f8e0ebf58
commit 09f900f66e
No known key found for this signature in database
GPG Key ID: FA148B892AB48044
1 changed files with 3 additions and 11 deletions

View File

@ -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");
}
}