]> git.donarmstrong.com Git - lilypond.git/blob - lily/note-performer.cc
release: 1.1.1
[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   if (note_req_l_)
35     {
36       int transposing_i = 0;
37       //urg
38       Scalar prop = get_property ("transposing");
39       if (!prop.empty_b () && prop.isnum_b ()) 
40         transposing_i = prop;
41
42
43       play (new Audio_note (note_req_l_, transposing_i));
44
45       note_req_l_ = 0;
46     }
47 }
48
49 bool 
50 Note_performer::do_try_request (Request* req_l)
51 {
52   if (note_req_l_)
53     return false;
54   
55   if (Note_req *nr = dynamic_cast <Note_req *> (req_l))
56     {
57       note_req_l_ = nr;
58       return true;
59     }
60   return false;
61 }