LibMusicXML 3.18
msrStaves_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 msrVoiceStaffChange : public msrMeasureElement
8{
9 public:
10
11 // creation from MusicXML
12 // ------------------------------------------------------
13
14 static SMARTP<msrVoiceStaffChange> create (
15 int inputLineNumber,
16 S_msrStaff staffToChangeTo);
17
18 SMARTP<msrVoiceStaffChange> createStaffChangeNewbornClone ();
19
20 protected:
21
22 // constructors/destructor
23 // ------------------------------------------------------
24
26 int inputLineNumber,
27 S_msrStaff staffToChangeTo);
28
29 virtual ~msrVoiceStaffChange ();
30
31 public:
32
33 // set and get
34 // ------------------------------------------------------
35
36 S_msrStaff getStaffToChangeTo () const
37 { return fStaffToChangeTo; }
38
39 // services
40 // ------------------------------------------------------
41
42 public:
43
44 // visitors
45 // ------------------------------------------------------
46
47 virtual void acceptIn (basevisitor* v);
48 virtual void acceptOut (basevisitor* v);
49
50 virtual void browseData (basevisitor* v);
51
52 public:
53
54 // print
55 // ------------------------------------------------------
56
57 string asString () const;
58
59 virtual void print (ostream& os) const;
60
61 private:
62
63 // fields
64 // ------------------------------------------------------
65
66 S_msrStaff fStaffToChangeTo;
67};
68typedef SMARTP<msrVoiceStaffChange> S_msrVoiceStaffChange;
69EXP ostream& operator<< (ostream& os, const S_msrVoiceStaffChange& elt);
70
71//______________________________________________________________________________
72class msrStaff : public msrElement
73{
74 public:
75
76 // constants
77 // ------------------------------------------------------
78
79 #define K_NO_STAFF_NUMBER -777
80
81 // data types
82 // ------------------------------------------------------
83
84 enum msrStaffKind {
85 kStaffRegular,
86 kStaffTablature,
87 kStaffHarmony,
88 kStaffFiguredBass,
89 kStaffDrum,
90 kStaffRythmic };
91
92 static string staffKindAsString (
93 msrStaffKind staffKind);
94
95 // creation from MusicXML
96 // ------------------------------------------------------
97
98 static SMARTP<msrStaff> create (
99 int inputLineNumber,
100 msrStaffKind staffKind,
101 int staffNumber,
102 S_msrPart staffPartUpLink);
103
104 SMARTP<msrStaff> createStaffNewbornClone (
105 S_msrPart containingPart);
106
107 protected:
108
109 // constructors/destructor
110 // ------------------------------------------------------
111
112 msrStaff (
113 int inputLineNumber,
114 msrStaffKind staffKind,
115 int staffNumber,
116 S_msrPart staffPartUpLink);
117
118 virtual ~msrStaff ();
119
120 private:
121
122 // initialization
123 // ------------------------------------------------------
124
125 void initializeStaff ();
126
127 public:
128
129 // set and get
130 // ------------------------------------------------------
131
132 // upLinks
133
134 S_msrPart getStaffPartUpLink () const
135 { return fStaffPartUpLink; }
136
137 // staff kind
138
139 msrStaffKind getStaffKind () const
140 { return fStaffKind; }
141
142 // staff number and name
143
144 int getStaffNumber () const
145 { return fStaffNumber; }
146
147 string getStaffName () const
148 { return fStaffName; }
149
150 string getStaffInstrumentName () const
151 { return fStaffInstrumentName; }
152
153 string getStaffInstrumentAbbreviation () const
154 { return fStaffInstrumentAbbreviation; }
155
156 // voices
157
158 int getStaffRegularVoicesCounter () const
159 { return fStaffRegularVoicesCounter; }
160
161 // staff details
162
163 S_msrStaffDetails getCurrentStaffStaffDetails () const
164 { return fCurrentStaffStaffDetails; }
165
166 // staff voices
167
168 const map<int, S_msrVoice>&
169 getStaffAllVoicesMap () const
170 { return fStaffAllVoicesMap; }
171
172 const map<int, S_msrVoice>&
173 getStaffRegularVoicesMap () const
174 {
175 return
176 fStaffRegularVoicesMap;
177 }
178
179 const list<S_msrVoice>&
180 getStaffAllVoicesVector () const
181 {
182 return
183 fStaffAllVoicesList;
184 }
185
186 // services
187 // ------------------------------------------------------
188
189 // staff details
190
191 void appendStaffDetailsToStaff (
192 S_msrStaffDetails staffDetails);
193
194 // clef, key, time
195
196 void appendClefToStaff (S_msrClef clef);
197
198 void appendKeyToStaff (S_msrKey key);
199
200 void appendTimeToStaff (S_msrTime time);
201 void appendTimeToStaffClone (S_msrTime time);
202
203 // transpose
204
205 void appendTransposeToStaff (
206 S_msrTranspose transpose);
207
208 // part name display
209
210 void appendPartNameDisplayToStaff (
211 S_msrPartNameDisplay partNameDisplay);
212
213 // part abbreviation display
214
215 void appendPartAbbreviationDisplayToStaff (
216 S_msrPartAbbreviationDisplay partAbbreviationDisplay);
217
218 // voices
219
220 S_msrVoice createVoiceInStaffByItsNumber (
221 int inputLineNumber,
222 msrVoice::msrVoiceKind voiceKind,
223 int voiceNumber,
224 string currentMeasureNumber);
225
226 void registerVoiceInStaff (
227 int inputLineNumber,
228 S_msrVoice voice);
229
230 void registerVoiceByItsNumber (
231 int inputLineNumber,
232 int voiceNumber,
233 S_msrVoice voice);
234
235 void registerVoiceInRegularVoicesMapByItsNumberByItsNumber (
236 int voiceNumber,
237 S_msrVoice voice);
238
239 void registerVoiceInAllVoicesList (
240 int voiceNumber,
241 S_msrVoice voice);
242
243 S_msrVoice fetchVoiceFromStaffByItsNumber (
244 int inputLineNumber,
245 int voiceNumber);
246
247 S_msrVoice fetchFirstRegularVoiceFromStaff (
248 int inputLineNumber);
249
250 void assignSequentialNumbersToRegularVoicesInStaff (
251 int inputLineNumber);
252
253 void addAVoiceToStaffIfItHasNone (
254 int inputLineNumber);
255
256 // measures
257
258 void createMeasureAndAppendItToStaff (
259 int inputLineNumber,
260 string measureNumber,
261 msrMeasure::msrMeasureImplicitKind
262 measureImplicitKind);
263
264 void setNextMeasureNumberInStaff (
265 int inputLineNumber,
266 string nextMeasureNumber);
267
268 // repeats
269
270 void handleRepeatStartInStaff (
271 int inputLineNumber);
272
273 void handleRepeatEndInStaff (
274 int inputLineNumber,
275 string measureNumber,
276 int repeatTimes);
277
278 void handleRepeatEndingStartInStaff (
279 int inputLineNumber);
280
281 void handleRepeatEndingEndInStaff (
282 int inputLineNumber,
283 string repeatEndingNumber, // may be "1, 2"
284 msrRepeatEnding::msrRepeatEndingKind
285 repeatEndingKind);
286
287/* JMI
288 void finalizeRepeatEndInStaff (
289 int inputLineNumber,
290 string measureNumber,
291 int repeatTimes);
292 */
293
294 void createMeasuresRepeatFromItsFirstMeasuresInStaff (
295 int inputLineNumber,
296 int measuresRepeatMeasuresNumber,
297 int measuresRepeatSlashesNumber);
298
299 void appendPendingMeasuresRepeatToStaff (
300 int inputLineNumber);
301
302 void createRestMeasuresInStaff (
303 int inputLineNumber,
304 int restMeasuresNumber);
305
306 void appendPendingRestMeasuresToStaff (
307 int inputLineNumber);
308
309 void appendRestMeasuresCloneToStaff (
310 int inputLineNumber,
311 S_msrRestMeasures restMeasures);
312
313 void createBeatsRepeatFromItsFirstMeasuresInStaff (
314 int inputLineNumber,
315 int beatsRepeatMeasuresNumber,
316 int beatsRepeatSlashesNumber);
317
318 void appendRepeatCloneToStaff (
319 int inputLineNumber,
320 S_msrRepeat repeatCLone);
321
322 void appendRepeatEndingCloneToStaff (
323 S_msrRepeatEnding repeatEndingClone);
324
325 // barlines
326
327 void appendBarlineToStaff (S_msrBarline barline);
328
329 // transpose
330
331 void appendTransposeToAllStaffVoices ( // JMI
332 S_msrTranspose transpose);
333
334 // part name display
335
336 void appendPartNameDisplayToAllStaffVoices ( // JMI
337 S_msrPartNameDisplay partNameDisplay);
338
339 // part abbreviation display
340
341 void appendPartAbbreviationDisplayToAllStaffVoices ( // JMI
342 S_msrPartAbbreviationDisplay partAbbreviationDisplay);
343
344 // scordaturas
345
346 void appendScordaturaToStaff (
347 S_msrScordatura scordatura);
348
349 // accordion registration
350
351 void appendAccordionRegistrationToStaff (
352 S_msrAccordionRegistration
353 accordionRegistration);
354
355 // harp pedals tuning
356
357 void appendHarpPedalsTuningToStaff (
358 S_msrHarpPedalsTuning
359 harpPedalsTuning);
360
361 // strings
362
363 public:
364
365 // visitors
366 // ------------------------------------------------------
367
368 virtual void acceptIn (basevisitor* v);
369 virtual void acceptOut (basevisitor* v);
370
371 virtual void browseData (basevisitor* v);
372
373 public:
374
375 // print
376 // ------------------------------------------------------
377
378 // staff number
379
380 string staffNumberAsString ();
381
382 string staffKindAsString () const;
383
384 virtual void print (ostream& os) const;
385
386 virtual void printSummary (ostream& os);
387
388 private:
389
390 // fields
391 // ------------------------------------------------------
392
393 // upLinks
394
395 S_msrPart fStaffPartUpLink;
396
397 // staff name
398
399 string fStaffName;
400
401 // staff kind
402
403 msrStaffKind fStaffKind;
404
405 // staff number
406
407 int fStaffNumber;
408
409 // staff instrument name
410
411 string fStaffInstrumentName;
412 string fStaffInstrumentAbbreviation;
413
414 // staff voices
415
416 static int gStaffMaxRegularVoices;
417
418 // the dictionary of all the voices in the staff
419 map<int, S_msrVoice> fStaffAllVoicesMap;
420
421 // we need to handle the regular voice specifically
422 // to assign them sequencing numbers from 1 to gMaxStaffVoices,
423 // needed to set the beams orientation (up or down)
424 int fStaffRegularVoicesCounter;
425 map<int, S_msrVoice> fStaffRegularVoicesMap;
426
427 // harmonies and figured basses should be placed
428 // in the first regular voice of the staff, hence:
429 list<S_msrVoice> fStaffRegularVoicesList;
430
431 // we need to sort the voices by increasing voice numbers,
432 // but with harmony voices right before the corresponding regular voices
433 list<S_msrVoice> fStaffAllVoicesList;
434
435 // staff details
436
437 S_msrStaffDetails fCurrentStaffStaffDetails;
438
439 // rest measures
440
441 bool fStaffContainsRestMeasures;
442
443 public:
444
445 // public work services
446 // ------------------------------------------------------
447
448 // clef, key, time
449
450 void setStaffCurrentClef (S_msrClef clef);
451
452 S_msrClef getStaffCurrentClef () const
453 { return fStaffCurrentClef; }
454
455 void setStaffCurrentKey (S_msrKey key);
456
457 S_msrKey getStaffCurrentKey () const
458 { return fStaffCurrentKey; }
459
460 void setStaffCurrentTime (S_msrTime time);
461
462 S_msrTime getStaffCurrentTime () const
463 { return fStaffCurrentTime; }
464
465 // finalization
466
467 void finalizeCurrentMeasureInStaff (
468 int inputLineNumber);
469
470 void finalizeStaff (
471 int inputLineNumber);
472
473 private:
474
475 // private work services
476 // ------------------------------------------------------
477
478 // transpose
479
480 S_msrTranspose getStaffCurrentTranspose () const
481 { return fStaffCurrentTranspose; }
482
483 // voices ordering in staves
484
485 static bool compareVoicesByIncreasingNumber (
486 const S_msrVoice& first,
487 const S_msrVoice& second);
488
489 static bool compareVoicesToHaveHarmoniesAboveCorrespondingVoice (
490 const S_msrVoice& first,
491 const S_msrVoice& second);
492
493 static bool compareVoicesToHaveFiguredBassesBelowCorrespondingVoice (
494 const S_msrVoice& first,
495 const S_msrVoice& second);
496
497 private:
498
499 // work fields
500 // ------------------------------------------------------
501
502 // clef, key, time
503
504 S_msrClef fStaffCurrentClef;
505
506 S_msrKey fStaffCurrentKey;
507
508 S_msrTime fStaffCurrentTime;
509
510 // transpose
511
512 S_msrTranspose fStaffCurrentTranspose;
513};
514typedef SMARTP<msrStaff> S_msrStaff;
515EXP ostream& operator<< (ostream& os, const S_msrStaff& elt);
Definition: msrStaves_MUT_DEP.h:73
Definition: msrStaves_MUT_DEP.h:8