2 note-performer.cc -- implement Note_performer
4 source file of the GNU LilyPond music typesetter
6 (c) 1996, 1997 Jan Nieuwenhuizen <jan@digicash.com>
9 #include "note-performer.hh"
10 #include "translator.hh"
11 #include "input-translator.hh"
12 #include "musical-request.hh"
13 #include "audio-item.hh"
16 IMPLEMENT_IS_TYPE_B1(Note_performer,Performer);
18 ADD_THIS_PERFORMER(Note_performer);
20 Note_performer::Note_performer()
26 Note_performer::~Note_performer()
31 Note_performer::do_print() const
36 mtor << ( off_mom_ ? "on" : "off" ) << "\n";
42 Note_performer::process_requests()
44 // this is _really_ braindead, but it generates some output
45 if ( !note_req_l_ || !note_req_l_->melodic() || !note_req_l_->rhythmic() )
49 Moment mom = get_mom();
50 if ( !off_mom_ ) { // start note
51 off_mom_ = mom + note_req_l_->duration();
52 play( new Audio_note( note_req_l_, true ) );
54 else if ( mom == off_mom_ ) { // stop note
55 play( new Audio_note( note_req_l_, false ) );
62 Note_performer::do_try_request( Request* req_l )
68 // if (req_l->musical() && (req_l->musical()->note() || req_l->musical()->rest()))
69 // note_req_l_ = req_l->musical()->rhythmic();
70 if ( req_l->musical() && req_l->musical()->note() )
72 note_req_l_ = req_l->musical()->melodic();