2 note-performer.cc -- implement Note_performer
4 (c) 1996, 1997 Jan Nieuwenhuizen <jan@digicash.com>
7 #include "note-performer.hh"
8 #include "translator.hh"
9 #include "input-translator.hh"
10 #include "musical-request.hh"
11 #include "midi-item.hh"
14 IMPLEMENT_IS_TYPE_B1(Note_performer,Performer);
16 ADD_THIS_PERFORMER(Note_performer);
18 Note_performer::Note_performer()
24 Note_performer::~Note_performer()
29 Note_performer::do_print() const
38 Note_performer::process_requests()
40 // if ( when() == off_mom_ )
41 // play_event( Note_event( current_l_->pitch() ) );
43 //Midi_note( Melodic_req* melreq_l, int channel_i, bool on_bo )
45 // this is _really_ braindead, but it generates some output
46 if ( !note_req_l_ || !note_req_l_->melodic() || !note_req_l_->rhythmic() )
49 // ugh, need to know channel (===track===staff) too
51 Moment mom = get_mom();
52 if ( !off_mom_ ) { // start note
53 off_mom_ = mom + note_req_l_->duration();
54 Midi_note n( note_req_l_->melodic(), channel_i, true );
57 else if ( mom == off_mom_ ) {
58 Midi_note n( note_req_l_->melodic(), channel_i, false );
66 Note_performer::do_try_request( Request* req_l )
72 // if (req_l->musical() && (req_l->musical()->note() || req_l->musical()->rest()))
73 // note_req_l_ = req_l->musical()->rhythmic();
74 if ( req_l->musical() && req_l->musical()->note() )
76 note_req_l_ = req_l->musical()->melodic();