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 #Request_chord#
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 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
{
55 void set_duration (Duration
);
56 bool do_equal_b (Request
*) const;
57 virtual Moment
duration() const;
59 static int compare (Rhythmic_req
const&,Rhythmic_req
const&);
60 REQUESTMETHODS(Rhythmic_req
, rhythmic
);
63 class Skip_req
: public Rhythmic_req
{
65 REQUESTMETHODS(Skip_req
, skip
);
68 struct Spacing_req
:virtual Request
{
74 REQUESTMETHODS(Spacing_req
, spacing
);
77 struct Abbreviation_req
: public Musical_req
{
78 REQUESTMETHODS (Abbreviation_req
, abbrev
);
83 class Blank_req
: public Spacing_req
, Rhythmic_req
{
85 REQUESTMETHODS(Spacing_req
, spacing
);
89 /// Put a text above or below (?) this staff.
90 class Text_req
: public virtual Musical_req
{
92 /// preferred position (above/below)
94 /// the characteristics of the text
98 Text_req (int d
, Text_def
*);
100 Text_req (Text_req
const&);
102 REQUESTMETHODS(Text_req
,text
);
105 /** Put a text in lyric_staff
108 class Lyric_req
: public Rhythmic_req
, public Text_req
{
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
122 /// 0 natural, 1 sharp, etc
125 /// return height from central c (in halflines)
128 /// transpose. #delta# is relative to central c.
129 void transpose (Melodic_req
const &delta
);
130 /// return pitch from central c (in halfnotes)
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
{
142 /// force/supress printing of accidental.
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
{
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
{
166 /// should the spanner start or stop, or is it unwanted?
170 bool do_equal_b (Request
*) const;
171 REQUESTMETHODS(Span_req
,span
);
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
{
183 /* *************** */
184 REQUESTMETHODS(Beam_req
,beam
);
190 Start / stop an abbreviation beam at this note.
192 class Abbreviation_beam_req
: public Span_req
{
194 REQUESTMETHODS (Abbreviation_beam_req
, abbrev_beam
);
196 Abbreviation_beam_req ();
202 Start a tie at this voice element, end it at the next
204 class Tie_req
: public Musical_req
{
206 REQUESTMETHODS(Tie_req
, tie
);
210 class Slur_req
: public Span_req
{
212 REQUESTMETHODS(Slur_req
,slur
);
216 class Musical_script_req
: public Musical_req
, public Script_req
{
218 REQUESTMETHODS(Musical_script_req
, musicalscript
);
222 class Dynamic_req
: public virtual Musical_req
{
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)
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
{
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
{
247 /// Grow or shrink the volume: 1=cresc, -1 = decresc
248 Direction dynamic_dir_
;
250 REQUESTMETHODS(Span_dynamic_req
, span_dynamic
);
253 #endif // MUSICALREQUESTS_HH