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 struct Musical_req : virtual Request {
23 virtual Skip_req* skip() { return 0; }
24 virtual Dynamic_req* dynamic() { return 0; }
25 virtual Absolute_dynamic_req * absdynamic() { return 0; }
26 virtual Subtle_req * subtle() { return 0; }
27 virtual Span_dynamic_req * span_dynamic() { return 0; }
28 REQUESTMETHODS(Musical_req, musical);
32 struct Skip_req : Musical_req {
35 virtual Moment duration() const;
36 REQUESTMETHODS(Skip_req, skip);
38 /** a request with a duration.
39 This request is used only a base class.
41 struct Rhythmic_req : virtual Musical_req {
45 void set_duration(Duration);
46 static int compare(const Rhythmic_req &, const Rhythmic_req &);
47 virtual Moment duration() const;
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
99 /// return height from central c (in halflines)
102 /// transpose. #delta# is relative to central c.
103 void transpose(Melodic_req const &delta);
104 /// return pitch from central c (in halfnotes)
108 REQUESTMETHODS(Melodic_req,melodic);
111 /// Put a note of specified type, height, and with accidental on the staff.
112 struct Note_req : Rhythmic_req, virtual Melodic_req {
114 /// force/supress printing of accidental.
117 Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic(); }
118 REQUESTMETHODS(Note_req, note);
122 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.
124 class Rest_req : public Rhythmic_req {
126 REQUESTMETHODS(Rest_req,rest);
130 attach a stem to the noteball.
131 Rhythmic_req parent needed to determine if it will fit inside a beam.
133 struct Stem_req : Rhythmic_req {
134 /// preferred direction for the stem
137 REQUESTMETHODS(Stem_req,stem);
141 Requests to start or stop something.
142 This type of request typically results in the creation of a #Spanner#
144 struct Span_req : virtual Musical_req {
145 /// should the spanner start or stop, or is it unwanted?
149 static int compare(const Span_req &r1, const Span_req &r2);
150 REQUESTMETHODS(Span_req,span);
157 request for backward plet generation.
159 ugr. Place in hierarchy?
161 struct Plet_req : virtual Request {
167 REQUESTMETHODS(Plet_req,plet);
170 /** Start / stop a beam at this note. if #nplet# is set, the staff will try to put an
171 appropriate number over the beam
173 struct Beam_req : Span_req {
176 /* *************** */
177 REQUESTMETHODS(Beam_req,beam);
183 struct Slur_req : Span_req {
184 REQUESTMETHODS(Slur_req,slur);
189 /** Put a script above or below this ``note''. eg upbow, downbow. Why
190 a request? These symbols may conflict with slurs and brackets, so
191 this also a request */
192 struct Script_req : Musical_req {
194 Script_def *scriptdef_p_;
196 /* *************** */
197 static int compare(const Script_req &, const Script_req &);
198 Script_req(int d, Script_def*);
199 REQUESTMETHODS(Script_req,script);
201 Script_req(Script_req const&);
204 /** A helper in the hierarchy. Each dynamic is bound to one note ( a
205 crescendo spanning multiple notes is thought to be made of two
206 "dynamics": a start and a stop). Dynamic changes can occur in a
207 smaller time than the length of its note, therefore fore each
208 Dynamic request carries a time, measured from the start of its
211 struct Subtle_req : virtual Musical_req {
213 REQUESTMETHODS(Subtle_req, subtle);
216 struct Dynamic_req : Subtle_req {
217 /// for absolute dynamics
219 FFF, FF, F, MF, MP, P, PP, PPP
221 static String loudness_str(Loudness);
222 REQUESTMETHODS(Dynamic_req, dynamic);
225 struct Absolute_dynamic_req : Dynamic_req {
227 Absolute_dynamic_req();
228 REQUESTMETHODS(Absolute_dynamic_req, absdynamic);
231 struct Span_dynamic_req : Dynamic_req, Span_req {
232 /// Grow or shrink the volume: 1=cresc, -1 = decresc
235 REQUESTMETHODS(Span_dynamic_req, span_dynamic);
238 #endif // MUSICALREQUESTS_HH