2 staff-performer.cc -- implement Staff_performer
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 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"
16 ADD_THIS_TRANSLATOR (Staff_performer);
18 Staff_performer::Staff_performer ()
22 instrument_name_p_ = 0;
27 Staff_performer::~Staff_performer ()
32 Staff_performer::do_creation_processing ()
34 audio_staff_p_ = new Audio_staff;
35 announce_element (Audio_element_info (audio_staff_p_, 0));
37 name_p_ = new Audio_text (Audio_text::TRACK_NAME, id_str_);
38 announce_element (Audio_element_info (name_p_, 0));
40 tempo_p_ = new Audio_tempo (get_tempo_i ());
41 announce_element (Audio_element_info (tempo_p_, 0));
43 Performer_group_performer::do_creation_processing ();
47 Staff_performer::do_process_requests ()
49 String str = new_instrument_str ();
52 instrument_name_p_ = new Audio_text (Audio_text::INSTRUMENT_NAME, str);
53 announce_element (Audio_element_info (instrument_name_p_, 0));
54 instrument_p_ = new Audio_instrument (str);
55 announce_element (Audio_element_info (instrument_p_, 0));
57 Performer_group_performer::do_process_requests ();
61 Staff_performer::do_pre_move_processing ()
65 play_element (name_p_);
70 play_element (tempo_p_);
73 if (instrument_name_p_)
75 play_element (instrument_name_p_);
76 instrument_name_p_ = 0;
80 play_element (instrument_p_);
83 Performer_group_performer::do_pre_move_processing ();
87 Staff_performer::do_removal_processing ()
89 Performer_group_performer::do_removal_processing ();
90 Performer::play_element (audio_staff_p_);
95 Staff_performer::new_instrument_str ()
97 // mustn't ask Score for instrument: it will return piano!
98 SCM minstr = get_property (ly_symbol2scm ("midiInstrument"), 0);
100 if (!gh_string_p(minstr))
101 minstr = get_property (ly_symbol2scm ("instrument"), 0);
103 if (ly_scm2string (minstr) == instrument_str_)
106 instrument_str_ = ly_scm2string (minstr);
108 return instrument_str_;
112 Staff_performer::play_element (Audio_element* p)
114 if (Audio_item *ai = dynamic_cast<Audio_item *> (p))
116 audio_staff_p_->add_audio_item (ai);
118 Performer::play_element (p);