]> git.donarmstrong.com Git - lilypond.git/blob - lily/note-performer.cc
release: 0.1.7
[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         note_req_l_->print();
31     }
32 #endif
33 }
34
35 void 
36 Note_performer::process_requests() 
37 {
38     // this is _really_ braindead, but it generates some output
39     if ( !note_req_l_ || !note_req_l_->melodic()  || !note_req_l_->rhythmic() )
40         return;
41
42     play( new Audio_note( note_req_l_ ) );
43     note_req_l_ = 0;
44 }
45
46 bool 
47 Note_performer::do_try_request( Request* req_l )
48 {
49     if ( note_req_l_ )
50         return false;
51     
52     if ( !req_l->musical() || !req_l->musical()->note() )
53         return false;
54
55     note_req_l_ = req_l->musical()->melodic();
56     return true;
57 }