summaryrefslogtreecommitdiff
path: root/gtk2_ardour/note_player.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-02-01 03:32:59 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-02-01 03:32:59 +0000
commita09a71d6742b22fd8fb8636b672be1b62b05222a (patch)
tree8cd7c53faf688e2d97d66c31881522826c6e7317 /gtk2_ardour/note_player.cc
parent452672f78f5f0f9195bfd48398e29b18a8fb1df7 (diff)
slightly extend NotePlayer API
git-svn-id: svn://localhost/ardour2/branches/3.0@11414 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/note_player.cc')
-rw-r--r--gtk2_ardour/note_player.cc28
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());
}
}