audio: Add channel convert filter _after_ choosing an SIMD version.

main
Ryan C. Gordon 2022-07-19 22:03:02 -04:00
parent fe16084075
commit 5a0c819863
1 changed files with 4 additions and 4 deletions

View File

@ -1983,10 +1983,6 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
/* All combinations of supported channel counts should have been handled by now, but let's be defensive */
return SDL_SetError("Invalid channel combination");
} else if (channel_converter != NULL) {
if (SDL_AddAudioCVTFilter(cvt, channel_converter) < 0) {
return -1;
}
/* swap in some SIMD versions for a few of these. */
if (channel_converter == SDL_Convert51ToStereo) {
SDL_AudioFilter filter = NULL;
@ -2010,6 +2006,10 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
if (filter) { channel_converter = filter; }
}
if (SDL_AddAudioCVTFilter(cvt, channel_converter) < 0) {
return -1;
}
if (src_channels < dst_channels) {
cvt->len_mult = ((cvt->len_mult * dst_channels) + (src_channels-1)) / src_channels;
}