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"
26 extern String default_out_fn;
37 Score::Score (Score const &s)
40 music_p_ = s.music_p_->clone();
41 midi_p_ = new Midi_def (*s.midi_p_);
42 paper_p_ = new Paper_def (*s.paper_p_);
49 delete audio_score_p_;
55 Score::run_translator (Global_translator * trans_l)
57 trans_l->set_score (this);
58 Music_iterator * iter = Music_iterator::static_get_iterator_p (music_p_,
60 iter->construct_children();
64 warning ("Need music in a score");
71 while ( iter->ok() || trans_l->moments_left_i ()) {
72 Moment w = infinity_mom;
74 w = iter->next_moment();
78 trans_l->modify_next (w);
82 iter->process_and_next (w);
103 *mlog << "\nCreating MIDI elements ..." << flush;
104 audio_score_p_ = new Audio_score (this);
106 Global_translator* score_trans= midi_p_->get_global_translator_p();
107 run_translator (score_trans);
111 // should we? hampers debugging.
112 warning ("Errors found, /*not processing score*/");
126 *mlog << "\nCreating elements ..." << flush;
127 pscore_p_ = new Paper_score (paper_p_);
129 Global_translator * score_trans= paper_p_->get_global_translator_p();
130 run_translator (score_trans);
134 // should we? hampers debugging.
135 warning ("Errors found, /*not processing score*/");
140 pscore_p_->process();
149 if ( midi_p_->outfile_str_ == "")
150 midi_p_->outfile_str_ = default_out_fn + ".midi";
152 Midi_stream midi_stream (midi_p_->outfile_str_);
153 *mlog << "MIDI output to " << midi_p_->outfile_str_ << " ..." << endl;
155 audio_score_p_->output (midi_stream);
160 Score::paper_output()
162 if (paper_p_->outfile_str_=="")
163 paper_p_->outfile_str_ = default_out_fn + ".tex";
165 if ( errorlevel_i_) {
166 *mlog << "lilypond: warning: no output to: " << paper_p_->outfile_str_
167 << " (errorlevel=" << errorlevel_i_ << ")" << endl;
171 *mlog << "TeX output to " << paper_p_->outfile_str_ << " ...\n";
173 Tex_stream the_output (paper_p_->outfile_str_);
175 the_output << "% outputting Score, defined at: " <<
176 location_str() << "\n";
177 pscore_p_->output (the_output);
194 Score::set (Paper_def *pap_p)
201 Score::set (Midi_def* midi_p)