@@ -80,11 +80,11 @@ Resample *resampleInit(int numChannels, int numTaps, int numFilters, float lowpa
8080 Resample *cxt = (Resample *) calloc (1 , sizeof (Resample));
8181 int i;
8282
83- if (lowpassRatio > 0.0 && lowpassRatio < 1.0 )
83+ if (lowpassRatio > 0 .0f && lowpassRatio < 1 .0f )
8484 flags |= INCLUDE_LOWPASS;
8585 else {
8686 flags &= ~INCLUDE_LOWPASS;
87- lowpassRatio = 1.0 ;
87+ lowpassRatio = 1 .0f ;
8888 }
8989
9090 if ((numTaps & 3 ) || numTaps <= 0 || numTaps > 1024 ) {
@@ -183,7 +183,7 @@ ResampleResult resampleProcess(Resample *cxt, const float *const *input, int num
183183 for (i = 0 ; i < cxt->numChannels ; ++i)
184184 output[i][res.output_generated ] = subsample (cxt, cxt->buffers [i], cxt->outputOffset );
185185
186- cxt->outputOffset += (1.0 / ratio);
186+ cxt->outputOffset += (1 .0f / ratio);
187187 res.output_generated ++;
188188 numOutputFrames--;
189189 }
@@ -224,7 +224,7 @@ ResampleResult resampleProcessInterleaved(Resample *cxt, const float *input, int
224224 for (i = 0 ; i < cxt->numChannels ; ++i)
225225 *output++ = subsample (cxt, cxt->buffers [i], cxt->outputOffset );
226226
227- cxt->outputOffset += (1.0 / ratio);
227+ cxt->outputOffset += (1 .0f / ratio);
228228 res.output_generated ++;
229229 numOutputFrames--;
230230 }
@@ -261,7 +261,7 @@ unsigned int resampleGetRequiredSamples(Resample *cxt, int numOutputFrames, floa
261261 input_index++;
262262 res.input_used ++;
263263 } else {
264- offset += (1.0 / ratio);
264+ offset += (1 .0f / ratio);
265265 numOutputFrames--;
266266 }
267267 }
@@ -288,7 +288,7 @@ unsigned int resampleGetExpectedOutput(Resample *cxt, int numInputFrames, float
288288 } else
289289 break ;
290290 } else {
291- offset += (1.0 / ratio);
291+ offset += (1 .0f / ratio);
292292 res.output_generated ++;
293293 }
294294 }
@@ -302,7 +302,7 @@ unsigned int resampleGetExpectedOutput(Resample *cxt, int numInputFrames, float
302302// phase shift. The resampler cannot be reversed.
303303
304304void resampleAdvancePosition (Resample *cxt, float delta) {
305- if (delta < 0.0 )
305+ if (delta < 0 .0f )
306306 fprintf (stderr, " resampleAdvancePosition() can only advance forward!\n " );
307307 else
308308 cxt->outputOffset += delta;
@@ -336,7 +336,7 @@ void resampleAdvancePosition(Resample *cxt, float delta) {
336336// break;
337337// }
338338
339- float resampleGetPosition (Resample *cxt) { return cxt->outputOffset + (cxt->numTaps / 2.0 ) - cxt->inputIndex ; }
339+ float resampleGetPosition (Resample *cxt) { return cxt->outputOffset + (cxt->numTaps / 2 .0f ) - cxt->inputIndex ; }
340340
341341// Free all resources associated with the resampler context, including the context pointer
342342// itself. Do not use the context after this call.
@@ -368,11 +368,11 @@ static float apply_filter(float *A, float *B, int num_taps) {
368368#endif
369369
370370static void init_filter (Resample *cxt, float *filter, float fraction, float lowpass_ratio) {
371- const float a0 = 0.35875 ;
372- const float a1 = 0.48829 ;
373- const float a2 = 0.14128 ;
374- const float a3 = 0.01168 ;
375- float filter_sum = 0.0 ;
371+ const float a0 = 0 .35875f ;
372+ const float a1 = 0 .48829f ;
373+ const float a2 = 0 .14128f ;
374+ const float a3 = 0 .01168f ;
375+ float filter_sum = 0 .0f ;
376376 int i;
377377
378378 // "dist" is the absolute distance from the sinc maximum to the filter tap to be calculated, in radians
@@ -386,22 +386,22 @@ static void init_filter(Resample *cxt, float *filter, float fraction, float lowp
386386 float ratio = dist / (cxt->numTaps / 2 );
387387 float value;
388388
389- if (dist != 0.0 ) {
389+ if (dist != 0 .0f ) {
390390 value = sin (dist * lowpass_ratio) / (dist * lowpass_ratio);
391391
392392 if (cxt->flags & BLACKMAN_HARRIS)
393393 value *= a0 + a1 * cos (ratio) + a2 * cos (2 * ratio) + a3 * cos (3 * ratio);
394394 else
395- value *= 0.5 * (1.0 + cos (ratio)); // Hann window
395+ value *= 0 .5f * (1 .0f + cos (ratio)); // Hann window
396396 } else
397- value = 1.0 ;
397+ value = 1 .0f ;
398398
399399 filter_sum += cxt->tempFilter [i] = value;
400400 }
401401
402402 // filter should have unity DC gain
403403
404- float scaler = 1.0 / filter_sum, error = 0.0 ;
404+ float scaler = 1 .0f / filter_sum, error = 0 .0f ;
405405
406406 for (i = cxt->numTaps / 2 ; i < cxt->numTaps ; i = cxt->numTaps - i - (i >= cxt->numTaps / 2 )) {
407407 filter[i] = (cxt->tempFilter [i] *= scaler) - error;
@@ -413,10 +413,10 @@ static float subsample_no_interpolate(Resample *cxt, float *source, float offset
413413 source += (int ) floor (offset);
414414 offset -= floor (offset);
415415
416- if (offset == 0.0 && !(cxt->flags & INCLUDE_LOWPASS))
416+ if (offset == 0 .0f && !(cxt->flags & INCLUDE_LOWPASS))
417417 return *source;
418418
419- return apply_filter (cxt->filters [(int ) floor (offset * cxt->numFilters + 0.5 )], source - cxt->numTaps / 2 + 1 ,
419+ return apply_filter (cxt->filters [(int ) floor (offset * cxt->numFilters + 0 .5f )], source - cxt->numTaps / 2 + 1 ,
420420 cxt->numTaps );
421421}
422422
@@ -427,18 +427,18 @@ static float subsample_interpolate(Resample *cxt, float *source, float offset) {
427427 source += (int ) floor (offset);
428428 offset -= floor (offset);
429429
430- if (offset == 0.0 && !(cxt->flags & INCLUDE_LOWPASS))
430+ if (offset == 0 .0f && !(cxt->flags & INCLUDE_LOWPASS))
431431 return *source;
432432
433433 i = (int ) floor (offset *= cxt->numFilters );
434434 sum1 = apply_filter (cxt->filters [i], source - cxt->numTaps / 2 + 1 , cxt->numTaps );
435435
436- if ((offset -= i) == 0.0 && !(cxt->flags & INCLUDE_LOWPASS))
436+ if ((offset -= i) == 0 .0f && !(cxt->flags & INCLUDE_LOWPASS))
437437 return sum1;
438438
439439 sum2 = apply_filter (cxt->filters [i + 1 ], source - cxt->numTaps / 2 + 1 , cxt->numTaps );
440440
441- return sum2 * offset + sum1 * (1.0 - offset);
441+ return sum2 * offset + sum1 * (1 .0f - offset);
442442}
443443
444444static float subsample (Resample *cxt, float *source, float offset) {
0 commit comments