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-reg.hh"
21 #include "music-iterator.hh"
23 #include "music-list.hh"
24 #include "input-register.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_acceptor(Global_acceptor * 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_register * score_reg =
76 (Score_register*)lookup_reg("Score_register")->get_group_register_p();
77 run_acceptor( score_reg );
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_);
150 Score::set(Paper_def *pap_p)
157 Score::set(Midi_def* midi_p)
168 for (iter_top(cols_,cc); cc.ok() && (cc+1).ok(); cc++) {
169 assert(cc->when() <= (cc+1)->when());
181 for (iter_top(cols_,i); i.ok(); i++) {
210 Score::paper_output()
212 if (paper_p_->outfile=="")
213 paper_p_->outfile = default_out_fn + ".out";
215 if ( errorlevel_i_ ) {
216 *mlog << "lilypond: warning: no output to: " << paper_p_->outfile
217 << " (errorlevel=" << errorlevel_i_ << ")" << endl;
221 *mlog << "TeX output to " << paper_p_->outfile << " ...\n";
223 Tex_stream the_output(paper_p_->outfile);
225 the_output << "% outputting Score, defined at: " <<
226 location_str() << "\n";
227 pscore_p_->output(the_output);
238 if (midi_p_->outfile_str_ == "")
239 midi_p_->outfile_str_ = default_out_fn + ".midi";
241 *mlog << "midi output to " << midi_p_->outfile_str_ << " ...\n";
242 Midi_output(this, midi_p_);