]> git.donarmstrong.com Git - lilypond.git/blob - lily/note-performer.cc
patch::: 0.0.74pre.jcn1: pats
[lilypond.git] / lily / note-performer.cc
1 /*
2   note-performer.cc -- implement Note_performer
3
4   (c) 1996, 1997 Han-Wen Nienhuys <hanwen@stack.nl>
5                  Jan Nieuwenhuizen <jan@digicash.com>
6  */
7
8 #include "note-performer.hh"
9 #include "translator.hh"
10 #include "input-translator.hh"
11 #include "musical-request.hh"
12 #include "midi-item.hh"
13 #include "debug.hh"
14
15 IMPLEMENT_IS_TYPE_B1(Note_performer,Performer);
16 IMPLEMENT_STATIC_NAME(Note_performer);
17 ADD_THIS_PERFORMER(Note_performer);
18
19 Note_performer::Note_performer()
20 {
21     // is this what we want? 
22     // or do we need to cache/keep note until it has ended?
23     note_req_l_ = 0;
24 }
25
26 Note_performer::~Note_performer()
27 {
28 }
29
30 void 
31 Note_performer::do_print() const
32 {
33 #ifndef NPRINT
34     if ( note_req_l_ )
35         note_req_l_->print();
36 #endif
37 }
38
39 void 
40 Note_performer::process_requests() 
41 {
42 //    if ( when() == off_mom_ )
43 //      play_event( Note_event( current_l_->pitch() ) );
44
45 //Midi_note( Melodic_req* melreq_l, int channel_i, bool on_bo  )
46
47     // this is _really_ braindead, but it generates some output
48     if ( note_req_l_ && note_req_l_->melodic() ) {
49         Midi_note n( note_req_l_->melodic(), 0, true  );
50         play_event( &n );
51     }
52     note_req_l_ = 0;
53 }
54
55 bool 
56 Note_performer::try_request( Request* req_l )
57 {
58     if ( note_req_l_ )
59         return false;
60     
61  // huh?
62 //    if (req_l->musical() && (req_l->musical()->note() || req_l->musical()->rest()))
63 //      note_req_l_ = req_l->musical()->rhythmic();
64     if ( req_l->musical() && req_l->musical()->note() )
65         note_req_l_ = req_l->musical()->melodic();
66     else
67         return false;
68
69     return true;
70 }
71