LibMusicXML 3.18
msrHarmonies_MUT_DEP.h
1/*
2 This file is to be included only by msrMutualDependencies.h,
3 to satisfy declarations mutual dependencies.
4*/
5
6//______________________________________________________________________________
7class msrHarmonyDegree : public msrElement
8{
9 public:
10
11 // data types
12 // ------------------------------------------------------
13
14/*
15Degree elements
16 can then add, subtract, or alter from these
17 starting points.
18
19 <harmony>
20 <root>
21 <root-step>B</root-step>
22 </root>
23 <kind>dominant</kind>
24 <degree>
25 <degree-value>5</degree-value>
26 <degree-alter>1</degree-alter>
27 <degree-type>alter</degree-type>
28 </degree>
29 <degree>
30 <degree-value>9</degree-value>
31 <degree-alter>1</degree-alter>
32 <degree-type>add</degree-type>
33 </degree>
34 </harmony>
35*/
36
37 enum msrHarmonyDegreeTypeKind {
38 kHarmonyDegreeTypeAdd,
39 kHarmonyDegreeTypeAlter,
40 kHarmonyDegreeTypeSubstract };
41
42 static string harmonyDegreeTypeKindAsString (
43 msrHarmonyDegreeTypeKind harmonyDegreeTypeKind);
44
45 // creation from MusicXML
46 // ------------------------------------------------------
47
48 static SMARTP<msrHarmonyDegree> create (
49 int inputLineNumber,
50 int harmonyDegreeValue,
51 msrAlterationKind harmonyDegreeAlterationKind,
52 msrHarmonyDegreeTypeKind harmonyDegreeTypeKind);
53
54 /* JMI
55 SMARTP<msrHarmonyDegree> createHarmonyDegreeNewbornClone (
56 S_msrPart containingPart);
57
58 SMARTP<msrHarmonyDegree> createHarmonyDegreeDeepCopy ( // JMI ???
59 S_msrPart containingPart);
60 */
61
62 protected:
63
64 // constructors/destructor
65 // ------------------------------------------------------
66
68 int inputLineNumber,
69 int harmonyDegreeValue,
70 msrAlterationKind harmonyDegreeAlterationKind,
71 msrHarmonyDegreeTypeKind harmonyDegreeTypeKind);
72
73 virtual ~msrHarmonyDegree ();
74
75 public:
76
77 // set and get
78 // ------------------------------------------------------
79
80 void setHarmonyDegreeHarmonyUpLink (
81 S_msrHarmony harmonyUpLink);
82
83 S_msrHarmony getHarmonyDegreeHarmonyUpLink () const
84 { return fHarmonyDegreeHarmonyUpLink; }
85
86 int getHarmonyDegreeValue () const
87 { return fHarmonyDegreeValue; }
88
89 msrAlterationKind getHarmonyDegreeAlterationKind () const
90 { return fHarmonyDegreeAlterationKind; }
91
92 msrHarmonyDegreeTypeKind
93 getHarmonyDegreeTypeKind () const
94 { return fHarmonyDegreeTypeKind; }
95
96 // services
97 // ------------------------------------------------------
98
99 int harmonyDegreeAsSemitones () const;
100
101 public:
102
103 // visitors
104 // ------------------------------------------------------
105
106 virtual void acceptIn (basevisitor* v);
107 virtual void acceptOut (basevisitor* v);
108
109 virtual void browseData (basevisitor* v);
110
111 public:
112
113 // print
114 // ------------------------------------------------------
115
116 string harmonyDegreeKindAsString () const;
117 string harmonyDegreeKindAsShortString () const;
118
119 string asString () const;
120
121 virtual void print (ostream& os) const;
122
123 private:
124
125 // fields
126 // ------------------------------------------------------
127
128 // upLinks
129 S_msrHarmony fHarmonyDegreeHarmonyUpLink;
130
131 int fHarmonyDegreeValue;
132 msrAlterationKind fHarmonyDegreeAlterationKind;
133 msrHarmonyDegreeTypeKind
134 fHarmonyDegreeTypeKind;
135};
136typedef SMARTP<msrHarmonyDegree> S_msrHarmonyDegree;
137EXP ostream& operator<< (ostream& os, const S_msrHarmonyDegree& elt);
138
139//______________________________________________________________________________
140class msrHarmony : public msrMeasureElement
141{
142 public:
143
144 // creation from MusicXML
145 // ------------------------------------------------------
146
147 static SMARTP<msrHarmony> createWithoutVoiceUplink (
148 int inputLineNumber,
149 // no harmonyVoiceUpLink yet
150 msrQuarterTonesPitchKind harmonyRootQuarterTonesPitchKind,
151 msrHarmonyKind harmonyKind,
152 string harmonyKindText,
153 int harmonyInversion,
154 msrQuarterTonesPitchKind harmonyBassQuarterTonesPitchKind,
155 rational harmonySoundingWholeNotes,
156 rational harmonyDisplayWholeNotes,
157 int harmonyStaffNumber,
158 msrTupletFactor harmonyTupletFactor,
159 rational harmonyWholeNotesOffset);
160
161 SMARTP<msrHarmony> createHarmonyNewbornClone (
162 S_msrVoice containingVoice);
163
164 SMARTP<msrHarmony> createHarmonyDeepCopy ( // JMI ???
165 S_msrVoice containingVoice);
166
167 // applications API
168 // ------------------------------------------------------
169
170 static SMARTP<msrHarmony> createWithVoiceUplink (
171 int inputLineNumber,
172 S_msrVoice harmonyVoiceUpLink,
173 msrQuarterTonesPitchKind harmonyRootQuarterTonesPitchKind,
174 msrHarmonyKind harmonyKind,
175 string harmonyKindText,
176 int harmonyInversion,
177 msrQuarterTonesPitchKind harmonyBassQuarterTonesPitchKind,
178 rational harmonySoundingWholeNotes,
179 rational harmonyDisplayWholeNotes,
180 int harmonyStaffNumber,
181 msrTupletFactor harmonyTupletFactor,
182 rational harmonyWholeNotesOffset);
183
184 protected:
185
186 // constructors/destructor
187 // ------------------------------------------------------
188
189 msrHarmony (
190 int inputLineNumber,
191 S_msrVoice harmonyVoiceUpLink,
192 msrQuarterTonesPitchKind harmonyRootQuarterTonesPitchKind,
193 msrHarmonyKind harmonyKind,
194 string harmonyKindText,
195 int harmonyInversion,
196 msrQuarterTonesPitchKind harmonyBassQuarterTonesPitchKind,
197 rational harmonySoundingWholeNotes,
198 rational harmonyDisplayWholeNotes,
199 int harmonyStaffNumber,
200 msrTupletFactor harmonyTupletFactor,
201 rational harmonyWholeNotesOffset);
202
203 virtual ~msrHarmony ();
204
205 public:
206
207 // set and get
208 // ------------------------------------------------------
209
210 // uplinks
211 void setHarmonyNoteUpLink (
212 S_msrNote note)
213 { fHarmonyNoteUpLink = note; }
214
215 S_msrNote getHarmonyNoteUpLink () const
216 { return fHarmonyNoteUpLink; }
217
218 void setHarmonyVoiceUpLink (
219 S_msrVoice voice)
220 { fHarmonyVoiceUpLink = voice; }
221
222 S_msrVoice getHarmonyVoiceUpLink () const
223 { return fHarmonyVoiceUpLink; }
224
225 void setHarmonySoundingWholeNotes (
226 rational wholeNotes)
227 { fMeasureElementSoundingWholeNotes = wholeNotes; }
228
229 rational getHarmonySoundingWholeNotes () const
230 { return fMeasureElementSoundingWholeNotes; }
231
232 void setHarmonyDisplayWholeNotes (
233 rational wholeNotes)
234 { fHarmonyDisplayWholeNotes = wholeNotes; }
235
236 rational getHarmonyDisplayWholeNotes () const
237 { return fHarmonyDisplayWholeNotes; }
238
239 msrQuarterTonesPitchKind
240 getHarmonyRootQuarterTonesPitchKind () const
241 { return fHarmonyRootQuarterTonesPitchKind; }
242
243 msrHarmonyKind getHarmonyKind () const
244 { return fHarmonyKind; }
245
246 string getHarmonyKindText () const
247 { return fHarmonyKindText; }
248
249 const list<S_msrHarmonyDegree>&
250 getHarmonyDegreesList ()
251 { return fHarmonyDegreesList; }
252
253 int getHarmonyInversion () const
254 { return fHarmonyInversion; }
255
256 msrQuarterTonesPitchKind
257 getHarmonyBassQuarterTonesPitchKind () const
258 { return fHarmonyBassQuarterTonesPitchKind; }
259
260 void setHarmonyStaffNumber (
261 int staffNumber)
262 { fHarmonyStaffNumber = staffNumber; }
263
264 int getHarmonyStaffNumber () const
265 { return fHarmonyStaffNumber; }
266
267 void setHarmonyTupletFactor (
268 msrTupletFactor tupletFactor);
269
270 msrTupletFactor getHarmonyTupletFactor () const
271 { return fHarmonyTupletFactor; }
272
273 rational getHarmonyWholeNotesOffset () const
274 { return fHarmonyWholeNotesOffset; }
275
276 void setHarmonyPositionInMeasure (
277 rational positionInMeasure);
278
279 // services
280 // ------------------------------------------------------
281
282 void appendHarmonyDegreeToHarmony (
283 S_msrHarmonyDegree harmonyDegree)
284 {
285 fHarmonyDegreesList.push_back (
286 harmonyDegree);
287 }
288
289 public:
290
291 // visitors
292 // ------------------------------------------------------
293
294 virtual void acceptIn (basevisitor* v);
295 virtual void acceptOut (basevisitor* v);
296
297 virtual void browseData (basevisitor* v);
298
299 public:
300
301 // print
302 // ------------------------------------------------------
303
304 string asString () const;
305
306 virtual void print (ostream& os) const;
307
308 private:
309
310 // fields
311 // ------------------------------------------------------
312
313 // upLinks
314 S_msrNote fHarmonyNoteUpLink;
315 S_msrVoice fHarmonyVoiceUpLink;
316
317 rational fHarmonyDisplayWholeNotes;
318
319 msrQuarterTonesPitchKind
320 fHarmonyRootQuarterTonesPitchKind;
321
322 msrHarmonyKind fHarmonyKind;
323 string fHarmonyKindText;
324
325 int fHarmonyInversion;
326
327 msrQuarterTonesPitchKind
328 fHarmonyBassQuarterTonesPitchKind;
329
330 list<S_msrHarmonyDegree>
331 fHarmonyDegreesList;
332
333 int fHarmonyStaffNumber;
334
335 msrTupletFactor fHarmonyTupletFactor;
336
337 rational fHarmonyWholeNotesOffset;
338};
339typedef SMARTP<msrHarmony> S_msrHarmony;
340EXP ostream& operator<< (ostream& os, const S_msrHarmony& elt);
341
Definition: msrHarmonies_MUT_DEP.h:8
Definition: msrHarmonies_MUT_DEP.h:141
Rational number representation.
Definition: rational.h:25