13
0

change reasonable-synth to be sample accurate (note on/off)

at expense of slightly increased CPU load.
This commit is contained in:
Robin Gareus 2014-07-06 13:13:34 +02:00
parent 0b38d65dd0
commit 36135baaac

View File

@ -402,8 +402,9 @@ static uint32_t synth_sound (void *synth, uint32_t written, const uint32_t nfram
uint32_t nremain = nframes - written;
if (rs->boffset >= BUFFER_SIZE_SAMPLES) {
rs->boffset = 0;
synth_fragment(rs, BUFFER_SIZE_SAMPLES, rs->buf[0], rs->buf[1]);
const uint32_t tosynth = MIN(BUFFER_SIZE_SAMPLES, nremain);
rs->boffset = BUFFER_SIZE_SAMPLES - tosynth;
synth_fragment(rs, tosynth, &(rs->buf[0][rs->boffset]), &(rs->buf[1][rs->boffset]));
}
uint32_t nread = MIN(nremain, (BUFFER_SIZE_SAMPLES - rs->boffset));