]> git.donarmstrong.com Git - lilypond.git/blob - lily/staff-performer.cc
patch::: 0.1.8.jcn1: Re: pl 8
[lilypond.git] / lily / staff-performer.cc
1 /*
2   staff-performer.cc -- implement Staff_performer
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
7  */
8
9 #include "staff-performer.hh"
10 #include "translator.hh"
11 #include "input-translator.hh"
12 #include "debug.hh"
13 #include "audio-column.hh"
14 #include "audio-item.hh"
15 #include "audio-staff.hh"
16
17 IMPLEMENT_IS_TYPE_B1(Staff_performer,Performer_group_performer);
18 ADD_THIS_PERFORMER(Staff_performer);
19
20 Staff_performer::Staff_performer()
21 {
22     audio_staff_p_ = 0;
23 }
24
25 Staff_performer::~Staff_performer()
26 {
27     delete audio_staff_p_;
28 }
29
30 void
31 Staff_performer::do_creation_processing()
32 {
33     audio_staff_p_ = new Audio_staff;
34
35     if (instrument_str().length_i()) {
36         // staff name
37         play (new Audio_text ( Audio_text::TRACK_NAME, instrument_str ()));
38         // instrument description
39         play (new Audio_text (Audio_text::INSTRUMENT_NAME, instrument_str ()));
40     }
41
42     // tempo
43     play(new Audio_tempo(get_tempo_i()));
44
45     if (instrument_str ().length_i ())
46         // instrument
47         play (new Audio_instrument (instrument_str ()));
48 }
49
50 void
51 Staff_performer::do_removal_processing()
52 {
53     Performer::play (audio_staff_p_);
54     audio_staff_p_ = 0;
55 }
56
57 String 
58 Staff_performer::instrument_str() 
59
60     return Translator::id_str_; 
61 }
62
63 void 
64 Staff_performer::play (Audio_element* p)
65 {
66     if (p->is_type_b (Audio_item::static_name())) {
67         audio_staff_p_->add ((Audio_item*)p);
68     }
69     Performer::play (p);
70 }
71