13
0

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.
This commit is contained in:
Robin Gareus 2024-05-20 18:37:27 +02:00
parent e34359b921
commit 9de2b3435d
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 9 additions and 15 deletions

View File

@ -34,22 +34,15 @@ NotePlayer::NotePlayer (std::shared_ptr<MidiTrack> mt)
NotePlayer::~NotePlayer ()
{
clear ();
}
void
NotePlayer::add (std::shared_ptr<NoteType> 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;

View File

@ -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<NoteType>);
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<NoteType> > Notes;
std::shared_ptr<ARDOUR::MidiTrack> track;