]> git.donarmstrong.com Git - lilypond.git/blob - lily/note-performer.cc
5f8923c284e48a70f38547b1aa1d1f0942c6b0c3
[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 <janneke@gnu.org>
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       note_req_l_->print ();
28 #endif
29 }
30
31 void 
32 Note_performer::do_process_requests () 
33 {
34   // this is _really_ braindead, but it generates some output
35   if (!note_req_l_ || !dynamic_cast <Melodic_req *> (note_req_l_)  || !dynamic_cast <Rhythmic_req *> (note_req_l_))
36     return;
37
38   int transposing_i = 0;
39   //urg
40   Scalar prop = get_property ("transposing");
41   if (!prop.empty_b () && prop.isnum_b ()) 
42     transposing_i = prop;
43
44
45   play (new Audio_note (note_req_l_, transposing_i));
46
47   note_req_l_ = 0;
48 }
49
50 bool 
51 Note_performer::do_try_request (Request* req_l)
52 {
53   if (note_req_l_)
54     return false;
55   
56   if (Note_req *nr = dynamic_cast <Note_req *> (req_l))
57     {
58       note_req_l_ = nr;
59       return true;
60     }
61   return false;
62 }