]> git.donarmstrong.com Git - lilypond.git/blob - lily/note-performer.cc
release: 0.1.61
[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--1998 Jan Nieuwenhuizen <jan@digicash.com>
7  */
8
9 #include "note-performer.hh"
10 #include "musical-request.hh"
11 #include "audio-item.hh"
12 #include "debug.hh"
13
14 IMPLEMENT_IS_TYPE_B1(Note_performer,Performer);
15 ADD_THIS_TRANSLATOR(Note_performer);
16
17 Note_performer::Note_performer()
18 {
19   note_req_l_ = 0;
20 }
21
22 void 
23 Note_performer::do_print() const
24 {
25 #ifndef NPRINT
26   if (note_req_l_) 
27     {
28       note_req_l_->print();
29     }
30 #endif
31 }
32
33 void 
34 Note_performer::do_process_requests() 
35 {
36   // this is _really_ braindead, but it generates some output
37   if (!note_req_l_ || !note_req_l_->melodic()  || !note_req_l_->rhythmic ())
38     return;
39
40   play (new Audio_note (note_req_l_));
41   note_req_l_ = 0;
42 }
43
44 bool 
45 Note_performer::do_try_request (Request* req_l)
46 {
47   if (note_req_l_)
48     return false;
49   
50   if (!req_l->musical() || !req_l->musical ()->note ())
51     return false;
52
53   note_req_l_ = req_l->musical()->melodic ();
54   return true;
55 }