slightly extend NotePlayer API
git-svn-id: svn://localhost/ardour2/branches/3.0@11414 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
452672f78f
commit
a09a71d674
@ -38,24 +38,24 @@ NotePlayer::add (boost::shared_ptr<NoteType> note)
|
||||
notes.push_back (note);
|
||||
}
|
||||
|
||||
void
|
||||
NotePlayer::clear ()
|
||||
{
|
||||
off ();
|
||||
notes.clear ();
|
||||
}
|
||||
|
||||
void
|
||||
NotePlayer::play ()
|
||||
{
|
||||
Evoral::MusicalTime longest_duration_beats = 0;
|
||||
for (Notes::iterator n = notes.begin(); n != notes.end(); ++n) {
|
||||
track->write_immediate_event ((*n)->on_event().size(), (*n)->on_event().buffer());
|
||||
}
|
||||
|
||||
/* note: if there is more than 1 note, we will silence them all at the same time
|
||||
*/
|
||||
|
||||
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()); */
|
||||
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);
|
||||
|
@ -39,6 +39,7 @@ public:
|
||||
void add (boost::shared_ptr<NoteType>);
|
||||
void play ();
|
||||
void off ();
|
||||
void clear ();
|
||||
|
||||
static bool _off (NotePlayer*);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user