diff options
Diffstat (limited to 'gtk2_ardour/note_player.cc')
-rw-r--r-- | gtk2_ardour/note_player.cc | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/gtk2_ardour/note_player.cc b/gtk2_ardour/note_player.cc index 09c2e8add3..6355cc522b 100644 --- a/gtk2_ardour/note_player.cc +++ b/gtk2_ardour/note_player.cc @@ -39,26 +39,26 @@ NotePlayer::add (boost::shared_ptr<NoteType> note) } void -NotePlayer::play () +NotePlayer::clear () { - Evoral::MusicalTime longest_duration_beats = 0; - - /* note: if there is more than 1 note, we will silence them all at the same time - */ + off (); + notes.clear (); +} +void +NotePlayer::play () +{ for (Notes::iterator n = notes.begin(); n != notes.end(); ++n) { track->write_immediate_event ((*n)->on_event().size(), (*n)->on_event().buffer()); - if ((*n)->length() > longest_duration_beats) { - longest_duration_beats = (*n)->length(); - } } - uint32_t note_length_ms = 350; - /* beats_to_frames (longest_duration_beats) - * (1000 / (double)track->session().nominal_frame_rate()); */ + /* note: if there is more than 1 note, we will silence them all at the same time + */ + + const uint32_t note_length_ms = 350; - Glib::signal_timeout().connect(sigc::bind (sigc::ptr_fun (&NotePlayer::_off), this), - note_length_ms, G_PRIORITY_DEFAULT); + Glib::signal_timeout().connect (sigc::bind (sigc::ptr_fun (&NotePlayer::_off), this), + note_length_ms, G_PRIORITY_DEFAULT); } bool @@ -73,6 +73,6 @@ void NotePlayer::off () { for (Notes::iterator n = notes.begin(); n != notes.end(); ++n) { - track->write_immediate_event((*n)->off_event().size(), (*n)->off_event().buffer()); + track->write_immediate_event ((*n)->off_event().size(), (*n)->off_event().buffer()); } } |