2 musical-request.hh -- declare Musical requests
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
10 #ifndef MUSICALREQUESTS_HH
11 #define MUSICALREQUESTS_HH
14 #include "duration.hh"
18 A request which is coupled to a #Voice_element# with nonzero duration.
21 class Musical_req : public virtual Request {
24 virtual Skip_req* skip() { return 0; }
25 virtual Dynamic_req* dynamic() { return 0; }
26 virtual Absolute_dynamic_req * absdynamic() { return 0; }
27 virtual Subtle_req * subtle() { return 0; }
28 virtual Span_dynamic_req * span_dynamic() { return 0; }
29 REQUESTMETHODS(Musical_req, musical);
33 class Skip_req : public Musical_req {
37 virtual Moment duration() const;
38 REQUESTMETHODS(Skip_req, skip);
40 /** a request with a duration.
41 This request is used only a base class.
43 class Rhythmic_req : public virtual Musical_req {
48 void set_duration(Duration);
49 static int compare(const Rhythmic_req &, const Rhythmic_req &);
50 virtual Moment duration() const;
52 REQUESTMETHODS(Rhythmic_req, rhythmic);
55 struct Spacing_req :virtual Request {
61 REQUESTMETHODS(Spacing_req, spacing);
64 class Blank_req : public Spacing_req, Rhythmic_req {
66 REQUESTMETHODS(Spacing_req, spacing);
70 /// Put a text above or below (?) this staff.
71 class Text_req : public virtual Musical_req {
73 /// preferred position (above/below)
75 /// the characteristics of the text
78 Text_req(int d, Text_def*);
80 Text_req(Text_req const&);
81 static int compare(const Text_req&,const Text_req&);
82 REQUESTMETHODS(Text_req,text);
85 /** Put a text in lyric_staff
88 class Lyric_req : public Rhythmic_req, public Text_req {
90 Lyric_req(Text_def* t_p);
91 REQUESTMETHODS(Lyric_req, lreq_l);
94 /// request which has some kind of pitch
95 struct Melodic_req :virtual Musical_req
102 /// 0 natural, 1 sharp, etc
105 /// return height from central c (in halflines)
108 /// transpose. #delta# is relative to central c.
109 void transpose(Melodic_req const &delta);
110 /// return pitch from central c (in halfnotes)
114 REQUESTMETHODS(Melodic_req,melodic);
117 /// Put a note of specified type, height, and with accidental on the staff.
118 class Note_req : public Rhythmic_req, virtual public Melodic_req {
121 /// force/supress printing of accidental.
124 Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic(); }
125 REQUESTMETHODS(Note_req, note);
129 Put a rest on the staff. Why a request? It might be a good idea to not typeset the rest, if the paper is too crowded.
131 class Rest_req : public Rhythmic_req {
133 REQUESTMETHODS(Rest_req,rest);
137 attach a stem to the noteball.
138 Rhythmic_req parent needed to determine if it will fit inside a beam.
140 class Stem_req : public Rhythmic_req {
142 /// preferred direction for the stem
145 REQUESTMETHODS(Stem_req,stem);
149 Requests to start or stop something.
150 This type of request typically results in the creation of a #Spanner#
152 class Span_req : public virtual Musical_req {
154 /// should the spanner start or stop, or is it unwanted?
158 static int compare(const Span_req &r1, const Span_req &r2);
159 REQUESTMETHODS(Span_req,span);
166 request for backward plet generation.
168 ugr. Place in hierarchy?
170 class Plet_req : public virtual Request {
177 REQUESTMETHODS(Plet_req,plet);
180 /** Start / stop a beam at this note. if #nplet# is set, the staff will try to put an
181 appropriate number over the beam
183 class Beam_req : public Span_req {
187 /* *************** */
188 REQUESTMETHODS(Beam_req,beam);
194 class Slur_req : public Span_req {
196 REQUESTMETHODS(Slur_req,slur);
201 /** Put a script above or below this ``note''. eg upbow, downbow. Why
202 a request? These symbols may conflict with slurs and brackets, so
203 this also a request */
204 class Script_req : public Musical_req {
207 Script_def *scriptdef_p_;
209 /* *************** */
210 static int compare(const Script_req &, const Script_req &);
211 Script_req(int d, Script_def*);
212 REQUESTMETHODS(Script_req,script);
214 Script_req(Script_req const&);
217 /** A helper in the hierarchy. Each dynamic is bound to one note ( a
218 crescendo spanning multiple notes is thought to be made of two
219 "dynamics": a start and a stop). Dynamic changes can occur in a
220 smaller time than the length of its note, therefore fore each
221 Dynamic request carries a time, measured from the start of its
224 class Subtle_req : public virtual Musical_req {
227 REQUESTMETHODS(Subtle_req, subtle);
230 class Dynamic_req : public Subtle_req {
232 /// for absolute dynamics
234 FFF, FF, F, MF, MP, P, PP, PPP
236 static String loudness_str(Loudness);
237 REQUESTMETHODS(Dynamic_req, dynamic);
240 class Absolute_dynamic_req : public Dynamic_req {
243 Absolute_dynamic_req();
244 REQUESTMETHODS(Absolute_dynamic_req, absdynamic);
247 class Span_dynamic_req : public Dynamic_req, public Span_req {
249 /// Grow or shrink the volume: 1=cresc, -1 = decresc
252 REQUESTMETHODS(Span_dynamic_req, span_dynamic);
255 #endif // MUSICALREQUESTS_HH