External, Non-PPA KXStudio Repository
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.3KB

  1. From 6cf78f419edeb85f54e6e0442515fc8be410ad5b Mon Sep 17 00:00:00 2001
  2. From: Timothy Krause <tmkrs4482@gmail.com>
  3. Date: Tue, 30 Nov 2021 06:26:10 -0700
  4. Subject: [PATCH] write the output upto the event and then update the state.
  5. ---
  6. plugins/eg-midigate.lv2/midigate.c | 9 +++++----
  7. 1 file changed, 5 insertions(+), 4 deletions(-)
  8. diff --git a/plugins/eg-midigate.lv2/midigate.c b/plugins/eg-midigate.lv2/midigate.c
  9. index 53794405..db110336 100644
  10. --- a/plugins/eg-midigate.lv2/midigate.c
  11. +++ b/plugins/eg-midigate.lv2/midigate.c
  12. @@ -160,7 +160,11 @@ run(LV2_Handle instance, uint32_t sample_count)
  13. uint32_t offset = 0;
  14. LV2_ATOM_SEQUENCE_FOREACH (self->control, ev) {
  15. - if (ev->body.type == self->uris.midi_MidiEvent) {
  16. +
  17. + write_output(self, offset, ev->time.frames - offset);
  18. + offset = (uint32_t)ev->time.frames;
  19. +
  20. + if (ev->body.type == self->uris.midi_MidiEvent) {
  21. const uint8_t* const msg = (const uint8_t*)(ev + 1);
  22. switch (lv2_midi_message_type(msg)) {
  23. case LV2_MIDI_MSG_NOTE_ON:
  24. @@ -185,9 +189,6 @@ run(LV2_Handle instance, uint32_t sample_count)
  25. break;
  26. }
  27. }
  28. -
  29. - write_output(self, offset, ev->time.frames - offset);
  30. - offset = (uint32_t)ev->time.frames;
  31. }
  32. write_output(self, offset, sample_count - offset);