summaryrefslogtreecommitdiff
path: root/libs/plugins/reasonablesynth.lv2
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2014-07-06 13:13:34 +0200
committerRobin Gareus <robin@gareus.org>2014-07-06 13:24:53 +0200
commit36135baaacb8249f5a812aab6b547557c6c37f73 (patch)
tree110d8aade9cfa6651b97910249b8301c07682c45 /libs/plugins/reasonablesynth.lv2
parent0b38d65dd0d73fb92db3b3b82be5da3eab05afff (diff)
change reasonable-synth to be sample accurate (note on/off)
at expense of slightly increased CPU load.
Diffstat (limited to 'libs/plugins/reasonablesynth.lv2')
-rw-r--r--libs/plugins/reasonablesynth.lv2/rsynth.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libs/plugins/reasonablesynth.lv2/rsynth.c b/libs/plugins/reasonablesynth.lv2/rsynth.c
index eff01d8d69..68bd81714d 100644
--- a/libs/plugins/reasonablesynth.lv2/rsynth.c
+++ b/libs/plugins/reasonablesynth.lv2/rsynth.c
@@ -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));