]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/musical-request.hh
release: 1.1.3
[lilypond.git] / lily / include / musical-request.hh
1 /*
2   musical-request.hh -- declare Musical requests
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9
10 #ifndef MUSICALREQUESTS_HH
11 #define MUSICALREQUESTS_HH
12
13 #include "lily-proto.hh"
14 #include "request.hh"
15 #include "duration.hh"
16 #include "musical-pitch.hh"
17
18 /**
19   A request which is coupled to a note (that has duration).
20   Base class only
21  */
22 class Musical_req  : public virtual Request  {
23 public:
24
25
26   REQUESTMETHODS(Musical_req);
27 };
28
29
30
31 /** a request with a duration.
32   This request is used only used as a base class.
33  */
34 class Rhythmic_req  : public virtual Musical_req  {
35 public:
36   Duration duration_;
37     
38   bool do_equal_b (Request*) const;
39   void compress (Moment);
40   virtual Moment duration() const;
41   static int compare (Rhythmic_req const&,Rhythmic_req const&);
42   REQUESTMETHODS(Rhythmic_req);
43 };
44
45 class Skip_req  : public Rhythmic_req  {
46 public:
47   REQUESTMETHODS(Skip_req);
48 };
49
50 struct Spacing_req :virtual Request {
51   Moment next;
52   Real distance;
53   Real strength;
54   Spacing_req();
55   REQUESTMETHODS(Spacing_req);
56 };
57
58 struct Abbreviation_req : public Musical_req {
59   REQUESTMETHODS (Abbreviation_req);
60   Abbreviation_req ();
61   int type_i_;
62 };
63
64 class Blank_req  : public Spacing_req, Rhythmic_req  {
65 public:
66   REQUESTMETHODS(Spacing_req);
67 };
68
69 /// Put a text above or below (?) this staff.
70 class Text_req  : public virtual Musical_req  {
71 public:
72   /// preferred position (above/below)
73   Direction dir_;
74   /// the characteristics of the text
75   Text_def *tdef_p_;
76
77   Text_req (int d, Text_def*);
78   ~Text_req();
79   Text_req (Text_req const&);
80
81   REQUESTMETHODS(Text_req);
82 };
83
84 /** a syllable  or lyric is a string with rhythm.
85   */
86 class Lyric_req  : public  Rhythmic_req  {
87 public:
88   String text_str_;
89   REQUESTMETHODS(Lyric_req);
90 };
91
92
93
94 /// request which has some kind of pitch
95 struct Melodic_req :virtual Musical_req
96 {
97   Musical_pitch pitch_;
98   /// transpose. #delta# is relative to central c.
99   virtual void transpose (Musical_pitch delta);
100   Melodic_req();
101   bool do_equal_b (Request*) const;
102   static int compare (Melodic_req const&,Melodic_req const&);
103   REQUESTMETHODS(Melodic_req);
104 };
105
106 /// Put a note of specified type, height, and with accidental on the staff.
107 class Note_req  : public Rhythmic_req, virtual public Melodic_req  {
108 public:
109     
110   /// force/supress printing of accidental.
111   bool forceacc_b_;
112   /// Cautionary, i.e. parenthesized accidental.
113   bool cautionary_b_;
114   Note_req();
115   bool do_equal_b (Request*) const;
116   REQUESTMETHODS(Note_req);
117 };
118
119 /**
120 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.
121 */
122 class Rest_req : public Rhythmic_req {
123 public:
124   REQUESTMETHODS(Rest_req);
125 };
126
127 /**
128  Part: typeset a measure with the number of measures rest
129  Score: typeset all individual measures ass full rests
130  */
131 class Multi_measure_rest_req : public Rhythmic_req  {
132 public:
133   REQUESTMETHODS(Multi_measure_rest_req);
134
135 };
136
137 class Musical_span_req : public Span_req, public virtual Musical_req
138 {
139 public:
140   REQUESTMETHODS(Musical_span_req);
141   
142 };
143
144 /** Start / stop a beam at this note */
145 class Beam_req  : public Musical_span_req  {
146 public:
147   REQUESTMETHODS(Beam_req);
148 };
149
150 /** 
151  Start / stop an abbreviation beam at this note. 
152  */
153 class Abbreviation_beam_req : public Musical_span_req  {
154 public:
155   REQUESTMETHODS (Abbreviation_beam_req);
156
157   Abbreviation_beam_req ();
158
159   int type_i_;
160 };
161
162 /**
163   Start a tie at this note, end it at the next
164  */
165 class Tie_req : public Musical_req {
166 public:
167   REQUESTMETHODS(Tie_req);
168 };
169
170 /// a slur
171 class Slur_req  : public Musical_span_req  {
172 public:
173   REQUESTMETHODS(Slur_req);
174
175 };
176
177 /// a plet (bracket with) number
178 class Plet_req : public Musical_span_req  {
179 public:
180   int plet_i_;
181
182   REQUESTMETHODS(Plet_req);
183   Plet_req ();
184 };
185
186 class Musical_script_req : public Musical_req,  public Script_req {
187 public:
188   REQUESTMETHODS(Musical_script_req);
189 };
190
191
192 class Dynamic_req  : public virtual Musical_req  {
193 public:
194   /**
195     for absolute dynamics
196
197     This sux. We'd want increasing numbers for FFF till PPP, but not 
198     for FP, SF, SFZ (FP is *not* louder than FFF)
199    */
200   enum Loudness {
201     FFF, FF, F, MF, MP, P, PP, PPP, FP, SF, SFZ
202   };
203   static String loudness_static_str (Loudness);
204   REQUESTMETHODS(Dynamic_req);
205 };
206
207 class Absolute_dynamic_req  : public Dynamic_req  {
208 public:
209   Loudness loudness_;
210   virtual bool do_equal_b (Request*) const;
211   String loudness_str () const;
212   Absolute_dynamic_req();
213   REQUESTMETHODS(Absolute_dynamic_req);
214 };
215
216 class Span_dynamic_req  : public Dynamic_req, public Musical_span_req  {
217 public:
218   virtual bool do_equal_b (Request*) const;
219   /// Grow or shrink the volume: 1=cresc, -1 = decresc 
220   Direction dynamic_dir_;
221   Span_dynamic_req();
222   REQUESTMETHODS(Span_dynamic_req);
223 };
224
225 #endif // MUSICALREQUESTS_HH