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 Lyric_req* lreq_l() { return 0; }
26 virtual Note_req *note() { return 0;}
27 virtual Stem_req *stem() { return 0;}
28 virtual Melodic_req *melodic() { return 0; }
29 virtual Slur_req *slur() { return 0 ; }
30 virtual Beam_req *beam() { return 0 ; }
31 virtual Rhythmic_req*rhythmic() { return 0; }
32 virtual Musical_script_req*musicalscript() { return 0; }
33 virtual Skip_req* skip() { return 0; }
34 virtual Dynamic_req* dynamic() { return 0; }
35 virtual Absolute_dynamic_req * absdynamic() { return 0; }
36 virtual Tie_req * tie() { return 0; }
37 virtual Subtle_req * subtle() { return 0; }
38 virtual Span_dynamic_req * span_dynamic() { return 0; }
39 REQUESTMETHODS(Musical_req, musical);
43 class Skip_req : public Musical_req {
47 virtual Moment duration() const;
48 REQUESTMETHODS(Skip_req, skip);
51 /** a request with a duration.
52 This request is used only a base class.
54 class Rhythmic_req : public virtual Musical_req {
59 void set_duration(Duration);
60 static int compare(const Rhythmic_req &, const Rhythmic_req &);
61 virtual Moment duration() const;
63 REQUESTMETHODS(Rhythmic_req, rhythmic);
66 struct Spacing_req :virtual Request {
72 REQUESTMETHODS(Spacing_req, spacing);
75 class Blank_req : public Spacing_req, Rhythmic_req {
77 REQUESTMETHODS(Spacing_req, spacing);
81 /// Put a text above or below (?) this staff.
82 class Text_req : public virtual Musical_req {
84 /// preferred position (above/below)
86 /// the characteristics of the text
90 Text_req(int d, Text_def*);
92 Text_req(Text_req const&);
93 static int compare(const Text_req&,const Text_req&);
94 REQUESTMETHODS(Text_req,text);
97 /** Put a text in lyric_staff
100 class Lyric_req : public Rhythmic_req, public Text_req {
102 Lyric_req(Text_def* t_p);
103 REQUESTMETHODS(Lyric_req, lreq_l);
106 /// request which has some kind of pitch
107 struct Melodic_req :virtual Musical_req
114 /// 0 natural, 1 sharp, etc
117 /// return height from central c (in halflines)
120 /// transpose. #delta# is relative to central c.
121 void transpose(Melodic_req const &delta);
122 /// return pitch from central c (in halfnotes)
125 static int compare(Melodic_req const&, Melodic_req const&);
127 REQUESTMETHODS(Melodic_req,melodic);
130 /// Put a note of specified type, height, and with accidental on the staff.
131 class Note_req : public Rhythmic_req, virtual public Melodic_req {
134 /// force/supress printing of accidental.
137 Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic(); }
138 REQUESTMETHODS(Note_req, note);
142 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.
144 class Rest_req : public Rhythmic_req {
146 REQUESTMETHODS(Rest_req,rest);
150 attach a stem to the noteball.
151 Rhythmic_req parent needed to determine if it will fit inside a beam.
153 class Stem_req : public Rhythmic_req {
155 /// preferred direction for the stem
158 REQUESTMETHODS(Stem_req,stem);
162 Requests to start or stop something.
163 This type of request typically results in the creation of a #Spanner#
165 class Span_req : public virtual Musical_req {
167 /// should the spanner start or stop, or is it unwanted?
171 static int compare(const Span_req &r1, const Span_req &r2);
172 REQUESTMETHODS(Span_req,span);
178 /** Start / stop a beam at this note. if #nplet# is set, the staff
179 will try to put an appropriate number over the beam */
180 class Beam_req : public Span_req {
184 /* *************** */
185 REQUESTMETHODS(Beam_req,beam);
191 Start a tie at this voice element, end it at the next
193 class Tie_req : public Musical_req {
195 REQUESTMETHODS(Tie_req, tie);
199 class Slur_req : public Span_req {
201 REQUESTMETHODS(Slur_req,slur);
205 class Musical_script_req : public Musical_req, public Script_req {
207 REQUESTMETHODS(Musical_script_req, musicalscript);
211 /** A helper in the hierarchy. Each dynamic is bound to one note ( a
212 crescendo spanning multiple notes is thought to be made of two
213 "dynamics": a start and a stop). Dynamic changes can occur in a
214 smaller time than the length of its note, therefore fore each
215 Dynamic request carries a time, measured from the start of its
218 class Subtle_req : public virtual Musical_req {
220 /// the time relative to Voice_element start.
222 REQUESTMETHODS(Subtle_req, subtle);
225 class Dynamic_req : public Subtle_req {
227 /// for absolute dynamics
229 FFF, FF, F, MF, MP, P, PP, PPP
231 static String loudness_str(Loudness);
232 REQUESTMETHODS(Dynamic_req, dynamic);
235 class Absolute_dynamic_req : public Dynamic_req {
238 Absolute_dynamic_req();
239 REQUESTMETHODS(Absolute_dynamic_req, absdynamic);
242 class Span_dynamic_req : public Dynamic_req, public Span_req {
244 /// Grow or shrink the volume: 1=cresc, -1 = decresc
247 REQUESTMETHODS(Span_dynamic_req, span_dynamic);
250 #endif // MUSICALREQUESTS_HH