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
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)
118 REQUESTMETHODS(Melodic_req,melodic);
121 /// Put a note of specified type, height, and with accidental on the staff.
122 class Note_req : public Rhythmic_req, virtual public Melodic_req {
125 /// force/supress printing of accidental.
128 Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic(); }
129 REQUESTMETHODS(Note_req, note);
133 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.
135 class Rest_req : public Rhythmic_req {
137 REQUESTMETHODS(Rest_req,rest);
141 attach a stem to the noteball.
142 Rhythmic_req parent needed to determine if it will fit inside a beam.
144 class Stem_req : public Rhythmic_req {
146 /// preferred direction for the stem
149 REQUESTMETHODS(Stem_req,stem);
153 Requests to start or stop something.
154 This type of request typically results in the creation of a #Spanner#
156 class Span_req : public virtual Musical_req {
158 /// should the spanner start or stop, or is it unwanted?
162 static int compare(const Span_req &r1, const Span_req &r2);
163 REQUESTMETHODS(Span_req,span);
170 request for backward plet generation.
172 ugr. Place in hierarchy?
174 class Plet_req : public virtual Request {
181 REQUESTMETHODS(Plet_req,plet);
184 /** Start / stop a beam at this note. if #nplet# is set, the staff
185 will try to put an appropriate number over the beam */
186 class Beam_req : public Span_req {
190 /* *************** */
191 REQUESTMETHODS(Beam_req,beam);
197 Start a tie at this voice element, end it at the next
199 class Tie_req : public Musical_req {
201 REQUESTMETHODS(Tie_req, tie);
205 class Slur_req : public Span_req {
207 REQUESTMETHODS(Slur_req,slur);
212 /** Put a script above or below this ``note''. eg upbow, downbow. Why
213 a request? These symbols may conflict with slurs and brackets, so
214 this also a request */
215 class Script_req : public Musical_req {
218 Script_def *scriptdef_p_;
220 /* *************** */
221 static int compare(const Script_req &, const Script_req &);
222 Script_req(int d, Script_def*);
223 REQUESTMETHODS(Script_req,script);
225 Script_req(Script_req const&);
228 /** A helper in the hierarchy. Each dynamic is bound to one note ( a
229 crescendo spanning multiple notes is thought to be made of two
230 "dynamics": a start and a stop). Dynamic changes can occur in a
231 smaller time than the length of its note, therefore fore each
232 Dynamic request carries a time, measured from the start of its
235 class Subtle_req : public virtual Musical_req {
237 /// the time relative to Voice_element start.
239 REQUESTMETHODS(Subtle_req, subtle);
242 class Dynamic_req : public Subtle_req {
244 /// for absolute dynamics
246 FFF, FF, F, MF, MP, P, PP, PPP
248 static String loudness_str(Loudness);
249 REQUESTMETHODS(Dynamic_req, dynamic);
252 class Absolute_dynamic_req : public Dynamic_req {
255 Absolute_dynamic_req();
256 REQUESTMETHODS(Absolute_dynamic_req, absdynamic);
259 class Span_dynamic_req : public Dynamic_req, public Span_req {
261 /// Grow or shrink the volume: 1=cresc, -1 = decresc
264 REQUESTMETHODS(Span_dynamic_req, span_dynamic);
267 #endif // MUSICALREQUESTS_HH