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
17 A request which is coupled to a #Voice_element# with nonzero duration.
20 struct Musical_req : virtual Request {
22 virtual Skip_req* skip() { return 0; }
23 virtual Dynamic_req* dynamic() { return 0; }
24 virtual Absolute_dynamic_req * absdynamic() { return 0; }
25 virtual Subtle_req * subtle() { return 0; }
26 virtual Span_dynamic_req * span_dynamic() { return 0; }
27 REQUESTMETHODS(Musical_req, musical);
31 struct Skip_req : Musical_req {
34 virtual Moment duration() const;
35 REQUESTMETHODS(Skip_req, skip);
37 /** a request with a duration.
38 This request is used only a base class.
40 struct Rhythmic_req : virtual Musical_req {
45 static int compare(const Rhythmic_req &, const Rhythmic_req &);
46 virtual Moment duration() const;
48 Rhythmic_req(int,int);
49 REQUESTMETHODS(Rhythmic_req, rhythmic);
52 struct Spacing_req :virtual Request {
58 REQUESTMETHODS(Spacing_req, spacing);
61 struct Blank_req : Spacing_req, Rhythmic_req {
62 REQUESTMETHODS(Spacing_req, spacing);
66 /// Put a text above or below (?) this staff.
67 struct Text_req : virtual Musical_req {
68 /// preferred position (above/below)
70 /// the characteristics of the text
73 Text_req(int d, Text_def*);
75 Text_req(Text_req const&);
76 static int compare(const Text_req&,const Text_req&);
77 REQUESTMETHODS(Text_req,text);
80 /** Put a text in lyric_staff
83 struct Lyric_req : public Rhythmic_req, Text_req {
84 Lyric_req(Text_def* t_p);
85 REQUESTMETHODS(Lyric_req, lreq_l);
88 /// request which has some kind of pitch
89 struct Melodic_req :virtual Musical_req
96 /// 0 natural, 1 sharp, etc
100 /// return height from central c (in halflines)
102 /// return pitch from central c (in halfnotes)
106 REQUESTMETHODS(Melodic_req,melodic);
109 /// Put a note of specified type, height, and with accidental on the staff.
110 struct Note_req : Rhythmic_req, virtual Melodic_req {
112 /// force/supress printing of accidental.
115 Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic(); }
116 REQUESTMETHODS(Note_req, note);
120 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.
122 class Rest_req : public Rhythmic_req {
124 REQUESTMETHODS(Rest_req,rest);
128 attach a stem to the noteball.
129 Rhythmic_req parent needed to determine if it will fit inside a beam.
131 struct Stem_req : Rhythmic_req {
132 /// preferred direction for the stem
134 Stem_req(int s, int dots);
135 REQUESTMETHODS(Stem_req,stem);
139 Requests to start or stop something.
140 This type of request typically results in the creation of a #Spanner#
142 struct Span_req : virtual Musical_req {
143 /// should the spanner start or stop, or is it unwanted?
147 static int compare(const Span_req &r1, const Span_req &r2);
148 REQUESTMETHODS(Span_req,span);
155 request for backward plet generation.
157 ugr. Place in hierarchy?
159 struct Plet_req : virtual Request {
165 REQUESTMETHODS(Plet_req,plet);
168 /** Start / stop a beam at this note. if #nplet# is set, the staff will try to put an
169 appropriate number over the beam
171 struct Beam_req : Span_req {
174 /* *************** */
175 REQUESTMETHODS(Beam_req,beam);
181 struct Slur_req : Span_req {
182 REQUESTMETHODS(Slur_req,slur);
187 /** Put a script above or below this ``note''. eg upbow, downbow. Why
188 a request? These symbols may conflict with slurs and brackets, so
189 this also a request */
190 struct Script_req : Musical_req {
192 Script_def *scriptdef_p_;
194 /* *************** */
195 static int compare(const Script_req &, const Script_req &);
196 Script_req(int d, Script_def*);
197 REQUESTMETHODS(Script_req,script);
199 Script_req(Script_req const&);
202 /** A helper in the hierarchy. Each dynamic is bound to one note ( a
203 crescendo spanning multiple notes is thought to be made of two
204 "dynamics": a start and a stop). Dynamic changes can occur in a
205 smaller time than the length of its note, therefore fore each
206 Dynamic request carries a time, measured from the start of its
209 struct Subtle_req : virtual Musical_req {
211 REQUESTMETHODS(Subtle_req, subtle);
214 struct Dynamic_req : Subtle_req {
215 /// for absolute dynamics
217 FFF, FF, F, MF, MP, P, PP, PPP
219 static String loudness_str(Loudness);
220 REQUESTMETHODS(Dynamic_req, dynamic);
223 struct Absolute_dynamic_req : Dynamic_req {
225 Absolute_dynamic_req();
226 REQUESTMETHODS(Absolute_dynamic_req, absdynamic);
229 struct Span_dynamic_req : Dynamic_req, Span_req {
230 /// Grow or shrink the volume: 1=cresc, -1 = decresc
233 REQUESTMETHODS(Span_dynamic_req, span_dynamic);
236 #endif // MUSICALREQUESTS_HH