Format fluid_synth_write_*()

This commit is contained in:
derselbst 2019-10-22 15:53:54 +02:00
parent 988ec6d799
commit 171f3396a4

View file

@ -3814,10 +3814,10 @@ fluid_synth_write_float(fluid_synth_t *synth, int len,
int int
fluid_synth_write_float_LOCAL(fluid_synth_t *synth, int len, fluid_synth_write_float_LOCAL(fluid_synth_t *synth, int len,
void *lout, int loff, int lincr, void *lout, int loff, int lincr,
void *rout, int roff, int rincr, void *rout, int roff, int rincr,
int (*block_render_func)(fluid_synth_t *, int) int (*block_render_func)(fluid_synth_t *, int)
) )
{ {
int n, cur, size; int n, cur, size;
float *left_out = (float *) lout + loff; float *left_out = (float *) lout + loff;
@ -3856,12 +3856,16 @@ fluid_synth_write_float_LOCAL(fluid_synth_t *synth, int len,
n = synth->curmax - cur; n = synth->curmax - cur;
/* keep track of emitted samples */ /* keep track of emitted samples */
if (n > size) n = size; if(n > size)
{
n = size;
}
size -= n; size -= n;
/* update pointers to current position */ /* update pointers to current position */
left_in += cur+n; left_in += cur + n;
right_in += cur+n; right_in += cur + n;
/* set final cursor position */ /* set final cursor position */
cur += n; cur += n;
@ -3877,9 +3881,9 @@ fluid_synth_write_float_LOCAL(fluid_synth_t *synth, int len,
left_out += lincr; left_out += lincr;
right_out += rincr; right_out += rincr;
} }
while (++n < 0); while(++n < 0);
} }
while (size); while(size);
synth->cur = cur; synth->cur = cur;
@ -4011,12 +4015,16 @@ fluid_synth_write_s16(fluid_synth_t *synth, int len,
n = synth->curmax - cur; n = synth->curmax - cur;
/* keep track of emitted samples */ /* keep track of emitted samples */
if (n > size) n = size; if(n > size)
{
n = size;
}
size -= n; size -= n;
/* update pointers to current position */ /* update pointers to current position */
left_in += cur+n; left_in += cur + n;
right_in += cur+n; right_in += cur + n;
/* set final cursor position */ /* set final cursor position */
cur += n; cur += n;
@ -4037,9 +4045,9 @@ fluid_synth_write_s16(fluid_synth_t *synth, int len,
di = 0; di = 0;
} }
} }
while (++n < 0); while(++n < 0);
} }
while (size); while(size);
synth->cur = cur; synth->cur = cur;
synth->dither_index = di; /* keep dither buffer continous */ synth->dither_index = di; /* keep dither buffer continous */