2 score.cc -- implement Score
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
8 #include "tex-stream.hh"
10 #include "score-column.hh"
13 #include "paper-def.hh"
16 #include "source-file.hh"
17 #include "midi-output.hh"
18 #include "midi-def.hh"
20 #include "score-grav.hh"
21 #include "music-iterator.hh"
23 #include "music-list.hh"
24 #include "input-engraver.hh"
26 extern String default_out_fn;
28 Score::Score(Score const &s)
31 music_p_ = s.music_p_->clone();
32 midi_p_ = new Midi_def(*s.midi_p_);
33 paper_p_ = new Paper_def(*s.paper_p_);
37 Score::run_translator(Global_translator * acc_l)
39 acc_l->set_score (this);
40 Music_iterator * iter = Music_iterator::static_get_iterator_p(music_p_,
42 iter->construct_children();
44 while ( iter->ok() || acc_l->moments_left_i() ) {
47 w = iter->next_moment();
50 acc_l->modify_next( w );
72 *mlog << "\nCreating elements ..." << flush;
73 pscore_p_ = new PScore(paper_p_);
75 Score_engraver * score_grav=
76 (Score_engraver*)lookup_grav("Score_engraver")->get_group_engraver_p();
77 run_translator( score_grav );
81 // should we? hampers debugging.
82 warning("Errors found, /*not processing score*/");
87 clean_cols(); // can't move clean_cols() farther up.
102 Remove empty cols, preprocess other columns.
107 for (iter_top(cols_,c); c.ok(); ) {
108 if (!c->pcol_l_->used_b()) {
117 PCursor<Score_column*>
118 Score::find_col(Moment w, bool mus)
122 for (; i.ok(); i++) {
123 if (i->when() == w && i->musical_b_ == mus)
136 for (; i.ok(); i++) {
137 pscore_p_->add(i->pcol_l_);
142 Score::set(Paper_def *pap_p)
149 Score::set(Midi_def* midi_p)
160 for (iter_top(cols_,cc); cc.ok() && (cc+1).ok(); cc++) {
161 assert(cc->when() <= (cc+1)->when());
173 for (iter_top(cols_,i); i.ok(); i++) {
202 Score::paper_output()
204 if (paper_p_->outfile_str_=="")
205 paper_p_->outfile_str_ = default_out_fn + ".out";
207 if ( errorlevel_i_ ) {
208 *mlog << "lilypond: warning: no output to: " << paper_p_->outfile_str_
209 << " (errorlevel=" << errorlevel_i_ << ")" << endl;
213 *mlog << "TeX output to " << paper_p_->outfile_str_ << " ...\n";
215 Tex_stream the_output(paper_p_->outfile_str_);
217 the_output << "% outputting Score, defined at: " <<
218 location_str() << "\n";
219 pscore_p_->output(the_output);
230 if (midi_p_->outfile_str_ == "")
231 midi_p_->outfile_str_ = default_out_fn + ".midi";
233 *mlog << "midi output to " << midi_p_->outfile_str_ << " ...\n";
234 Midi_output(this, midi_p_);