LibMusicXML 3.18
msrVoices_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 msrVoice : public msrElement
8{
9 public:
10
11 // constants
12 // ------------------------------------------------------
13
14 #define K_NO_VOICE_NUMBER -99
15 #define K_VOICE_HARMONY_VOICE_BASE_NUMBER 20
16 #define K_VOICE_FIGURED_BASS_VOICE_BASE_NUMBER 40
17
18 // data types
19 // ------------------------------------------------------
20
21 enum msrVoiceKind {
22 kVoiceRegular,
23 kVoiceHarmony, // for MusicXML <harmony/>, LilyPond ChordNames
24 kVoiceFiguredBass }; // for MusicXML <figured-bass/>, LilyPond FiguredBass
25
26 static string voiceKindAsString (
27 msrVoiceKind voiceKind);
28
29 enum msrVoiceRepeatPhaseKind {
30 kVoiceRepeatPhaseNone,
31 kVoiceRepeatPhaseAfterCommonPart,
32 kVoiceRepeatPhaseAfterHookedEnding,
33 kVoiceRepeatPhaseAfterHooklessEnding };
34
35 static string voiceRepeatPhaseKindAsString (
36 msrVoiceRepeatPhaseKind
37 afterRepeatComponentPhaseKind);
38
39 enum msrVoiceFinalizationStatusKind { // JMI ???
40 kKeepVoice,
41 kEraseVoice };
42
43 static string voiceFinalizationStatusKindAsString (
44 msrVoiceFinalizationStatusKind voiceFinalizationStatusKind);
45
46 enum msrVoiceCreateInitialLastSegmentKind {
47 kCreateInitialLastSegmentYes, kCreateInitialLastSegmentNo };
48
49 // creation from MusicXML
50 // ------------------------------------------------------
51
52 static SMARTP<msrVoice> create (
53 int inputLineNumber,
54 msrVoiceKind voiceKind,
55 int voiceNumber,
56 msrVoiceCreateInitialLastSegmentKind
57 voiceCreateInitialLastSegmentKind,
58 S_msrStaff voiceStaffUpLink);
59
60 SMARTP<msrVoice> createVoiceNewbornClone (
61 S_msrStaff containingStaff);
62
63 SMARTP<msrVoice> createVoiceDeepCopy (
64 int inputLineNumber,
65 msrVoiceKind voiceKind,
66 int voiceNumber,
67 S_msrStaff containingStaff);
68
69 protected:
70
71 // constructors/destructor
72 // ------------------------------------------------------
73
74 // for regular voices
75 msrVoice (
76 int inputLineNumber,
77 msrVoiceKind voiceKind,
78 int voiceNumber,
79 msrVoiceCreateInitialLastSegmentKind
80 voiceCreateInitialLastSegmentKind,
81 S_msrStaff voiceStaffUpLink);
82
83 // destructor
84 virtual ~msrVoice ();
85
86 private:
87
88 // initialisation
89 // ------------------------------------------------------
90
91 void initializeVoice (
92 msrVoiceCreateInitialLastSegmentKind
93 voiceCreateInitialLastSegmentKind);
94
95 public:
96
97 // set and get
98 // ------------------------------------------------------
99
100 // upLinks
101
102 S_msrStaff getVoiceStaffUpLink () const
103 { return fVoiceStaffUpLink; }
104
105 // voice kind
106
107 void setVoiceKind (msrVoiceKind voiceKind)
108 { fVoiceKind = voiceKind; }
109
110 msrVoiceKind getVoiceKind () const
111 { return fVoiceKind; }
112
113 // voice numbers
114
115 void setVoiceNumber (int voiceNumber)
116 { fVoiceNumber = voiceNumber; }
117
118 int getVoiceNumber () const
119 { return fVoiceNumber; }
120
121 void setRegularVoiceStaffSequentialNumber (
122 int regularVoiceStaffSequentialNumber);
123
124 int getRegularVoiceStaffSequentialNumber () const
125 { return fRegularVoiceStaffSequentialNumber; }
126
127 // voice name
128
129 void setVoiceNameFromNumber (
130 int inputLineNumber,
131 int voiceNumber);
132
133 string getVoiceName () const
134 { return fVoiceName; }
135
136 // harmonies
137
138 S_msrVoice getHarmonyVoiceForRegularVoiceForwardLink () const
139 { return fHarmonyVoiceForRegularVoiceForwardLink; }
140
141 S_msrVoice getRegularVoiceForHarmonyVoiceBackwardLink () const
142 { return fRegularVoiceForHarmonyVoiceBackwardLink; }
143
144 // figured bass
145
146 S_msrVoice getFiguredBassVoiceForRegularVoiceForwardLink () const
147 { return fFiguredBassVoiceForRegularVoiceForwardLink; }
148
149 S_msrVoice getRegularVoiceForFiguredBassVoiceBackwardLink () const
150 { return fRegularVoiceForFiguredBassVoiceBackwardLink; }
151
152 // stanzas
153
154 const map<string, S_msrStanza>&
155 getVoiceStanzasMap () const
156 { return fVoiceStanzasMap; }
157
158 // voice last segment
159
160 void setVoiceLastSegmentInVoiceClone (
161 S_msrSegment segment);
162
163 void appendSegmentToVoiceClone (
164 S_msrSegment segment);
165
166 S_msrSegment getVoiceLastSegment () const
167 { return fVoiceLastSegment; }
168
169 // voice last appended note
170
171 S_msrNote getVoiceLastAppendedNote () const
172 { return fVoiceLastAppendedNote; }
173
174 // voice shortest note
175
176 rational getVoiceShortestNoteDuration () const
177 { return fVoiceShortestNoteDuration; }
178
179 rational getVoiceShortestNoteTupletFactor () const
180 { return fVoiceShortestNoteTupletFactor; }
181
182 // counters
183
184 int getVoiceActualNotesCounter () const
185 { return fVoiceActualNotesCounter; }
186
187 int getVoiceRestsCounter () const
188 { return fVoiceRestsCounter; }
189
190 int getVoiceSkipsCounter () const
191 { return fVoiceSkipsCounter; }
192
193 int getVoiceActualHarmoniesCounter () const
194 { return fVoiceActualHarmoniesCounter; }
195
196 int getVoiceActualFiguredBassesCounter () const
197 { return fVoiceActualFiguredBassesCounter; }
198
199 // has music been inserted in the voice?
200
201 void setMusicHasBeenInsertedInVoice ()
202 { fMusicHasBeenInsertedInVoice = true; }
203
204 bool getMusicHasBeenInsertedInVoice () const
205 { return fMusicHasBeenInsertedInVoice; }
206
207 // regular measure ends detection
208
209 void setWholeNotesSinceLastRegularMeasureEnd (
210 int inputLineNumber,
211 rational value);
212
213 rational getWholeNotesSinceLastRegularMeasureEnd () const
214 { return fWholeNotesSinceLastRegularMeasureEnd; }
215
216 // incomplete measures after repeats detection
217
218 void setCurrentVoiceRepeatPhaseKind (
219 int inputLineNumber,
220 msrVoiceRepeatPhaseKind
221 afterRepeatComponentPhaseKind);
222
223 msrVoiceRepeatPhaseKind
224 getCurrentVoiceRepeatPhaseKind () const
225 { return fCurrentVoiceRepeatPhaseKind; }
226
227
228 // rests measures
229
230 void setVoiceContainsRestMeasures (
231 int inputLineNumber);
232
233 bool getVoiceContainsRestMeasures () const
234 { return fVoiceContainsRestMeasures; }
235
236 // measures repeats
237
238 void setVoiceContainsMeasuresRepeats (
239 int inputLineNumber);
240
241 bool getVoiceContainsMeasuresRepeats () const
242 { return fVoiceContainsMeasuresRepeats; }
243
244 // measures flat list
245 const list<S_msrMeasure>&
246 getVoiceMeasuresFlatList () const
247 { return fVoiceMeasuresFlatList; }
248
249 public:
250
251 // public services
252 // ------------------------------------------------------
253
254 // upLinks
255
256 S_msrPart fetchVoicePartUpLink () const;
257
258 // identity
259
260 void changeVoiceIdentity ( // after a deep copy
261 int voiceNumber);
262
263 // measures
264
265 S_msrMeasure createMeasureAndAppendItToVoice (
266 int inputLineNumber,
267 string measureNumber,
268 msrMeasure::msrMeasureImplicitKind
269 measureImplicitKind);
270
271 void setNextMeasureNumberInVoice (
272 int inputLineNumber,
273 string nextMeasureNumber);
274
275 // forward
276
277 void appendPaddingNoteToVoice (
278 int inputLineNumber,
279 rational forwardStepLength);
280
281 // backup and padding
282
283 void padUpToPositionInMeasureInVoice (
284 int inputLineNumber,
285 rational wholeNotesPositionInMeasure);
286
287 void backupByWholeNotesStepLengthInVoice (
288 int inputLineNumber,
289 rational backupTargetMeasureElementPositionInMeasure);
290
291 // clef, key, time
292
293 void appendClefToVoice (S_msrClef clef);
294
295 void appendKeyToVoice (S_msrKey key);
296
297 void appendTimeToVoice (S_msrTime time);
298 void appendTimeToVoiceClone (S_msrTime time);
299
300 // notes
301
302 S_msrNote fetchVoiceFirstNonGraceNote () const;
303
304 void registerShortestNoteIfRelevant (S_msrNote note);
305
306 void registerNoteAsVoiceLastAppendedNote (S_msrNote note);
307
308 // harmonies
309
310 S_msrVoice createHarmonyVoiceForRegularVoice (
311 int inputLineNumber,
312 string currentMeasureNumber);
313
314 // figured bass
315
316 S_msrVoice createFiguredBassVoiceForRegularVoice (
317 int inputLineNumber,
318 string currentMeasureNumber);
319
320 // transpose
321
322 void appendTransposeToVoice (
323 S_msrTranspose transpose);
324
325 // part name display
326
327 void appendPartNameDisplayToVoice (
328 S_msrPartNameDisplay partNameDisplay);
329
330 // part abbreviation display
331
332 void appendPartAbbreviationDisplayToVoice (
333 S_msrPartAbbreviationDisplay partAbbreviationDisplay);
334
335 // staff details
336
337 void appendStaffDetailsToVoice (
338 S_msrStaffDetails staffDetails);
339
340 // tempo
341
342 void appendTempoToVoice (S_msrTempo tempo);
343
344 // rehearsals
345
346 void appendRehearsalToVoice (
347 S_msrRehearsal rehearsal);
348
349 // octave shifts
350
351 void appendOctaveShiftToVoice (
352 S_msrOctaveShift octaveShift);
353
354 // scordaturas
355
356 void appendScordaturaToVoice (
357 S_msrScordatura scordatura);
358
359 // accordion registration
360
361 void appendAccordionRegistrationToVoice (
362 S_msrAccordionRegistration
363 accordionRegistration);
364
365 // harp pedals tuning
366
367 void appendHarpPedalsTuningToVoice (
368 S_msrHarpPedalsTuning
369 harpPedalsTuning);
370
371 // staff change
372
373 void appendVoiceStaffChangeToVoice (
374 S_msrVoiceStaffChange voiceStaffChange);
375
376 // notes
377
378 void appendNoteToVoice (S_msrNote note);
379 void appendNoteToVoiceClone (S_msrNote note);
380
381 // tremolos
382
383 void appendDoubleTremoloToVoice (
384 S_msrDoubleTremolo doubleTremolo);
385
386 // chords
387
388 void appendChordToVoice (S_msrChord chord);
389
390 // tuplets
391
392 void appendTupletToVoice (S_msrTuplet tuplet);
393
394 // harmonies
395
396 void appendHarmonyToVoice (
397 S_msrHarmony harmony);
398
399 void appendHarmonyToVoiceClone (
400 S_msrHarmony harmony);
401
402 // figured bass
403
404 void appendFiguredBassToVoice (
405 S_msrFiguredBass figuredBass);
406
407 void appendFiguredBassToVoiceClone (
408 S_msrFiguredBass figuredBass);
409
410 // frames
411
412 void appendFrameToVoice (
413 S_msrFrame frame);
414
415 void appendFrameToVoiceClone (
416 S_msrFrame frame);
417
418 // grace notes
419
420 void addGraceNotesGroupBeforeAheadOfVoiceIfNeeded (
421 S_msrGraceNotesGroup graceNotesGroup);
422
423 /*
424 void appendGraceNotesToVoice (
425 S_msrGraceNotes graceNotes);
426
427 void appendAfterGraceNotesToVoice (
428 S_msrAfterGraceNotes afterGraceNotes);
429
430 void prependAfterGraceNotesToVoice (
431 S_msrAfterGraceNotes afterGraceNotes);
432 */
433
434 // lyrics
435
436 void appendSyllableToVoice ( // JMI
437 int inputLineNumber,
438 string stanzaNumber,
439 string stanzaName,
440 S_msrSyllable syllable);
441
442 // bar checks
443
444 void appendBarCheckToVoice (
445 S_msrBarCheck barCheck);
446
447 // bar number checks
448
449 void appendBarNumberCheckToVoice (
450 S_msrBarNumberCheck barNumberCheck);
451
452 // breaks
453
454 void appendLineBreakToVoice (S_msrLineBreak lineBreak);
455 void appendPageBreakToVoice (S_msrPageBreak pageBreak);
456
457 // bar lines
458
459 void prependBarlineToVoice (S_msrBarline barline);
460 void appendBarlineToVoice (S_msrBarline barline);
461
462 // segno
463
464 void appendSegnoToVoice (S_msrSegno segno);
465
466 // coda
467
468 void appendCodaToVoice (S_msrCoda coda);
469
470 // eyeglasses
471
472 void appendEyeGlassesToVoice (
473 S_msrEyeGlasses eyeGlasses);
474
475 // pedal
476
477 void appendPedalToVoice (S_msrPedal pedal);
478
479 // damp
480
481 void appendDampToVoice (S_msrDamp damp);
482
483 // damp all
484
485 void appendDampAllToVoice (S_msrDampAll dampAll);
486
487 // other elements
488
489 void prependOtherElementToVoice (
490 S_msrMeasureElement elem);
491 void appendOtherElementToVoice (
492 S_msrMeasureElement elem);
493 // for other types of elements not known
494 // in this header file, such as LPSR elements
495
496 // last measure in voice
497
498 S_msrMeasure fetchVoiceLastMeasure (
499 int inputLineNumber) const;
500
501 // last element in voice
502
503 S_msrMeasureElement fetchVoiceLastElement ( // JMI ???
504 int inputLineNumber) const;
505
506 // removing elements from voice
507
508 void removeNoteFromVoice (
509 int inputLineNumber,
510 S_msrNote note);
511
512 void removeElementFromVoice (
513 int inputLineNumber,
514 S_msrElement element);
515
516 S_msrMeasure removeLastMeasureFromVoice (
517 int inputLineNumber);
518
519 // segments
520
521 void createNewLastSegmentForVoice (
522 int inputLineNumber,
523 string context);
524
525 void createNewLastSegmentFromItsFirstMeasureForVoice (
526 int inputLineNumber,
527 S_msrMeasure firstMeasure,
528 string context);
529
530 // repeats
531
532 void handleRepeatEndInVoice (
533 int inputLineNumber,
534 string measureNumber,
535 int repeatTimes);
536
537 void handleRepeatEndingStartInVoice (
538 int inputLineNumber);
539
540 void handleRepeatEndingEndInVoice (
541 int inputLineNumber,
542 string repeatEndingNumber, // may be "1, 2"
543 msrRepeatEnding::msrRepeatEndingKind
544 repeatEndingKind);
545
546 void handleRepeatCommonPartStartInVoiceClone (
547 int inputLineNumber);
548
549 void handleRepeatCommonPartEndInVoiceClone (
550 int inputLineNumber);
551
552 void handleRepeatEndingStartInVoiceClone (
553 int inputLineNumber,
554 msrRepeatEnding::msrRepeatEndingKind
555 repeatEndingKind,
556 string repeatEndingNumber); // may be "1, 2"
557
558 void handleRepeatEndingEndInVoiceClone (
559 int inputLineNumber,
560 string repeatEndingNumber, // may be "1, 2"
561 msrRepeatEnding::msrRepeatEndingKind
562 repeatEndingKind);
563
564 void handleSegmentCloneEndInVoiceClone (
565 int inputLineNumber,
566 S_msrSegment segmentClone);
567
568/* JMI
569 void finalizeRepeatEndInVoice (
570 int inputLineNumber,
571 string measureNumber,
572 int repeatTimes);
573 */
574
575 void handleRepeatStartInVoice (
576 int inputLineNumber);
577
578 void handleRepeatStartInVoiceClone (
579 int inputLineNumber,
580 S_msrRepeat repeat);
581
582 void handleRepeatEndInVoiceClone (
583 int inputLineNumber);
584
585 void appendRepeatCloneToVoiceClone (
586 int inputLineNumber,
587 S_msrRepeat repeatCLone);
588
589 void appendRepeatEndingCloneToVoice (
590 S_msrRepeatEnding repeatEndingClone);
591
592 // rest measures
593
594 void appendRestMeasuresToVoiceElementsList (
595 S_msrRestMeasures restMeasures);
596
597 void createRestMeasuresInVoice (
598 int inputLineNumber,
599 int restMeasuresNumber);
600
601 void appendRestMeasuresToVoice (
602 int inputLineNumber,
603 S_msrRestMeasures restMeasures);
604
605 void appendPendingRestMeasuresToVoice (
606 int inputLineNumber);
607
608 void handleRestMeasuresStartInVoiceClone (
609 int inputLineNumber,
610 S_msrRestMeasures restMeasures);
611
612 void handleRestMeasuresEndInVoiceClone (
613 int inputLineNumber);
614
615 void handleRestMeasuresContentsStartInVoiceClone (
616 int inputLineNumber);
617
618 void handleRestMeasuresContentsEndInVoiceClone (
619 int inputLineNumber);
620
621 void appendRestMeasuresCloneToVoiceClone ( // JMI ???
622 int inputLineNumber,
623 S_msrRestMeasures restMeasuresClone);
624
625 // measures repeats
626
627 void appendMeasuresRepeatToVoiceElementsList (
628 S_msrMeasuresRepeat beatsRepeat);
629
630 void appendMeasuresRepeatReplicaToVoice (
631 int inputLineNumber);
632
633 void createMeasuresRepeatFromItsFirstMeasuresInVoice (
634 int inputLineNumber,
635 int beatsRepeatMeasuresNumber,
636 int beatsRepeatSlashesNumber);
637
638 void appendMeasuresRepeatToVoice (
639 int inputLineNumber,
640 S_msrMeasuresRepeat beatsRepeat);
641
642 void appendPendingMeasuresRepeatToVoice (
643 int inputLineNumber);
644
645 void createMeasuresRepeatAndAppendItToVoiceClone (
646 int inputLineNumber,
647 int beatsRepeatMeasuresNumber,
648 int beatsRepeatSlashesNumber);
649
650 void handleMeasuresRepeatStartInVoiceClone (
651 int inputLineNumber,
652 S_msrMeasuresRepeat beatsRepeat);
653
654 void handleMeasuresRepeatEndInVoiceClone (
655 int inputLineNumber);
656
657 void handleMeasuresRepeatPatternStartInVoiceClone (
658 int inputLineNumber);
659
660 void handleMeasuresRepeatPatternEndInVoiceClone (
661 int inputLineNumber);
662
663 void handleMeasuresRepeatReplicasStartInVoiceClone (
664 int inputLineNumber);
665
666 void handleMeasuresRepeatReplicasEndInVoiceClone (
667 int inputLineNumber);
668
669 void appendMeasuresRepeatCloneToVoiceClone ( // JMI ???
670 int inputLineNumber,
671 S_msrMeasuresRepeat beatsRepeatClone);
672
673 // stanzas
674
675 S_msrStanza addStanzaToVoiceByItsNumber (
676 int inputLineNumber,
677 string stanzaNumber);
678
679 void addStanzaToVoiceWithoutCatchUp ( // JMI
680 S_msrStanza stanza);
681
682 void addStanzaToVoice (
683 S_msrStanza stanza);
684
685 S_msrStanza createStanzaInVoiceIfNotYetDone (
686 int inputLineNumber,
687 string stanzaNumber,
688 string stanzaName);
689
690 S_msrStanza fetchStanzaInVoice (
691 int inputLineNumber,
692 string stanzaNumber,
693 string stanzaName);
694
695 // strings
696
697 // finalization
698
699 void finalizeCurrentMeasureInVoice (
700 int inputLineNumber);
701
702 void finalizeVoice (
703 int inputLineNumber);
704
705 void collectVoiceMeasuresIntoFlatList (
706 int inputLineNumber);
707
708 private:
709
710 // private services
711 // ------------------------------------------------------
712
713 // voice last segment
714
715 void appendVoiceLastSegmentToInitialVoiceElements (
716 int inputLineNumber,
717 string context);
718
719 void moveVoiceLastSegmentToInitialVoiceElementsIfRelevant (
720 int inputLineNumber,
721 string context);
722
723 // harmonies
724
725 void appendHarmonyToHarmonyVoice (
726 S_msrHarmony harmony);
727
728 // figured basses
729
730 void appendFiguredBassToFiguredBassVoice (
731 S_msrFiguredBass figuredBass);
732
733 // repeats
734
735 S_msrRepeat createARepeatAndStackIt (
736 int inputLineNumber,
737 string context);
738
739 S_msrRepeat createARepeatCloneAndStackIt (
740 int inputLineNumber,
741 S_msrRepeat repeat,
742 string context);
743
744 void popRepeatFromRepeatDescrsStack (
745 int inputLineNumber,
746 S_msrRepeat repeat,
747 string context);
748
749 void pushRepeatOntoRepeatDescrsStack (
750 int inputLineNumber,
751 S_msrRepeat repeat,
752 string context);
753
754 void appendRepeatToInitialVoiceElements (
755 int inputLineNumber,
756 S_msrRepeat repeat,
757 string context);
758
759 void appendRepeatCloneToInitialVoiceElements (
760 int inputLineNumber,
761 S_msrRepeat repeatCLone,
762 string context);
763
764 void handleVoiceLevelRepeatStartInVoice (
765 int inputLineNumber);
766
767 void handleNestedRepeatStartInVoice (
768 int inputLineNumber);
769
770 void handleVoiceLevelRepeatEndWithoutStartInVoice (
771 int inputLineNumber,
772 string measureNumber,
773 int repeatTimes);
774
775 void handleVoiceLevelContainingRepeatEndWithoutStartInVoice (
776 int inputLineNumber,
777 string measureNumber,
778 int repeatTimes);
779
780 void handleVoiceLevelRepeatEndWithStartInVoice (
781 int inputLineNumber,
782 string measureNumber,
783 int repeatTimes);
784
785 void handleVoiceLevelRepeatEndingStartWithoutExplicitStartInVoice (
786 int inputLineNumber,
787 S_msrRepeat currentRepeat);
788
789 void handleVoiceLevelRepeatEndingStartWithExplicitStartInVoice (
790 int inputLineNumber);
791
792 void nestContentsIntoNewRepeatInVoice (
793 int inputLineNumber);
794
795 void handleNestedRepeatEndingStartInVoice (
796 int inputLineNumber);
797
798 void handleNestedRepeatEndInVoice (
799 int inputLineNumber,
800 string measureNumber,
801 int repeatTimes);
802
803 void moveVoiceInitialElementsToRepeatCommonPart (
804 int inputLineNumber,
805 S_msrRepeatCommonPart repeatCommonPart,
806 string context);
807
808 void moveVoiceLastSegmentToRepeatCommonPart (
809 int inputLineNumber,
810 S_msrRepeatCommonPart repeatCommonPart,
811 string context);
812
813 void moveAllVoiceContentsToRepeatCommonPart (
814 int inputLineNumber,
815 S_msrRepeatCommonPart repeatCommonPart,
816 string context);
817
818 void moveVoiceLastSegmentToRepeatEnding (
819 int inputLineNumber,
820 S_msrRepeatEnding repeatEnding,
821 string context);
822
823 void handleHookedRepeatEndingEndInVoice (
824 int inputLineNumber,
825 string repeatEndingNumber); // may be "1, 2"
826
827 void handleHooklessRepeatEndingEndInVoice (
828 int inputLineNumber,
829 string repeatEndingNumber); // may be "1, 2"
830
831 void handleHookedRepeatEndingEndInVoiceClone (
832 int inputLineNumber,
833 string repeatEndingNumber); // may be "1, 2"
834
835 void handleHooklessRepeatEndingEndInVoiceClone (
836 int inputLineNumber,
837 string repeatEndingNumber); // may be "1, 2"
838
839 // rest measures
840
841 void appendRestMeasuresToInitialVoiceElements (
842 int inputLineNumber,
843 S_msrRestMeasures restMeasures,
844 string context);
845
846 // measures repeats
847
848 void appendMeasuresRepeatToInitialVoiceElements (
849 int inputLineNumber,
850 S_msrMeasuresRepeat measuresRepeat,
851 string context);
852
853 // beats repeats
854
855 void appendBeatsRepeatToInitialVoiceElements (
856 int inputLineNumber,
857 S_msrBeatsRepeat beatsRepeat,
858 string context);
859
860 public:
861
862 // visitors
863 // ------------------------------------------------------
864
865 virtual void acceptIn (basevisitor* v);
866 virtual void acceptOut (basevisitor* v);
867
868 virtual void browseData (basevisitor* v);
869
870 public:
871
872 // print
873 // ------------------------------------------------------
874
875 string voiceKindAsString () const;
876
877 string voiceNumberAsString () const;
878
879 string regularVoiceStaffSequentialNumberAsString () const;
880
881 string asShortString () const;
882 string asString () const;
883
884 void displayVoice (
885 int inputLineNumber,
886 string context);
887
888 void displayVoiceRepeatsStackRestMeasuresMeasuresRepeatAndVoice (
889 int inputLineNumber,
890 string context);
891
892 virtual void print (ostream& os) const;
893
894 private:
895
896 // fields
897 // ------------------------------------------------------
898
899 // upLinks
900
901 S_msrStaff fVoiceStaffUpLink;
902
903 // two-way links
904 S_msrVoice fHarmonyVoiceForRegularVoiceForwardLink;
905 S_msrVoice fRegularVoiceForHarmonyVoiceBackwardLink;
906
907 S_msrVoice fFiguredBassVoiceForRegularVoiceForwardLink;
908 S_msrVoice fRegularVoiceForFiguredBassVoiceBackwardLink;
909
910 // voice kind
911
912 msrVoiceKind fVoiceKind;
913
914 // voice numbers
915
916 // voice numbers in MusicXML may be greater than 4
917 // and there can be holes
918 int fVoiceNumber;
919
920 // there can only be 4 regular voices in a staff
921 // (those that can contain beamed notes)
922 // and we need a number for the orientation of beams
923 int fRegularVoiceStaffSequentialNumber;
924
925 // voice name
926
927 string fVoiceName;
928
929
930 // counters
931
932 static int gVoicesCounter;
933
934 int fVoiceActualNotesCounter;
935 int fVoiceRestsCounter;
936 int fVoiceSkipsCounter;
937 int fVoiceActualHarmoniesCounter;
938 int fVoiceActualFiguredBassesCounter;
939
940 // musically empty voices
941
942 bool fMusicHasBeenInsertedInVoice;
943
944 // regular measure ends detection
945
946 rational fWholeNotesSinceLastRegularMeasureEnd;
947
948 // incomplete measures after repeats detection
949 msrVoiceRepeatPhaseKind
950 fCurrentVoiceRepeatPhaseKind;
951
952 // voice internal handling
953
954 list<S_msrVoiceElement>
955 fInitialVoiceElementsList;
956
957 // stanzas
958
959 map<string, S_msrStanza>
960 fVoiceStanzasMap;
961
962 // segments
963
964 // fVoiceLastSegment contains the music
965 // not yet stored in fVoiceInitialElementsList,
966 // it is thus logically the end of the latter,
967 // and is created implicitly for every voice.
968 // It is needed 'outside' of the 'list<S_msrElement>'
969 // because it is not a mere S_msrElement, but a S_msrSegment
970 S_msrSegment fVoiceLastSegment;
971
972 // fVoiceFirstSegment is used to work around LilyPond issue 34
973 S_msrSegment fVoiceFirstSegment;
974
975 // measures
976
977 // fVoiceFirstMeasure is used to number voice upbeats as measure 0
978 S_msrMeasure fVoiceFirstMeasure;
979
980 // measures flat list
981 // i.e. without segments nor repeats,
982 // gathered from fVoiceInitialElementsList and fVoiceLastSegment
983 // by finalizeMeasure()
984 list<S_msrMeasure> fVoiceMeasuresFlatList;
985
986 // notes
987
988 // fVoiceLastAppendedNote is used to build chords upon their second note
989 S_msrNote fVoiceLastAppendedNote;
990 rational fVoiceShortestNoteDuration;
991
992 // fVoiceShortestNoteDuration and fVoiceShortestNoteTupletFactor
993 // are used to compute a number of divisions per quarter note
994 // if needed, such as when generating MusicXML from MSR
995 rational fVoiceShorftestNoteDuration;
996 rational fVoiceShortestNoteTupletFactor;
997
998 // repeats
999
1000 public:
1001
1002 // public work services
1003 // ------------------------------------------------------
1004
1005 // clef, key, time
1006
1007 void setVoiceCurrentClef (S_msrClef clef);
1008
1009 S_msrClef getVoiceCurrentClef () const
1010 { return fVoiceCurrentClef; }
1011
1012 S_msrClef getVoiceFirstClef () const
1013 { return fVoiceFirstClef; }
1014
1015 void setVoiceCurrentKey (S_msrKey key);
1016
1017 S_msrKey getVoiceCurrentKey () const
1018 { return fVoiceCurrentKey; }
1019
1020 void setVoiceCurrentTime (S_msrTime time);
1021
1022 S_msrTime getVoiceCurrentTime () const
1023 { return fVoiceCurrentTime; }
1024
1025 // measures
1026
1027 const string getVoiceCurrentMeasureNumber () const
1028 { return fVoiceCurrentMeasureNumber; }
1029
1030 void incrementVoiceCurrentMeasurePuristNumber (
1031 int inputLineNumber,
1032 string context);
1033
1034 void setVoiceCurrentMeasurePuristNumber (
1035 int measurePuristNumber)
1036 { fVoiceCurrentMeasureNumber = measurePuristNumber; }
1037
1038 const int getVoiceCurrentMeasurePuristNumber () const
1039 { return fVoiceCurrentMeasurePuristNumber; }
1040
1041 void setVoiceFirstMeasure (
1042 S_msrMeasure measure)
1043 { fVoiceFirstMeasure = measure; }
1044
1045 const S_msrMeasure getVoiceFirstMeasure () const
1046 { return fVoiceFirstMeasure; }
1047
1048 void appendMeasureCloneToVoiceClone (
1049 int inputLineNumber,
1050 S_msrMeasure measureClone);
1051
1052 private:
1053
1054 // private work services
1055 // ------------------------------------------------------
1056
1057 void displayVoiceRepeatsStackSummary (
1058 int inputLineNumber,
1059 string context);
1060
1061 void displayVoiceRepeatsStack (
1062 int inputLineNumber,
1063 string context);
1064
1065 void displayVoiceRepeatsStackAndVoice (
1066 int inputLineNumber,
1067 string context);
1068
1069 void displayVoiceRestMeasures (
1070 int inputLineNumber,
1071 string context);
1072
1073 void displayVoiceRestMeasuresAndVoice (
1074 int inputLineNumber,
1075 string context);
1076
1077 void displayVoiceMeasuresRepeat (
1078 int inputLineNumber,
1079 string context);
1080
1081 void displayVoiceMeasuresRepeatAndVoice (
1082 int inputLineNumber,
1083 string context);
1084
1085 private:
1086
1087 // work fields
1088 // ------------------------------------------------------
1089
1090 // clef, key, time
1091 // needed at the voice level, because adding such to voice clones
1092 // is done directly, without going down the part-staff-voice hierarchy
1093 S_msrClef fVoiceCurrentClef;
1094
1095 S_msrKey fVoiceCurrentKey;
1096
1097 S_msrTime fVoiceCurrentTime;
1098
1099 // the first in the voice is handled specifically for LilyPond code generation
1100 S_msrClef fVoiceFirstClef;
1101
1102 // measures
1103
1104 string fVoiceCurrentMeasureNumber;
1105
1106 int fVoiceCurrentMeasurePuristNumber;
1107 // this is a 'purist' measure number,
1108 // that starts at 0 if there is an anacrusis,
1109 // and 1 otherwise,
1110 // and is shared by incomplete (sub)measure fragments
1111
1112 // fVoiceCurrentMeasure contains the last measure append to the voice
1113 S_msrMeasure fVoiceCurrentMeasure;
1114
1115 // a stack is needed to handle pending repeats, which can be nested
1116 list<S_msrRepeatDescr>
1117 fVoicePendingRepeatDescrsStack;
1118
1119 // rest measures
1120
1121 // fVoicePendingRestMeasures is either null
1122 // or the last msrRestMeasures created,
1123 // but not yet appended to the voice
1124 S_msrRestMeasures fVoicePendingRestMeasures;
1125
1126 // fVoiceRestMeasuresWaitingForItsNextMeasureNumber is either null
1127 // or the last msrRestMeasures created and appended to the voice,
1128 // but with its next measure number not yet set
1129 S_msrRestMeasures fVoiceRestMeasuresWaitingForItsNextMeasureNumber;
1130 int fVoiceRemainingRestMeasures;
1131
1132 bool fVoiceContainsRestMeasures;
1133
1134 // measure repeats
1135
1136 // fVoicePendingMeasuresRepeat is either null
1137 // or the last msrMeasuresRepeat created,
1138 // but not yet appended to the voice
1139 S_msrMeasuresRepeat fVoicePendingMeasuresRepeat;
1140
1141 bool fVoiceContainsMeasuresRepeats;
1142
1143 // voice finalization
1144
1145 bool fVoiceHasBeenFinalized;
1146};
1147EXP ostream& operator<< (ostream& os, const S_msrVoice& elt);
1148
Definition: msrVoices_MUT_DEP.h:8
Rational number representation.
Definition: rational.h:25