Commit efafdc395bc8009a01857f057e6746ab4c0db12a
Moved var declarations out of for().
anonymous authored on 1/2/2016, 8:31:42 AMChristopher Snowhill committed on 6/13/2018, 12:10:58 AM
Parent: 7ec4df9b5bef9b3ef82328d5dad824641d7fac12
Files changed
src/syntrax/resampler.c | changed |
src/syntrax/resampler.c | ||
---|---|---|
@@ -144,9 +144,10 @@ | ||
144 | 144 | int res = -1; |
145 | 145 | { |
146 | 146 | double least_error = 2; |
147 | 147 | double pos = 0; |
148 | - for ( int r = 1; r <= max_res; r++ ) | |
148 | + int r; | |
149 | + for ( r = 1; r <= max_res; r++ ) | |
149 | 150 | { |
150 | 151 | pos += new_factor; |
151 | 152 | double nearest = floor( pos + 0.5 ); |
152 | 153 | double error = fabs( pos - nearest ); |
@@ -167,9 +168,10 @@ | ||
167 | 168 | double const filter = (ratio_ < 1.0) ? 1.0 : 1.0 / ratio_; |
168 | 169 | double pos = 0.0; |
169 | 170 | /*int input_per_cycle = 0;*/ |
170 | 171 | imp_t* out = rs->impulses; |
171 | - for ( int n = res; --n >= 0; ) | |
172 | + int n; | |
173 | + for ( n = res; --n >= 0; ) | |
172 | 174 | { |
173 | 175 | gen_sinc( rolloff, (int) (rs->width_ * filter + 1) & ~1, pos, filter, |
174 | 176 | (double)(imp_scale * gain * filter), (int) rs->width_, out ); |
175 | 177 | out += rs->width_; |
@@ -213,9 +215,10 @@ | ||
213 | 215 | resampler *r = (resampler *)_r; |
214 | 216 | |
215 | 217 | if (!r->latency) |
216 | 218 | { |
217 | - for (int i = 0; i < adj_width / 2; ++i) | |
219 | + int i; | |
220 | + for ( i = 0; i < adj_width / 2; ++i) | |
218 | 221 | { |
219 | 222 | r->buffer_in[r->inptr + 0] = 0; |
220 | 223 | r->buffer_in[r->inptr + 1] = 0; |
221 | 224 | r->buffer_in[buffer_size * stereo + r->inptr + 0] = 0; |
@@ -258,9 +261,10 @@ | ||
258 | 261 | intermediate_t l = (intermediate_t)pt * (intermediate_t)(in [0]); |
259 | 262 | intermediate_t r = (intermediate_t)pt * (intermediate_t)(in [1]); |
260 | 263 | if ( out >= out_end ) |
261 | 264 | break; |
262 | - for ( int n = (adj_width - 2) / 2; n; --n ) | |
265 | + int n; | |
266 | + for ( n = (adj_width - 2) / 2; n; --n ) | |
263 | 267 | { |
264 | 268 | pt = imp [1]; |
265 | 269 | l += (intermediate_t)pt * (intermediate_t)(in [2]); |
266 | 270 | r += (intermediate_t)pt * (intermediate_t)(in [3]); |
Built with git-ssb-web