From 6a2791f677a247a2f9a75ca27d2f425974029213 Mon Sep 17 00:00:00 2001 From: Krzysztof Foltman Date: Thu, 4 Jul 2013 19:29:33 +0100 Subject: [PATCH] Mark the ad-hoc pattern as completed only after all the notes have been processed. Otherwise, the last event(s) of the pattern may be lost, depending on the tempo and the sample rate. --- scene.c | 2 +- seq-adhoc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scene.c b/scene.c index 2e2ab96..4dc344a 100644 --- a/scene.c +++ b/scene.c @@ -610,7 +610,7 @@ void cbox_scene_render(struct cbox_scene *scene, uint32_t nframes, float *output } } - // XXXKF implement full cleanup, not only the front of the queue + // XXXKF implement full cleanup, not only the front of the queue if(scene->adhoc_patterns && scene->adhoc_patterns->completed) { struct cbox_adhoc_pattern *top = scene->adhoc_patterns; diff --git a/seq-adhoc.c b/seq-adhoc.c index 7bba699..14b70ec 100644 --- a/seq-adhoc.c +++ b/seq-adhoc.c @@ -42,9 +42,9 @@ void cbox_adhoc_pattern_render(struct cbox_adhoc_pattern *ap, int offset, int ns cbox_midi_playback_active_notes_release(&ap->active_notes, &ap->output_buffer); return; } - cbox_midi_clip_playback_render(&ap->playback, &ap->output_buffer, offset, nsamples); if (ap->playback.pos >= ap->playback.pattern->event_count) ap->completed = TRUE; + cbox_midi_clip_playback_render(&ap->playback, &ap->output_buffer, offset, nsamples); } void cbox_adhoc_pattern_destroy(struct cbox_adhoc_pattern *ap) -- 2.11.4.GIT