]> git.donarmstrong.com Git - lilypond.git/blob - lily/note-performer.cc
release: 0.1.9
[lilypond.git] / lily / note-performer.cc
1 /*
2   note-performer.cc -- implement Note_performer
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1996, 1997 Jan Nieuwenhuizen <jan@digicash.com>
7  */
8
9 #include "note-performer.hh"
10 #include "translator.hh"
11 #include "input-translator.hh"
12 #include "musical-request.hh"
13 #include "audio-item.hh"
14 #include "debug.hh"
15
16 IMPLEMENT_IS_TYPE_B1(Note_performer,Performer);
17
18 ADD_THIS_PERFORMER(Note_performer);
19
20 Note_performer::Note_performer()
21 {
22   note_req_l_ = 0;
23 }
24
25 void 
26 Note_performer::do_print() const
27 {
28 #ifndef NPRINT
29   if ( note_req_l_) 
30     {
31         note_req_l_->print();
32     }
33 #endif
34 }
35
36 void 
37 Note_performer::process_requests() 
38 {
39   // this is _really_ braindead, but it generates some output
40   if ( !note_req_l_ || !note_req_l_->melodic()  || !note_req_l_->rhythmic ())
41         return;
42
43   play (new Audio_note (note_req_l_) );
44   note_req_l_ = 0;
45 }
46
47 bool 
48 Note_performer::do_try_request (Request* req_l)
49 {
50   if ( note_req_l_)
51         return false;
52   
53   if ( !req_l->musical() || !req_l->musical ()->note ())
54         return false;
55
56   note_req_l_ = req_l->musical()->melodic ();
57   return true;
58 }