2 request.cc -- implement all musical requests.
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
9 #include "musical-request.hh"
12 #include "script-def.hh"
13 #include "text-def.hh"
15 #include "voice-element.hh"
18 Stem_req::do_print() const
20 Rhythmic_req::do_print();
21 mtor << "dir : " << dir_i_;
24 Stem_req::Stem_req(int s, int d)
31 void Musical_req::do_print()const{}
32 void Request::do_print() const{}
37 Request::print() const
40 mtor << name() << " {";
49 Span_req::do_print() const
61 Request::Request(Request const&src)
64 defined_ch_c_l_ = src.defined_ch_c_l_;
67 Spacing_req::Spacing_req()
74 Spacing_req::do_print()const
77 mtor << "next " << next << "dist " << distance << "strength\n";
82 Blank_req::do_print()const
84 Spacing_req::do_print();
87 Melodic_req::Melodic_req()
95 Melodic_req::do_print() const
98 mtor << "notename: " << notename_i_ << " acc: " <<accidental_i_<<" oct: "<< octave_i_;
103 Melodic_req::height() const
105 return notename_i_ + octave_i_*7;
109 should be settable from input to allow "viola"-mode
111 static Byte pitch_byte_a[ 7 ] = { 0, 2, 4, 5, 7, 9, 11 };
114 Melodic_req::pitch() const
116 return pitch_byte_a[ notename_i_ % 7 ] + accidental_i_ + octave_i_ * 12;
127 Plet_req::do_print() const
130 mtor << "plet: " << type_c_ << ": " << dur_i_ << "/" << type_i_;
134 /* *************** */
136 Rhythmic_req::compare(Rhythmic_req const &r1, Rhythmic_req const &r2)
138 return sign(r1.duration() - r2.duration());
140 Rhythmic_req::Rhythmic_req(int b, int d)
147 Rhythmic_req::Rhythmic_req()
155 Rhythmic_req::do_print() const
158 mtor << "ball: " << balltype ;
163 mtor<<", plet factor"<<plet_factor<<"\n";
169 Rhythmic_req::duration() const {
170 return wholes(balltype,dots)*plet_factor;
172 /* *************** */
174 Lyric_req::Lyric_req(Text_def* def_p)
177 def_p->align_i_ = 0; // centre
178 dir_i_ = -1; // lyrics below (invisible) staff
182 Lyric_req::do_print() const
184 Rhythmic_req::do_print();
185 Text_req::do_print();
188 /* *************** */
194 Note_req::do_print() const
197 mtor << " forceacc_b_ " << forceacc_b_ << '\n';
198 Melodic_req::do_print();
199 Rhythmic_req::do_print();
202 /* *************** */
204 Rest_req::do_print() const
206 Rhythmic_req::do_print();
209 /* *************** */
215 void Beam_req::do_print()const{}
216 /* *************** */
217 void Slur_req::do_print()const{}
218 /* *************** */
220 Span_req:: compare(Span_req const &r1, Span_req const &r2)
222 return r1.spantype - r2.spantype;
230 /* *************** */
231 Script_req::Script_req(int d , Script_def*def)
238 Script_req::compare(Script_req const &d1, Script_req const &d2)
240 return d1.dir_i_ == d2.dir_i_ &&
241 d1.scriptdef_p_->compare(*d2.scriptdef_p_);
244 Script_req::Script_req(Script_req const &s)
248 scriptdef_p_ = new Script_def(*s.scriptdef_p_);
252 Script_req::do_print() const
254 mtor << " dir " << dir_i_ ;
255 scriptdef_p_->print();
259 Script_req::~Script_req()
263 /* *************** */
265 Text_req:: compare(Text_req const &r1, Text_req const &r2)
267 bool b1 = (r1.dir_i_ == r2.dir_i_);
268 bool b2 = (r1.tdef_p_ ->compare(*r2.tdef_p_));
271 Text_req::~Text_req()
277 Text_req::Text_req(Text_req const& src)
279 tdef_p_ = new Text_def(*src.tdef_p_);
283 Text_req::Text_req(int dir_i, Text_def* tdef_p)
290 Text_req::do_print() const
294 mtor << " dir " << dir_i_ ;
299 /* *************** */
302 Skip_req::duration() const
308 Skip_req::do_print() const
312 mtor << "duration: " << duration();
322 return (Voice*)elt_l_->voice_l_;
324 /* *************** */
327 Subtle_req::do_print() const
330 mtor << " subtime " << subtime_;
335 Dynamic_req::do_print() const
337 Subtle_req::do_print();
341 Absolute_dynamic_req::do_print() const
343 Dynamic_req::do_print();
344 mtor << " loudness_" <<loudness_;
348 Dynamic_req::loudness_str(Loudness l)
351 case FFF: return "fff";
352 case FF: return "ff";
354 case MF: return "mf";
355 case MP: return "mp";
357 case PP: return "pp";
358 case PPP: return "ppp";
364 Absolute_dynamic_req::Absolute_dynamic_req()
370 Span_dynamic_req::Span_dynamic_req()
376 Span_dynamic_req::do_print()const
379 Span_req::do_print();
380 mtor << "louder/louder: " <<dynamic_dir_i_;