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);
41 /** a request with a duration.
42 This request is used only a base class.
44 class Rhythmic_req : public virtual Musical_req {
49 void set_duration(Duration);
50 static int compare(const Rhythmic_req &, const Rhythmic_req &);
51 virtual Moment duration() const;
53 REQUESTMETHODS(Rhythmic_req, rhythmic);
56 struct Spacing_req :virtual Request {
62 REQUESTMETHODS(Spacing_req, spacing);
65 class Blank_req : public Spacing_req, Rhythmic_req {
67 REQUESTMETHODS(Spacing_req, spacing);
71 /// Put a text above or below (?) this staff.
72 class Text_req : public virtual Musical_req {
74 /// preferred position (above/below)
76 /// the characteristics of the text
80 Text_req(int d, Text_def*);
82 Text_req(Text_req const&);
83 static int compare(const Text_req&,const Text_req&);
84 REQUESTMETHODS(Text_req,text);
87 /** Put a text in lyric_staff
90 class Lyric_req : public Rhythmic_req, public Text_req {
92 Lyric_req(Text_def* t_p);
93 REQUESTMETHODS(Lyric_req, lreq_l);
96 /// request which has some kind of pitch
97 struct Melodic_req :virtual Musical_req
104 /// 0 natural, 1 sharp, etc
107 /// return height from central c (in halflines)
110 /// transpose. #delta# is relative to central c.
111 void transpose(Melodic_req const &delta);
112 /// return pitch from central c (in halfnotes)
116 REQUESTMETHODS(Melodic_req,melodic);
119 /// Put a note of specified type, height, and with accidental on the staff.
120 class Note_req : public Rhythmic_req, virtual public Melodic_req {
123 /// force/supress printing of accidental.
126 Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic(); }
127 REQUESTMETHODS(Note_req, note);
131 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.
133 class Rest_req : public Rhythmic_req {
135 REQUESTMETHODS(Rest_req,rest);
139 attach a stem to the noteball.
140 Rhythmic_req parent needed to determine if it will fit inside a beam.
142 class Stem_req : public Rhythmic_req {
144 /// preferred direction for the stem
147 REQUESTMETHODS(Stem_req,stem);
151 Requests to start or stop something.
152 This type of request typically results in the creation of a #Spanner#
154 class Span_req : public virtual Musical_req {
156 /// should the spanner start or stop, or is it unwanted?
160 static int compare(const Span_req &r1, const Span_req &r2);
161 REQUESTMETHODS(Span_req,span);
168 request for backward plet generation.
170 ugr. Place in hierarchy?
172 class Plet_req : public virtual Request {
179 REQUESTMETHODS(Plet_req,plet);
182 /** Start / stop a beam at this note. if #nplet# is set, the staff
183 will try to put an appropriate number over the beam */
184 class Beam_req : public Span_req {
188 /* *************** */
189 REQUESTMETHODS(Beam_req,beam);
195 class Slur_req : public Span_req {
197 REQUESTMETHODS(Slur_req,slur);
202 /** Put a script above or below this ``note''. eg upbow, downbow. Why
203 a request? These symbols may conflict with slurs and brackets, so
204 this also a request */
205 class Script_req : public Musical_req {
208 Script_def *scriptdef_p_;
210 /* *************** */
211 static int compare(const Script_req &, const Script_req &);
212 Script_req(int d, Script_def*);
213 REQUESTMETHODS(Script_req,script);
215 Script_req(Script_req const&);
218 /** A helper in the hierarchy. Each dynamic is bound to one note ( a
219 crescendo spanning multiple notes is thought to be made of two
220 "dynamics": a start and a stop). Dynamic changes can occur in a
221 smaller time than the length of its note, therefore fore each
222 Dynamic request carries a time, measured from the start of its
225 class Subtle_req : public virtual Musical_req {
227 /// the time relative to Voice_element start.
229 REQUESTMETHODS(Subtle_req, subtle);
232 class Dynamic_req : public Subtle_req {
234 /// for absolute dynamics
236 FFF, FF, F, MF, MP, P, PP, PPP
238 static String loudness_str(Loudness);
239 REQUESTMETHODS(Dynamic_req, dynamic);
242 class Absolute_dynamic_req : public Dynamic_req {
245 Absolute_dynamic_req();
246 REQUESTMETHODS(Absolute_dynamic_req, absdynamic);
249 class Span_dynamic_req : public Dynamic_req, public Span_req {
251 /// Grow or shrink the volume: 1=cresc, -1 = decresc
254 REQUESTMETHODS(Span_dynamic_req, span_dynamic);
257 #endif // MUSICALREQUESTS_HH