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 "musicalrequest.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
39 mtor
<< name() << " {";
47 Span_req::do_print() const
59 Request::Request(Request
const&src
)
62 defined_ch_c_l_
= src
.defined_ch_c_l_
;
65 Spacing_req::Spacing_req()
72 Spacing_req::do_print()const
75 mtor
<< "next " << next
<< "dist " << distance
<< "strength\n";
80 Blank_req::do_print()const
82 Spacing_req::do_print();
85 Melodic_req::Melodic_req()
94 Melodic_req::do_print() const
96 mtor
<< "notename: " << notename_i_
<< " acc: " <<accidental_i_
<<" oct: "<< octave_i_
;
100 Melodic_req::height() const
102 return notename_i_
+ octave_i_
*7;
106 should be settable from input to allow "viola"-mode
108 static Byte pitch_byte_a
[ 7 ] = { 0, 2, 4, 5, 7, 9, 11 };
111 Melodic_req::pitch() const
113 return pitch_byte_a
[ notename_i_
% 7 ] + accidental_i_
+ octave_i_
* 12;
124 Plet_req::do_print() const
126 mtor
<< "plet: " << type_c_
<< ": " << dur_i_
<< "/" << type_i_
;
129 /* *************** */
131 Rhythmic_req::compare(const Rhythmic_req
&r1
, const Rhythmic_req
&r2
)
133 return sign(r1
.duration() - r2
.duration());
135 Rhythmic_req::Rhythmic_req(int b
, int d
)
142 Rhythmic_req::Rhythmic_req()
150 Rhythmic_req::do_print() const
152 mtor
<< "ball: " << balltype
;
157 mtor
<<", plet factor"<<plet_factor
<<"\n";
162 Rhythmic_req::duration() const {
163 return wholes(balltype
,dots
)*plet_factor
;
165 /* *************** */
167 Lyric_req::Lyric_req(Text_def
* def_p
)
170 def_p
->align_i_
= 0; // centre
171 dir_i_
= -1; // lyrics below (invisible) staff
175 Lyric_req::do_print() const
177 Rhythmic_req::do_print();
178 Text_req::do_print();
180 /* *************** */
182 Note_req::do_print() const
184 Melodic_req::do_print();
185 Rhythmic_req::do_print();
187 /* *************** */
189 Rest_req::do_print() const
191 Rhythmic_req::do_print();
194 /* *************** */
200 void Beam_req::do_print()const{}
201 /* *************** */
202 void Slur_req::do_print()const{}
203 /* *************** */
205 Span_req:: compare(const Span_req
&r1
, const Span_req
&r2
)
207 return r1
.spantype
- r2
.spantype
;
215 /* *************** */
216 Script_req::Script_req(int d
, Script_def
*def
)
223 Script_req::compare(const Script_req
&d1
, const Script_req
&d2
)
225 return d1
.dir_i_
== d2
.dir_i_
&&
226 d1
.scriptdef_p_
->compare(*d2
.scriptdef_p_
);
229 Script_req::Script_req(Script_req
const &s
)
233 scriptdef_p_
= new Script_def(*s
.scriptdef_p_
);
237 Script_req::do_print() const
239 mtor
<< " dir " << dir_i_
;
240 scriptdef_p_
->print();
244 Script_req::~Script_req()
248 /* *************** */
250 Text_req:: compare(const Text_req
&r1
, const Text_req
&r2
)
252 bool b1
= (r1
.dir_i_
== r2
.dir_i_
);
253 bool b2
= (r1
.tdef_p_
->compare(*r2
.tdef_p_
));
256 Text_req::~Text_req()
262 Text_req::Text_req(Text_req
const& src
)
264 tdef_p_
= new Text_def(*src
.tdef_p_
);
268 Text_req::Text_req(int dir_i
, Text_def
* tdef_p
)
275 Text_req::do_print() const
277 mtor
<< " dir " << dir_i_
;
281 /* *************** */
284 Skip_req::duration() const
290 Skip_req::do_print() const
292 mtor
<< "duration: " << duration();
301 return (Voice
*)elt_l_
->voice_l_
;
303 /* *************** */
306 Subtle_req::do_print() const
308 mtor
<< " subtime " << subtime_
;
312 Dynamic_req::do_print() const
314 Subtle_req::do_print();
318 Absolute_dynamic_req::do_print() const
320 Dynamic_req::do_print();
321 mtor
<< " loudness_" <<loudness_
;
325 Dynamic_req::loudness_str(Loudness l
)
328 case FFF
: return "fff";
329 case FF
: return "ff";
331 case MF
: return "mf";
332 case MP
: return "mp";
334 case PP
: return "pp";
335 case PPP
: return "ppp";
341 Absolute_dynamic_req::Absolute_dynamic_req()