2 staff-performer.cc -- implement Staff_performer
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Jan Nieuwenhuizen <janneke@gnu.org>
9 #include "staff-performer.hh"
10 #include "translator-group.hh"
12 #include "audio-column.hh"
13 #include "audio-item.hh"
14 #include "audio-staff.hh"
17 ADD_THIS_TRANSLATOR (Staff_performer);
19 Staff_performer::Staff_performer ()
23 instrument_name_p_ = 0;
28 Staff_performer::~Staff_performer ()
33 Staff_performer::do_creation_processing ()
35 audio_staff_p_ = new Audio_staff;
36 announce_element (Audio_element_info (audio_staff_p_, 0));
38 name_p_ = new Audio_text (Audio_text::TRACK_NAME, id_str_);
39 announce_element (Audio_element_info (name_p_, 0));
41 tempo_p_ = new Audio_tempo (get_tempo_i ());
42 announce_element (Audio_element_info (tempo_p_, 0));
44 Performer_group_performer::do_creation_processing ();
48 Staff_performer::do_process_requests ()
50 String str = new_instrument_str ();
53 instrument_name_p_ = new Audio_text (Audio_text::INSTRUMENT_NAME, str);
54 announce_element (Audio_element_info (instrument_name_p_, 0));
55 instrument_p_ = new Audio_instrument (str);
56 announce_element (Audio_element_info (instrument_p_, 0));
58 Performer_group_performer::do_process_requests ();
62 Staff_performer::do_pre_move_processing ()
66 play_element (name_p_);
71 play_element (tempo_p_);
74 if (instrument_name_p_)
76 play_element (instrument_name_p_);
77 instrument_name_p_ = 0;
81 play_element (instrument_p_);
84 Performer_group_performer::do_pre_move_processing ();
88 Staff_performer::do_removal_processing ()
90 Performer_group_performer::do_removal_processing ();
91 Performer::play_element (audio_staff_p_);
96 Staff_performer::new_instrument_str ()
98 // mustn't ask Score for instrument: it will return piano!
99 SCM minstr = get_property (ly_symbol2scm ("midiInstrument"), 0);
101 if (!gh_string_p(minstr))
102 minstr = get_property (ly_symbol2scm ("instrument"), 0);
104 if (!gh_string_p (minstr)
105 || ly_scm2string (minstr) == instrument_str_)
108 instrument_str_ = ly_scm2string (minstr);
110 return instrument_str_;
114 Staff_performer::play_element (Audio_element* p)
116 if (Audio_item *ai = dynamic_cast<Audio_item *> (p))
118 audio_staff_p_->add_audio_item (ai);
120 Performer::play_element (p);