lilypond-0.1.16
[lilypond.git] / lily / include / musical-request.hh
blob5ebe4cb3a382b390e7073c5e83ec32dada0ef803
1 /*
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>
7 */
10 #ifndef MUSICALREQUESTS_HH
11 #define MUSICALREQUESTS_HH
13 #include "lily-proto.hh"
14 #include "request.hh"
15 #include "duration.hh"
18 /**
19 A request which is coupled to a #Request_chord#
20 Base class only
22 class Musical_req : public virtual Request {
23 public:
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 Abbreviation_beam_req* abbrev_beam() { return 0 ; }
32 virtual Rhythmic_req*rhythmic() { return 0; }
33 virtual Musical_script_req*musicalscript() { return 0; }
34 virtual Text_req*text() { return 0; }
35 virtual Rest_req *rest() { return 0; }
36 virtual Skip_req* skip() { return 0; }
37 virtual Dynamic_req* dynamic() { return 0; }
38 virtual Absolute_dynamic_req * absdynamic() { return 0; }
39 virtual Tie_req * tie() { return 0; }
40 virtual Span_dynamic_req * span_dynamic() { return 0; }
41 virtual Abbreviation_req* abbrev() { return 0; }
42 REQUESTMETHODS(Musical_req, musical);
47 /** a request with a duration.
48 This request is used only a base class.
50 class Rhythmic_req : public virtual Musical_req {
51 public:
52 Duration duration_;
54 /* *************** */
55 void set_duration (Duration);
56 bool do_equal_b (Request*) const;
57 virtual Moment duration() const;
58 Rhythmic_req();
59 static int compare (Rhythmic_req const&,Rhythmic_req const&);
60 REQUESTMETHODS(Rhythmic_req, rhythmic);
63 class Skip_req : public Rhythmic_req {
64 public:
65 REQUESTMETHODS(Skip_req, skip);
68 struct Spacing_req :virtual Request {
69 Moment next;
70 Real distance;
71 Real strength;
72 /* *************** */
73 Spacing_req();
74 REQUESTMETHODS(Spacing_req, spacing);
77 struct Abbreviation_req : public Musical_req {
78 REQUESTMETHODS (Abbreviation_req, abbrev);
79 Abbreviation_req ();
80 int type_i_;
83 class Blank_req : public Spacing_req, Rhythmic_req {
84 public:
85 REQUESTMETHODS(Spacing_req, spacing);
89 /// Put a text above or below (?) this staff.
90 class Text_req : public virtual Musical_req {
91 public:
92 /// preferred position (above/below)
93 Direction dir_;
94 /// the characteristics of the text
95 Text_def *tdef_p_;
97 /* *************** */
98 Text_req (int d, Text_def*);
99 ~Text_req();
100 Text_req (Text_req const&);
102 REQUESTMETHODS(Text_req,text);
105 /** Put a text in lyric_staff
106 @see Lyric_staff
108 class Lyric_req : public Rhythmic_req, public Text_req {
109 public:
110 Lyric_req (Text_def* t_p);
111 REQUESTMETHODS(Lyric_req, lreq_l);
114 /// request which has some kind of pitch
115 struct Melodic_req :virtual Musical_req
117 /// 0 is c, 6 is b
118 int notename_i_;
119 /// 0 is central c
120 int octave_i_;
122 /// 0 natural, 1 sharp, etc
123 int accidental_i_;
125 /// return height from central c (in halflines)
126 int height() const;
128 /// transpose. #delta# is relative to central c.
129 void transpose (Melodic_req const &delta);
130 /// return pitch from central c (in halfnotes)
131 int pitch() const;
132 Melodic_req();
133 bool do_equal_b (Request*) const;
134 static int compare (Melodic_req const&,Melodic_req const&);
135 REQUESTMETHODS(Melodic_req,melodic);
138 /// Put a note of specified type, height, and with accidental on the staff.
139 class Note_req : public Rhythmic_req, virtual public Melodic_req {
140 public:
142 /// force/supress printing of accidental.
143 bool forceacc_b_;
144 Note_req();
145 bool do_equal_b (Request*) const;
146 Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic (); }
147 REQUESTMETHODS(Note_req, note);
151 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.
153 class Rest_req : public Rhythmic_req {
154 public:
155 REQUESTMETHODS(Rest_req,rest);
161 Requests to start or stop something.
162 This type of request typically results in the creation of a #Spanner#
164 class Span_req : public virtual Musical_req {
165 public:
166 /// should the spanner start or stop, or is it unwanted?
167 enum {
168 NOSPAN, START, STOP
169 } spantype ;
170 bool do_equal_b (Request*) const;
171 REQUESTMETHODS(Span_req,span);
173 Span_req();
177 /** Start / stop a beam at this note. if #nplet# is set, the staff
178 will try to put an appropriate number over the beam */
179 class Beam_req : public Span_req {
180 public:
181 int nplet;
183 /* *************** */
184 REQUESTMETHODS(Beam_req,beam);
186 Beam_req();
189 /**
190 Start / stop an abbreviation beam at this note.
192 class Abbreviation_beam_req : public Span_req {
193 public:
194 REQUESTMETHODS (Abbreviation_beam_req, abbrev_beam);
196 Abbreviation_beam_req ();
198 int type_i_;
202 Start a tie at this voice element, end it at the next
204 class Tie_req : public Musical_req {
205 public:
206 REQUESTMETHODS(Tie_req, tie);
209 /// a slur
210 class Slur_req : public Span_req {
211 public:
212 REQUESTMETHODS(Slur_req,slur);
216 class Musical_script_req : public Musical_req, public Script_req {
217 public:
218 REQUESTMETHODS(Musical_script_req, musicalscript);
222 class Dynamic_req : public virtual Musical_req {
223 public:
225 for absolute dynamics
227 This sux. We'd want increasing numbers for FFF till PPP, but not
228 for FP, SF, SFZ (FP is *not* louder than FFF)
230 enum Loudness {
231 FFF, FF, F, MF, MP, P, PP, PPP, FP, SF, SFZ
233 static String loudness_static_str (Loudness);
234 REQUESTMETHODS(Dynamic_req, dynamic);
237 class Absolute_dynamic_req : public Dynamic_req {
238 public:
239 Loudness loudness_;
240 String loudness_str () const;
241 Absolute_dynamic_req();
242 REQUESTMETHODS(Absolute_dynamic_req, absdynamic);
245 class Span_dynamic_req : public Dynamic_req, public Span_req {
246 public:
247 /// Grow or shrink the volume: 1=cresc, -1 = decresc
248 Direction dynamic_dir_;
249 Span_dynamic_req();
250 REQUESTMETHODS(Span_dynamic_req, span_dynamic);
253 #endif // MUSICALREQUESTS_HH