From 9de2b3435d9b08cc03caddc536c5e7161aae68ee Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 20 May 2024 18:37:27 +0200 Subject: [PATCH] Only send a single note-off when drawing notes Previously both the timer-based `off` as well as the d'tor sent a note-off event. --- gtk2_ardour/note_player.cc | 12 ++---------- gtk2_ardour/note_player.h | 12 +++++++----- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/gtk2_ardour/note_player.cc b/gtk2_ardour/note_player.cc index cb148f5f0b..d0396e588d 100644 --- a/gtk2_ardour/note_player.cc +++ b/gtk2_ardour/note_player.cc @@ -34,22 +34,15 @@ NotePlayer::NotePlayer (std::shared_ptr mt) NotePlayer::~NotePlayer () { - clear (); } void NotePlayer::add (std::shared_ptr note) { + /* Must not be called once play() has been called */ notes.push_back (note); } -void -NotePlayer::clear () -{ - off (); - notes.clear (); -} - void NotePlayer::on () { @@ -63,8 +56,7 @@ NotePlayer::play () { on (); - /* note: if there is more than 1 note, we will silence them all at the same time - */ + /* note: if there is more than 1 note, we will silence them all at the same time */ const uint32_t note_length_ms = 100; diff --git a/gtk2_ardour/note_player.h b/gtk2_ardour/note_player.h index 94c60b3ab4..e3cad02a33 100644 --- a/gtk2_ardour/note_player.h +++ b/gtk2_ardour/note_player.h @@ -27,6 +27,10 @@ #include "evoral/Note.h" +namespace Temporal { + class Beats; +} + namespace ARDOUR { class MidiTrack; } @@ -40,13 +44,11 @@ public: void add (std::shared_ptr); void play (); - void on (); - void off (); - void clear (); - - static bool _off (NotePlayer*); private: + void on (); + void off (); + static bool _off (NotePlayer*); typedef std::vector< std::shared_ptr > Notes; std::shared_ptr track;