]> git.donarmstrong.com Git - lilypond.git/blob - lily/note-performer.cc
5542c8e693a2919c63038e1078c834f4c1ca5ea9
[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--1999 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
15 ADD_THIS_TRANSLATOR (Note_performer);
16
17 Note_performer::Note_performer ()
18 {
19 }
20
21 void 
22 Note_performer::do_print () const
23 {
24 #ifndef NPRINT
25   if (note_req_l_arr_.size()>0)
26     for(int i=0;i<note_req_l_arr_.size();i++)
27       note_req_l_arr_[i]->print ();
28 #endif
29 }
30
31 void 
32 Note_performer::do_process_requests () 
33 {
34   if (note_req_l_arr_.size ())
35     {
36       int transposing_i = 0;
37       //urg
38       Scalar prop = get_property ("transposing", 0);
39       if (!prop.empty_b () && prop.isnum_b ()) 
40         transposing_i = prop;
41
42       while(note_req_l_arr_.size ())
43         {
44           Note_req* n = note_req_l_arr_.pop ();
45           Audio_note* p = new Audio_note (n->pitch_, n->length_mom (), transposing_i);
46           Audio_element_info info (p, n);
47           announce_element (info);
48           note_p_arr_.push (p);
49         }
50     }
51 }
52
53 void
54 Note_performer::do_pre_move_processing ()
55 {
56   for (int i=0; i < note_p_arr_.size (); i++)
57     {
58       play_element (note_p_arr_[i]);
59     }
60   note_p_arr_.clear ();
61   note_req_l_arr_.clear ();
62 }
63  
64 bool
65 Note_performer::do_try_music (Music* req_l)
66 {
67   if (Note_req *nr = dynamic_cast <Note_req *> (req_l))
68     {
69       note_req_l_arr_.push (nr);
70       return true;
71     }
72   return false;
73 }