diff --git a/source/frontend/widgets/pianoroll.py b/source/frontend/widgets/pianoroll.py index 674dc5adb..735a02089 100755 --- a/source/frontend/widgets/pianoroll.py +++ b/source/frontend/widgets/pianoroll.py @@ -297,6 +297,7 @@ class PianoRoll(QGraphicsScene): self.mousePos = QPointF() self.notes = [] + self.removed_notes = [] self.selected_notes = [] self.piano_keys = [] @@ -316,8 +317,7 @@ class PianoRoll(QGraphicsScene): self.start_octave = -2 self.end_octave = 8 self.notes_in_octave = 12 - self.total_notes = (self.end_octave - self.start_octave) \ - * self.notes_in_octave + 1 + self.total_notes = (self.end_octave - self.start_octave) * self.notes_in_octave + 1 self.piano_height = self.note_height * self.total_notes self.octave_height = self.notes_in_octave * self.note_height @@ -694,10 +694,12 @@ class PianoRoll(QGraphicsScene): self.drawHeader() self.drawGrid() self.drawPlayHead() + for note in self.notes[:]: if note.note[1] >= (self.num_measures * self.time_sig[0]): self.notes.remove(note) - self.midievent.emit(["midievent-remove", note.note[0], note.note[1], note.note[2], note.note[3]]) + self.removed_notes.append(note) + #self.midievent.emit(["midievent-remove", note.note[0], note.note[1], note.note[2], note.note[3]]) elif note.note[2] > self.max_note_length: new_note = note.note[:] new_note[2] = self.max_note_length @@ -705,6 +707,12 @@ class PianoRoll(QGraphicsScene): self.drawNote(new_note[0], new_note[1], self.max_note_length, new_note[3], False) self.midievent.emit(["midievent-remove", note.note[0], note.note[1], note.note[2], note.note[3]]) self.midievent.emit(["midievent-add", new_note[0], new_note[1], new_note[2], new_note[3]]) + + for note in self.removed_notes[:]: + if note.note[1] < (self.num_measures * self.time_sig[0]): + self.removed_notes.remove(note) + self.notes.append(note) + list(map(self.addItem, self.notes)) if self.views(): self.views()[0].setSceneRect(self.itemsBoundingRect()) @@ -712,6 +720,7 @@ class PianoRoll(QGraphicsScene): def clearNotes(self): self.clear() self.notes = [] + self.removed_notes = [] self.selected_notes = [] self.drawPiano() self.drawHeader() diff --git a/source/native-plugins/midi-base.hpp b/source/native-plugins/midi-base.hpp index 8133577d9..fa7cda40a 100644 --- a/source/native-plugins/midi-base.hpp +++ b/source/native-plugins/midi-base.hpp @@ -277,6 +277,13 @@ public: if (ldtime > timePosFrame + frames) break; + if (carla_isEqual(ldtime, timePosFrame + frames)) + { + // only allow a few events to pass through in this special case + if (! MIDI_IS_STATUS_NOTE_OFF(rawMidiEvent->data[0])) + continue; + } + kPlayer->writeMidiEvent(fMidiPort, ldtime + offset - timePosFrame, rawMidiEvent); }