aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/eg-metro.lv2/metro.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/plugins/eg-metro.lv2/metro.c b/plugins/eg-metro.lv2/metro.c
index 60b61f3..54b2a70 100644
--- a/plugins/eg-metro.lv2/metro.c
+++ b/plugins/eg-metro.lv2/metro.c
@@ -276,26 +276,25 @@ run(LV2_Handle instance, uint32_t sample_count)
/* Work forwards in time frame by frame, handling events as we go */
const LV2_Atom_Sequence* in = self->ports.control;
- LV2_Atom_Event* ev = lv2_atom_sequence_begin(&in->body);
uint32_t last_t = 0;
- for (uint32_t t = 0; t < sample_count; ++t) {
- while (!lv2_atom_sequence_is_end(&in->body, in->atom.size, ev) &&
- ev->time.frames == t) {
- /* Play the click for the time slice from last_t until now */
- play(self, last_t, t);
-
- if (ev->body.type == uris->atom_Blank) {
- const LV2_Atom_Object* obj = (LV2_Atom_Object*)&ev->body;
- if (obj->body.otype == uris->time_Position) {
- /* Received position information, update */
- update_position(self, obj);
- }
+ for (LV2_Atom_Event* ev = lv2_atom_sequence_begin(&in->body);
+ !lv2_atom_sequence_is_end(&in->body, in->atom.size, ev);
+ ev = lv2_atom_sequence_next(ev)) {
+
+ /* Play the click for the time slice from last_t until now */
+ play(self, last_t, ev->time.frames);
+
+ if (ev->body.type == uris->atom_Blank) {
+ const LV2_Atom_Object* obj = (LV2_Atom_Object*)&ev->body;
+ if (obj->body.otype == uris->time_Position) {
+ /* Received position information, update */
+ update_position(self, obj);
}
-
- /* Update time for next iteration and move to next event*/
- last_t = t;
- ev = lv2_atom_sequence_next(ev);
}
+
+ /* Update time for next iteration and move to next event*/
+ last_t = ev->time.frames;
+ ev = lv2_atom_sequence_next(ev);
}
/* Play for remainder of cycle */