10 #include "sourcefile.hh"
15 *mlog
<< "\nProcessing music ..." << flush
;
18 if (last() == Moment(0)) {
19 warning("Need to have music in a score.", defined_ch_c_l_
);
22 // distribute commands to disciples
23 pscore_p_
= new PScore(paper_p_
);
24 for (iter_top(staffs_
,i
); i
.ok(); i
++) {
25 i
->set_output(pscore_p_
);
26 i
->truncate_cols(last());
30 // do this after processing, staffs first have to generate PCols.
31 find_col(last(), false)->set_breakable();
43 Remove empty cols, preprocess other columns.
48 for (iter_top(staffs_
,i
); i
.ok(); i
++)
51 for (iter_top(cols_
,c
); c
.ok(); ) {
52 if (!c
->pcol_l_
->used()) {
62 this sux. We should have Score_column create the appropriate PCol.
63 Unfortunately, PCols don't know about their position.
65 PCursor
<Score_column
*>
66 Score::create_cols(Moment w
)
68 Score_column
* c1
= new Score_column(w
);
69 Score_column
* c2
= new Score_column(w
);
77 assert(i
->when() != w
);
83 cols_
.bottom().add(c1
);
84 cols_
.bottom().add(c2
);
95 PCursor
<Score_column
*>
96 Score::find_col(Moment w
, bool mus
)
100 for (; i
.ok(); i
++) {
101 if (i
->when() == w
&& i
->musical_
== mus
)
116 for (; i
.ok(); i
++) {
117 pscore_p_
->add(i
->pcol_l_
);
119 clean_cols(); // can't move clean_cols() farther up.
126 for (iter_top(staffs_
,i
); i
.ok(); i
++) {
136 for (iter_top(staffs_
,i
); i
.ok(); i
++) {
138 assert(i
->score_l_
== this);
142 for (iter_top(cols_
,cc
); cc
.ok() && (cc
+1).ok(); cc
++) {
143 assert(cc
->when() <= (cc
+1)->when());
154 for (iter_top(staffs_
,i
); i
.ok(); i
++) {
157 for (iter_top(cols_
,i
); i
.ok(); i
++) {
167 Score::Score(Paperdef
*paper_p
)
182 Score::output(String s
)
185 if (paper_p_
->outfile
=="")
186 paper_p_
->outfile
= s
;
188 if ( errorlevel_i_
) {
189 *mlog
<< "lilypond: warning: no output to: " << paper_p_
->outfile
190 << " (errorlevel=" << errorlevel_i_
<< ")" << endl
;
194 *mlog
<< "output to " << paper_p_
->outfile
<< "...\n";
196 Tex_stream
the_output(paper_p_
->outfile
);
198 the_output
<< "% outputting Score, defined at: " <<
200 sourcefile_l (defined_ch_c_l_
)->file_line_no_str(defined_ch_c_l_
) << "\n";
201 pscore_p_
->output(the_output
);
210 staffs_
.bottom().add(s
);
214 Score::add_marks(Array
<String
> s_arr
, Array
<Moment
> m_arr
)
216 for (int i
=0; i
< s_arr
.size(); i
++) {
217 String
mark_str (s_arr
[i
]);
218 if (markers_assoc_
.elt_query(mark_str
) &&
219 m_arr
[i
] != markers_assoc_
[mark_str
])
221 error("Conflicting marker: `" + s_arr
[i
]+ "\'");
223 markers_assoc_
[s_arr
[i
]] = m_arr
[i
];