Browse Source

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

Ryan C. Gordon 2 years ago
parent
commit
5a0c819863
1 changed files with 4 additions and 4 deletions
  1. 4 4
      src/audio/SDL_audiocvt.c

+ 4 - 4
src/audio/SDL_audiocvt.c

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