2 score.cc -- implement Score
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
9 #include "tex-stream.hh"
11 #include "score-column.hh"
14 #include "paper-def.hh"
17 #include "source-file.hh"
18 #include "midi-def.hh"
19 #include "midi-stream.hh"
20 #include "audio-score.hh"
22 #include "music-iterator.hh"
24 #include "global-translator.hh"
27 extern String default_out_fn;
40 Score::Score (Score const &s)
43 music_p_ = s.music_p_->clone();
44 midi_p_ = new Midi_def (*s.midi_p_);
45 paper_p_ = new Paper_def (*s.paper_p_);
46 header_p_ = new Header (*s.header_p_);
54 delete audio_score_p_;
60 Score::run_translator (Global_translator * trans_l)
62 trans_l->set_score (this);
63 Music_iterator * iter = Music_iterator::static_get_iterator_p (music_p_,
65 iter->construct_children();
70 warning ("Need music in a score");
77 while ( iter->ok() || trans_l->moments_left_i ())
79 Moment w = infinity_mom;
82 w = iter->next_moment();
86 trans_l->modify_next (w);
90 iter->process_and_next (w);
111 *mlog << "\nCreating MIDI elements ..." << flush;
112 audio_score_p_ = new Audio_score (this);
114 Global_translator* score_trans= midi_p_->get_global_translator_p();
115 run_translator (score_trans);
120 // should we? hampers debugging.
121 warning ("Errors found, /*not processing score*/");
135 *mlog << "\nCreating elements ..." << flush;
136 pscore_p_ = new Paper_score (paper_p_);
138 Global_translator * score_trans= paper_p_->get_global_translator_p();
139 run_translator (score_trans);
144 // should we? hampers debugging.
145 warning ("Errors found, /*not processing score*/");
150 pscore_p_->process();
159 if ( midi_p_->outfile_str_ == "")
160 midi_p_->outfile_str_ = default_out_fn + ".midi";
162 Midi_stream midi_stream (midi_p_->outfile_str_);
163 *mlog << "MIDI output to " << midi_p_->outfile_str_ << " ..." << endl;
165 audio_score_p_->output (midi_stream);
170 Score::paper_output()
172 if (paper_p_->outfile_str_=="")
173 paper_p_->outfile_str_ = default_out_fn + ".tex";
177 *mlog << "lilypond: warning: no output to: " << paper_p_->outfile_str_
178 << " (errorlevel=" << errorlevel_i_ << ")" << endl;
182 *mlog << "TeX output to " << paper_p_->outfile_str_ << " ...\n";
184 Tex_stream the_output (paper_p_->outfile_str_);
186 the_output << "% outputting Score, defined at: " <<
187 location_str() << "\n";
188 pscore_p_->output (the_output);
205 Score::set (Paper_def *pap_p)
212 Score::set (Midi_def* midi_p)