2 musical-request.hh -- declare Musical requests
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
10 #ifndef MUSICALREQUESTS_HH
11 #define MUSICALREQUESTS_HH
13 #include "lily-proto.hh"
15 #include "duration.hh"
19 A request which is coupled to a #Voice_element# with nonzero duration.
22 class Musical_req : public virtual Request {
25 virtual Skip_req* skip() { return 0; }
26 virtual Dynamic_req* dynamic() { return 0; }
27 virtual Absolute_dynamic_req * absdynamic() { return 0; }
28 virtual Tie_req * tie() { return 0; }
29 virtual Subtle_req * subtle() { return 0; }
30 virtual Span_dynamic_req * span_dynamic() { return 0; }
31 REQUESTMETHODS(Musical_req, musical);
35 class Skip_req : public Musical_req {
39 virtual Moment duration() const;
40 REQUESTMETHODS(Skip_req, skip);
43 /** a request with a duration.
44 This request is used only a base class.
46 class Rhythmic_req : public virtual Musical_req {
51 void set_duration(Duration);
52 static int compare(const Rhythmic_req &, const Rhythmic_req &);
53 virtual Moment duration() const;
55 REQUESTMETHODS(Rhythmic_req, rhythmic);
58 struct Spacing_req :virtual Request {
64 REQUESTMETHODS(Spacing_req, spacing);
67 class Blank_req : public Spacing_req, Rhythmic_req {
69 REQUESTMETHODS(Spacing_req, spacing);
73 /// Put a text above or below (?) this staff.
74 class Text_req : public virtual Musical_req {
76 /// preferred position (above/below)
78 /// the characteristics of the text
82 Text_req(int d, Text_def*);
84 Text_req(Text_req const&);
85 static int compare(const Text_req&,const Text_req&);
86 REQUESTMETHODS(Text_req,text);
89 /** Put a text in lyric_staff
92 class Lyric_req : public Rhythmic_req, public Text_req {
94 Lyric_req(Text_def* t_p);
95 REQUESTMETHODS(Lyric_req, lreq_l);
98 /// request which has some kind of pitch
99 struct Melodic_req :virtual Musical_req
106 /// 0 natural, 1 sharp, etc
109 /// return height from central c (in halflines)
112 /// transpose. #delta# is relative to central c.
113 void transpose(Melodic_req const &delta);
114 /// return pitch from central c (in halfnotes)
117 static int compare(Melodic_req const&, Melodic_req const&);
119 REQUESTMETHODS(Melodic_req,melodic);
122 /// Put a note of specified type, height, and with accidental on the staff.
123 class Note_req : public Rhythmic_req, virtual public Melodic_req {
126 /// force/supress printing of accidental.
129 Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic(); }
130 REQUESTMETHODS(Note_req, note);
134 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.
136 class Rest_req : public Rhythmic_req {
138 REQUESTMETHODS(Rest_req,rest);
142 attach a stem to the noteball.
143 Rhythmic_req parent needed to determine if it will fit inside a beam.
145 class Stem_req : public Rhythmic_req {
147 /// preferred direction for the stem
150 REQUESTMETHODS(Stem_req,stem);
154 Requests to start or stop something.
155 This type of request typically results in the creation of a #Spanner#
157 class Span_req : public virtual Musical_req {
159 /// should the spanner start or stop, or is it unwanted?
163 static int compare(const Span_req &r1, const Span_req &r2);
164 REQUESTMETHODS(Span_req,span);
171 request for backward plet generation.
173 ugr. Place in hierarchy?
175 class Plet_req : public virtual Request {
182 REQUESTMETHODS(Plet_req,plet);
185 /** Start / stop a beam at this note. if #nplet# is set, the staff
186 will try to put an appropriate number over the beam */
187 class Beam_req : public Span_req {
191 /* *************** */
192 REQUESTMETHODS(Beam_req,beam);
198 Start a tie at this voice element, end it at the next
200 class Tie_req : public Musical_req {
202 REQUESTMETHODS(Tie_req, tie);
206 class Slur_req : public Span_req {
208 REQUESTMETHODS(Slur_req,slur);
213 /** Put a script above or below this ``note''. eg upbow, downbow. Why
214 a request? These symbols may conflict with slurs and brackets, so
215 this also a request */
216 class Script_req : public Musical_req {
219 Script_def *scriptdef_p_;
221 /* *************** */
222 static int compare(const Script_req &, const Script_req &);
223 Script_req(int d, Script_def*);
224 REQUESTMETHODS(Script_req,script);
226 Script_req(Script_req const&);
229 /** A helper in the hierarchy. Each dynamic is bound to one note ( a
230 crescendo spanning multiple notes is thought to be made of two
231 "dynamics": a start and a stop). Dynamic changes can occur in a
232 smaller time than the length of its note, therefore fore each
233 Dynamic request carries a time, measured from the start of its
236 class Subtle_req : public virtual Musical_req {
238 /// the time relative to Voice_element start.
240 REQUESTMETHODS(Subtle_req, subtle);
243 class Dynamic_req : public Subtle_req {
245 /// for absolute dynamics
247 FFF, FF, F, MF, MP, P, PP, PPP
249 static String loudness_str(Loudness);
250 REQUESTMETHODS(Dynamic_req, dynamic);
253 class Absolute_dynamic_req : public Dynamic_req {
256 Absolute_dynamic_req();
257 REQUESTMETHODS(Absolute_dynamic_req, absdynamic);
260 class Span_dynamic_req : public Dynamic_req, public Span_req {
262 /// Grow or shrink the volume: 1=cresc, -1 = decresc
265 REQUESTMETHODS(Span_dynamic_req, span_dynamic);
268 #endif // MUSICALREQUESTS_HH