]> git.donarmstrong.com Git - lilypond.git/blob - lily/key-performer.cc
d4d0527aa06e1d20f987da38e4ef8a0a2cf15177
[lilypond.git] / lily / key-performer.cc
1 /*
2   key-performer.cc -- implement Key_performer
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
7 */
8
9 #include "key-performer.hh"
10 #include "command-request.hh"
11 #include "audio-item.hh"
12
13
14
15 IMPLEMENT_IS_TYPE_B1(Key_performer,Performer);
16 ADD_THIS_PERFORMER(Key_performer);
17
18 Key_performer::Key_performer()
19 {
20   key_req_l_ = 0;
21 }
22
23 Key_performer::~Key_performer()
24 {
25 }
26
27 void 
28 Key_performer::do_print() const
29 {
30 #ifndef NPRINT
31   if ( key_req_l_)
32         key_req_l_->print();
33 #endif
34 }
35
36 void
37 Key_performer::process_requests()
38 {
39   if ( key_req_l_)
40         play (new Audio_key (key_req_l_) );
41   key_req_l_ = 0;
42 }
43
44 bool
45 Key_performer::do_try_request (Request* req_l)
46 {
47   if ( key_req_l_)
48         return false;
49
50   if ( req_l->command())
51         key_req_l_ = req_l->command()->keychange ();
52
53   if ( key_req_l_)
54         return true;
55
56   return false;
57 }
58