Commit 0085f917e0b241d7c0eb83b04d3e084ecec09dfb

Ryan C. Gordon 2017-10-11T02:31:58

audio: Moved unchanging variable out of loop.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c
index bbcad81..3fb2aad 100644
--- a/src/audio/SDL_audiocvt.c
+++ b/src/audio/SDL_audiocvt.c
@@ -484,6 +484,7 @@ SDL_ResampleAudio(const int chans, const int inrate, const int outrate,
                         const float *inbuf, const int inbuflen,
                         float *outbuf, const int outbuflen)
 {
+    const double finrate = (double) inrate;
     const float outtimeincr = 1.0f / ((float) outrate);
     const float ratio = ((float) outrate) / ((float) inrate);
     const int paddinglen = ResamplerPadding(inrate, outrate);
@@ -498,7 +499,6 @@ SDL_ResampleAudio(const int chans, const int inrate, const int outrate,
 
     for (i = 0; i < outframes; i++) {
         const int srcindex = (int) (outtime * inrate);
-        const float finrate = (float) inrate;
         const float intime = ((float) srcindex) / finrate;
         const float innexttime = ((float) (srcindex + 1)) / finrate;