Fix inconsistent session-check
[ardour.git] / gtk2_ardour / note_player.cc
index b9f480a6be41b10c3a7a912b6388322f7ba32e7a..cd5c058209b76181fe063af8fff5e2ec158f02cc 100644 (file)
@@ -31,6 +31,11 @@ NotePlayer::NotePlayer (boost::shared_ptr<MidiTrack> mt)
 {
 }
 
+NotePlayer::~NotePlayer ()
+{
+       clear ();
+}
+
 void
 NotePlayer::add (boost::shared_ptr<NoteType> note)
 {
@@ -45,11 +50,17 @@ NotePlayer::clear ()
 }
 
 void
-NotePlayer::play ()
+NotePlayer::on ()
 {
        for (Notes::iterator n = notes.begin(); n != notes.end(); ++n) {
                track->write_immediate_event ((*n)->on_event().size(), (*n)->on_event().buffer());
        }
+}
+
+void
+NotePlayer::play ()
+{
+       on ();
 
        /* note: if there is more than 1 note, we will silence them all at the same time
         */