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;
39 Score::Score (Score const &s)
42 music_p_ = s.music_p_->clone();
43 midi_p_ = new Midi_def (*s.midi_p_);
44 paper_p_ = new Paper_def (*s.paper_p_);
45 header_p_ = new Header(*s.header_p_);
53 delete audio_score_p_;
59 Score::run_translator (Global_translator * trans_l)
61 trans_l->set_score (this);
62 Music_iterator * iter = Music_iterator::static_get_iterator_p (music_p_,
64 iter->construct_children();
69 warning ("Need music in a score");
76 while ( iter->ok() || trans_l->moments_left_i ())
78 Moment w = infinity_mom;
81 w = iter->next_moment();
85 trans_l->modify_next (w);
89 iter->process_and_next (w);
110 *mlog << "\nCreating MIDI elements ..." << flush;
111 audio_score_p_ = new Audio_score (this);
113 Global_translator* score_trans= midi_p_->get_global_translator_p();
114 run_translator (score_trans);
119 // should we? hampers debugging.
120 warning ("Errors found, /*not processing score*/");
134 *mlog << "\nCreating elements ..." << flush;
135 pscore_p_ = new Paper_score (paper_p_);
137 Global_translator * score_trans= paper_p_->get_global_translator_p();
138 run_translator (score_trans);
143 // should we? hampers debugging.
144 warning ("Errors found, /*not processing score*/");
149 pscore_p_->process();
158 if ( midi_p_->outfile_str_ == "")
159 midi_p_->outfile_str_ = default_out_fn + ".midi";
161 Midi_stream midi_stream (midi_p_->outfile_str_);
162 *mlog << "MIDI output to " << midi_p_->outfile_str_ << " ..." << endl;
164 audio_score_p_->output (midi_stream);
169 Score::paper_output()
171 if (paper_p_->outfile_str_=="")
172 paper_p_->outfile_str_ = default_out_fn + ".tex";
176 *mlog << "lilypond: warning: no output to: " << paper_p_->outfile_str_
177 << " (errorlevel=" << errorlevel_i_ << ")" << endl;
181 *mlog << "TeX output to " << paper_p_->outfile_str_ << " ...\n";
183 Tex_stream the_output (paper_p_->outfile_str_);
185 the_output << "% outputting Score, defined at: " <<
186 location_str() << "\n";
187 pscore_p_->output (the_output);
204 Score::set (Paper_def *pap_p)
211 Score::set (Midi_def* midi_p)