lilypond-0.1.57
[lilypond.git] / lily / staff-performer.cc
blob7270d20282ff281d678d7530ac64663c8dbf82fe
1 /*
2 staff-performer.cc -- implement Staff_performer
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
7 */
9 #include "staff-performer.hh"
10 #include "translator-group.hh"
11 #include "debug.hh"
12 #include "audio-column.hh"
13 #include "audio-item.hh"
14 #include "audio-staff.hh"
16 IMPLEMENT_IS_TYPE_B1 (Staff_performer,Performer_group_performer);
17 ADD_THIS_TRANSLATOR (Staff_performer);
19 Staff_performer::Staff_performer ()
21 audio_staff_p_ = 0;
24 Staff_performer::~Staff_performer ()
26 delete audio_staff_p_;
29 void
30 Staff_performer::do_creation_processing ()
32 audio_staff_p_ = new Audio_staff;
34 play (new Audio_text (Audio_text::TRACK_NAME, id_str_));
36 #if 1
37 String str = new_instrument_str ();
38 if (str.length_i ())
39 // instrument description
40 play (new Audio_text (Audio_text::INSTRUMENT_NAME, str));
41 #endif
43 // tempo
44 play (new Audio_tempo (get_tempo_i ()));
46 #if 1
47 if (str.length_i ())
48 // instrument
49 play (new Audio_instrument (str));
50 #endif
52 Performer_group_performer::do_creation_processing ();
55 void
56 Staff_performer::do_process_requests ()
58 String str = new_instrument_str ();
59 if (str.length_i ())
61 play (new Audio_text (Audio_text::INSTRUMENT_NAME, str));
62 play (new Audio_instrument (str));
64 Performer_group_performer::do_process_requests ();
68 void
69 Staff_performer::do_removal_processing ()
71 Performer_group_performer::do_removal_processing ();
72 Performer::play (audio_staff_p_);
73 audio_staff_p_ = 0;
76 String
77 Staff_performer::new_instrument_str ()
79 // mustn't ask Score for instrument: it will return piano!
80 String str = get_property ("instrument");
81 if (str == instrument_str_)
82 return "";
84 instrument_str_ = str;
86 return instrument_str_;
88 /* ugh, but can't
89 if (properties_dict_.elt_b ("instrument"))
90 return properties_dict_["instrument"];
91 return "";
95 void
96 Staff_performer::play (Audio_element* p)
98 if (p->is_type_b (Audio_item::static_name ()))
100 audio_staff_p_->add ( (Audio_item*)p);
102 Performer::play (p);