]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/musical-request.hh
release: 1.1.25
[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 /** a syllable  or lyric is a string with rhythm.
70   */
71 class Lyric_req  : public  Rhythmic_req  {
72 public:
73   String text_str_;
74   REQUESTMETHODS(Lyric_req);
75 };
76
77
78
79 /// request which has some kind of pitch
80 struct Melodic_req :virtual Musical_req
81 {
82   Musical_pitch pitch_;
83   /// transpose. #delta# is relative to central c.
84   virtual void transpose (Musical_pitch delta);
85   Melodic_req();
86   bool do_equal_b (Request*) const;
87   static int compare (Melodic_req const&,Melodic_req const&);
88   REQUESTMETHODS(Melodic_req);
89 };
90
91 /// Put a note of specified type, height, and with accidental on the staff.
92 class Note_req  : public Rhythmic_req, virtual public Melodic_req  {
93 public:
94     
95   /// force/supress printing of accidental.
96   bool forceacc_b_;
97   /// Cautionary, i.e. parenthesized accidental.
98   bool cautionary_b_;
99   Note_req();
100   bool do_equal_b (Request*) const;
101   REQUESTMETHODS(Note_req);
102 };
103
104 /**
105 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.
106 */
107 class Rest_req : public Rhythmic_req {
108 public:
109   REQUESTMETHODS(Rest_req);
110 };
111
112 /**
113  Part: typeset a measure with the number of measures rest
114  Score: typeset all individual measures ass full rests
115  */
116 class Multi_measure_rest_req : public Rhythmic_req  {
117 public:
118   REQUESTMETHODS(Multi_measure_rest_req);
119
120 };
121
122 class Musical_span_req : public Span_req, public virtual Musical_req
123 {
124 public:
125   REQUESTMETHODS(Musical_span_req);
126   
127 };
128
129
130 /** 
131  Start / stop an abbreviation beam at this note. 
132  */
133 class Abbreviation_beam_req : public Musical_span_req  {
134 public:
135   REQUESTMETHODS (Abbreviation_beam_req);
136
137   Abbreviation_beam_req ();
138
139   int type_i_;
140 };
141
142
143
144 /// a slur
145 class Slur_req  : public Musical_span_req  {
146 public:
147   REQUESTMETHODS(Slur_req);
148
149 };
150
151 /// an extender line
152 class Extender_req : public Musical_span_req  {
153 public:
154   REQUESTMETHODS(Extender_req);
155   Extender_req ();
156 };
157
158 class Musical_script_req : public Musical_req,  public Script_req {
159 public:
160   REQUESTMETHODS(Musical_script_req);
161 };
162
163
164 class Dynamic_req  : public virtual Musical_req  {
165 public:
166   /**
167     for absolute dynamics
168
169     This sux. We'd want increasing numbers for FFF till PPP, but not 
170     for FP, SF, SFZ (FP is *not* louder than FFF)
171    */
172   enum Loudness {
173     FFFFFF, FFFFF, FFFF, FFF, FF, F, MF, MP, P, PP, PPP, PPPP, PPPPP, PPPPPP, FP, SF, SFF, SFZ, SP, SPP, RFZ };
174   static String loudness_static_str (Loudness);
175   REQUESTMETHODS(Dynamic_req);
176 };
177
178 class Absolute_dynamic_req  : public Dynamic_req  {
179 public:
180   Loudness loudness_;
181   virtual bool do_equal_b (Request*) const;
182   String loudness_str () const;
183   Absolute_dynamic_req();
184   REQUESTMETHODS(Absolute_dynamic_req);
185 };
186
187 class Span_dynamic_req  : public Dynamic_req, public Musical_span_req  {
188 public:
189   virtual bool do_equal_b (Request*) const;
190   /// Grow or shrink the volume: 1=cresc, -1 = decresc 
191   Direction dynamic_dir_;
192   Span_dynamic_req();
193   REQUESTMETHODS(Span_dynamic_req);
194 };
195
196 #endif // MUSICALREQUESTS_HH