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:
parent
e34359b921
commit
9de2b3435d
@ -34,22 +34,15 @@ NotePlayer::NotePlayer (std::shared_ptr<MidiTrack> mt)
|
|||||||
|
|
||||||
NotePlayer::~NotePlayer ()
|
NotePlayer::~NotePlayer ()
|
||||||
{
|
{
|
||||||
clear ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NotePlayer::add (std::shared_ptr<NoteType> note)
|
NotePlayer::add (std::shared_ptr<NoteType> note)
|
||||||
{
|
{
|
||||||
|
/* Must not be called once play() has been called */
|
||||||
notes.push_back (note);
|
notes.push_back (note);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
NotePlayer::clear ()
|
|
||||||
{
|
|
||||||
off ();
|
|
||||||
notes.clear ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
NotePlayer::on ()
|
NotePlayer::on ()
|
||||||
{
|
{
|
||||||
@ -63,8 +56,7 @@ NotePlayer::play ()
|
|||||||
{
|
{
|
||||||
on ();
|
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;
|
const uint32_t note_length_ms = 100;
|
||||||
|
|
||||||
|
@ -27,6 +27,10 @@
|
|||||||
|
|
||||||
#include "evoral/Note.h"
|
#include "evoral/Note.h"
|
||||||
|
|
||||||
|
namespace Temporal {
|
||||||
|
class Beats;
|
||||||
|
}
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
class MidiTrack;
|
class MidiTrack;
|
||||||
}
|
}
|
||||||
@ -40,13 +44,11 @@ public:
|
|||||||
|
|
||||||
void add (std::shared_ptr<NoteType>);
|
void add (std::shared_ptr<NoteType>);
|
||||||
void play ();
|
void play ();
|
||||||
void on ();
|
|
||||||
void off ();
|
|
||||||
void clear ();
|
|
||||||
|
|
||||||
static bool _off (NotePlayer*);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void on ();
|
||||||
|
void off ();
|
||||||
|
static bool _off (NotePlayer*);
|
||||||
typedef std::vector< std::shared_ptr<NoteType> > Notes;
|
typedef std::vector< std::shared_ptr<NoteType> > Notes;
|
||||||
|
|
||||||
std::shared_ptr<ARDOUR::MidiTrack> track;
|
std::shared_ptr<ARDOUR::MidiTrack> track;
|
||||||
|
Loading…
Reference in New Issue
Block a user