git ssb

0+

kode54 / syntrax-c



Commit efafdc395bc8009a01857f057e6746ab4c0db12a

Moved var declarations out of for().

anonymous authored on 1/2/2016, 8:31:42 AM
Christopher Snowhill committed on 6/13/2018, 12:10:58 AM
Parent: 7ec4df9b5bef9b3ef82328d5dad824641d7fac12

Files changed

src/syntrax/resampler.cchanged
src/syntrax/resampler.cView
@@ -144,9 +144,10 @@
144144 int res = -1;
145145 {
146146 double least_error = 2;
147147 double pos = 0;
148- for ( int r = 1; r <= max_res; r++ )
148+ int r;
149+ for ( r = 1; r <= max_res; r++ )
149150 {
150151 pos += new_factor;
151152 double nearest = floor( pos + 0.5 );
152153 double error = fabs( pos - nearest );
@@ -167,9 +168,10 @@
167168 double const filter = (ratio_ < 1.0) ? 1.0 : 1.0 / ratio_;
168169 double pos = 0.0;
169170 /*int input_per_cycle = 0;*/
170171 imp_t* out = rs->impulses;
171- for ( int n = res; --n >= 0; )
172+ int n;
173+ for ( n = res; --n >= 0; )
172174 {
173175 gen_sinc( rolloff, (int) (rs->width_ * filter + 1) & ~1, pos, filter,
174176 (double)(imp_scale * gain * filter), (int) rs->width_, out );
175177 out += rs->width_;
@@ -213,9 +215,10 @@
213215 resampler *r = (resampler *)_r;
214216
215217 if (!r->latency)
216218 {
217- for (int i = 0; i < adj_width / 2; ++i)
219+ int i;
220+ for ( i = 0; i < adj_width / 2; ++i)
218221 {
219222 r->buffer_in[r->inptr + 0] = 0;
220223 r->buffer_in[r->inptr + 1] = 0;
221224 r->buffer_in[buffer_size * stereo + r->inptr + 0] = 0;
@@ -258,9 +261,10 @@
258261 intermediate_t l = (intermediate_t)pt * (intermediate_t)(in [0]);
259262 intermediate_t r = (intermediate_t)pt * (intermediate_t)(in [1]);
260263 if ( out >= out_end )
261264 break;
262- for ( int n = (adj_width - 2) / 2; n; --n )
265+ int n;
266+ for ( n = (adj_width - 2) / 2; n; --n )
263267 {
264268 pt = imp [1];
265269 l += (intermediate_t)pt * (intermediate_t)(in [2]);
266270 r += (intermediate_t)pt * (intermediate_t)(in [3]);

Built with git-ssb-web