LibMusicXML  3.18
msrParts_MUT_DEP.h
1 /*
2  This file is to be included only by msrMutualDependencies.h,
3  to satisfy declarations mutual dependencies.
4 */
5 
6 //______________________________________________________________________________
7 class msrPart : public msrPartGroupElement
8 {
9  public:
10 
11  // constants
12  // ------------------------------------------------------
13 
14  #define K_PART_FIGURED_BASS_STAFF_NUMBER -219
15  #define K_PART_FIGURED_BASS_VOICE_NUMBER -227
16 
17  // creation from MusicXML
18  // ------------------------------------------------------
19 
20  static SMARTP<msrPart> create (
21  int inputLineNumber,
22  string partID,
23  S_msrPartGroup partPartGroupUpLink);
24 
25  SMARTP<msrPart> createPartNewbornClone (
26  S_msrPartGroup partGroupClone);
27 
28  protected:
29 
30  // constructors/destructor
31  // ------------------------------------------------------
32 
33  msrPart (
34  int inputLineNumber,
35  string partID,
36  S_msrPartGroup partPartGroupUpLink);
37 
38  virtual ~msrPart ();
39 
40  private:
41 
42  // initialization
43  // ------------------------------------------------------
44 
45  void initializePart ();
46 
47  public:
48 
49  // set and get
50  // ------------------------------------------------------
51 
52  // upLinks
53 
54  void setPartPartGroupUpLink (
55  S_msrPartGroup partGroup)
56  { fPartPartGroupUpLink = partGroup; }
57 
58  S_msrPartGroup getPartPartGroupUpLink () const
59  { return fPartPartGroupUpLink; }
60 
61  // part absolute number
62 
63  int getPartAbsoluteNumber () const
64  { return fPartAbsoluteNumber; }
65 
66  // ID and name
67 
68  void setPartID (string partID)
69  { fPartID = partID; }
70 
71  string getPartID () const
72  { return fPartID; }
73 
74  void setPartMsrName (string partMsrName);
75 
76  string getPartMsrName () const
77  { return fPartMsrName; }
78 
79  void setPartName (string partName)
80  { fPartName = partName; }
81 
82  string getPartName () const
83  { return fPartName; }
84 
85  void setPartNameDisplayText (
86  string partNameDisplayText)
87  {
88  fPartNameDisplayText =
89  partNameDisplayText;
90  }
91 
92  string getPartNameDisplayText () const
93  { return fPartNameDisplayText; }
94 
95  void setPartAbbreviation (
96  string partAbbreviation)
97  {
98  fPartAbbreviation =
99  partAbbreviation;
100  }
101 
102  string getPartAbbreviation () const
103  { return fPartAbbreviation; }
104 
105  void setPartAbbreviationDisplayText (
106  string partAbbreviationDisplayText)
107  {
108  fPartAbbreviationDisplayText =
109  partAbbreviationDisplayText;
110  }
111 
112  string getPartAbbreviationDisplayText () const
113  { return fPartAbbreviationDisplayText; }
114 
115  string getPartCombinedName () const;
116 
117  void setPartInstrumentNamesMaxLengthes ();
118 
119  // measures
120 
121  void setPartNumberOfMeasures (
122  int partNumberOfMeasures)
123  {
124  fPartNumberOfMeasures =
125  partNumberOfMeasures;
126  }
127 
128  const int getPartNumberOfMeasures () const
129  { return fPartNumberOfMeasures; }
130  // instrument name
131 
132  void setPartInstrumentName (
133  string partInstrumentName)
134  {
135  fPartInstrumentName =
136  partInstrumentName;
137  }
138 
139  string getPartInstrumentName () const
140  { return fPartInstrumentName; }
141 
142  void setPartInstrumentAbbreviation (
143  string partInstrumentAbbreviation)
144  {
145  fPartInstrumentAbbreviation =
146  partInstrumentAbbreviation;
147  }
148 
149  string getPartInstrumentAbbreviation () const
150  { return fPartInstrumentAbbreviation; }
151 
152  // figured bass staff and voice
153 
154  void setPartFiguredBassStaff (
155  S_msrStaff figuredBassStaff)
156  {
157  fPartFiguredBassStaff =
158  figuredBassStaff;
159  }
160 
161  S_msrStaff getPartFiguredBassStaff () const
162  { return fPartFiguredBassStaff; }
163 
164  void setPartFiguredBassVoice (
165  S_msrVoice figuredBassVoice)
166  {
167  fPartFiguredBassVoice =
168  figuredBassVoice;
169  }
170 
171  S_msrVoice getPartFiguredBassVoice () const
172  { return fPartFiguredBassVoice; }
173 
174  // staves map
175 
176  const map<int, S_msrStaff>&
177  getPartStavesMap ()
178  { return fPartStavesMap; }
179 
180  // staff position in measure
181 
182  void setPartCurrentPositionInMeasure (
183  int inputLineNumber,
184  rational positionInMeasure);
185 
186  void incrementPartCurrentPositionInMeasure (
187  int inputLineNumber,
188  rational duration);
189  void decrementPartCurrentPositionInMeasure (
190  int inputLineNumber,
191  rational duration);
192 
193  rational getPartCurrentPositionInMeasure () const
194  { return fPartCurrentPositionInMeasure; }
195 
196  // services
197  // ------------------------------------------------------
198 
199  void assignSequentialNumbersToRegularVoicesInPart (
200  int inputLineNumber);
201 
202  void addAVoiceToStavesThatHaveNone (
203  int inputLineNumber);
204 
205  // part name display
206 
207  void appendPartNameDisplayToPart (
208  S_msrPartNameDisplay partNameDisplay);
209 
210  // part abbreviation display
211 
212  void appendPartAbbreviationDisplayToPart (
213  S_msrPartAbbreviationDisplay partAbbreviationDisplay);
214 
215 /* JMI
216  // figured bass staff and voice
217 
218  void createPartFiguredBassStaffAndVoiceIfNotYetDone (
219  int inputLineNumber);
220  */
221 
222  // measures
223 
224  void createMeasureAndAppendItToPart (
225  int inputLineNumber,
226  string measureNumber,
227  msrMeasure::msrMeasureImplicitKind
228  measureImplicitKind);
229 
230  void setNextMeasureNumberInPart (
231  int inputLineNumber,
232  string nextMeasureNumber);
233 
234  // clef, key, time
235 
236  void appendClefToPart (S_msrClef clef);
237 
238  void appendKeyToPart (S_msrKey key);
239 
240  void appendTimeToPart (S_msrTime time);
241  void appendTimeToPartClone (S_msrTime time);
242 
243  // transpose
244 
245  void appendTransposeToPart (
246  S_msrTranspose transpose);
247 
248  // staff details
249 
250  void appendStaffDetailsToPart (
251  S_msrStaffDetails staffDetails);
252 
253  // tuplets JMI ???
254 
255  // barlines
256 
257  void appendBarlineToPart (S_msrBarline barline);
258 
259  // repeats
260 
261  void handleRepeatStartInPart (
262  int inputLineNumber);
263 
264  void handleRepeatEndInPart (
265  int inputLineNumber,
266  string measureNumber,
267  int repeatTimes);
268 
269  void handleRepeatEndingStartInPart (
270  int inputLineNumber);
271 
272  void handleRepeatEndingEndInPart (
273  int inputLineNumber,
274  string repeatEndingNumber, // may be "1, 2"
275  msrRepeatEnding::msrRepeatEndingKind
276  repeatEndingKind);
277 
278  /* JMI ???
279  void finalizeRepeatEndInPart (
280  int inputLineNumber,
281  string measureNumber,
282  int repeatTimes);
283  */
284 
285  void appendRepeatCloneToPart (
286  int inputLineNumber,
287  S_msrRepeat repeatCLone);
288 
289  void appendRepeatEndingCloneToPart (
290  S_msrRepeatEnding repeatEndingCLone);
291 
292  void createRestMeasuresInPart (
293  int inputLineNumber,
294  int restMeasuresNumber);
295 
296  void appendPendingRestMeasuresToPart (
297  int inputLineNumber);
298 
299  void appendRestMeasuresCloneToPart (
300  int inputLineNumber,
301  S_msrRestMeasures restMeasures);
302 
303  void createMeasuresRepeatFromItsFirstMeasuresInPart (
304  int inputLineNumber,
305  int measuresRepeatMeasuresNumber,
306  int measuresRepeatSlashesNumber);
307 
308  void appendPendingMeasuresRepeatToPart (
309  int inputLineNumber);
310 
311  void appendMeasuresRepeatCloneToPart (
312  int inputLineNumber,
313  S_msrRestMeasures restMeasures);
314 
315  // staves
316 
317  S_msrStaff addStaffToPartByItsNumber (
318  int inputLineNumber,
319  msrStaff::msrStaffKind staffKind,
320  int staffNumber);
321 
322  void addStaffToPartCloneByItsNumber (
323  S_msrStaff staff);
324 
325  S_msrStaff fetchStaffFromPart (int staffNumber);
326 
327  // voices
328 
329  void removePartEmptyVoices ();
330 
331  // harmonies
332 
333  // JMI ???
334 
335  // frames
336 
337  // JMI ???
338 
339  // figured bass
340 
341  void appendFiguredBassToPart (
342  S_msrVoice figuredBassSupplierVoice,
343  S_msrFiguredBass figuredBass);
344 
345  void appendFiguredBassToPartClone (
346  S_msrVoice figuredBassSupplierVoice,
347  S_msrFiguredBass figuredBass);
348 
349  // scordaturas
350 
351  void appendScordaturaToPart (
352  S_msrScordatura scordatura);
353 
354  // accordion registration
355 
356  void appendAccordionRegistrationToPart (
357  S_msrAccordionRegistration
358  accordionRegistration);
359 
360  // harp pedals tuning
361 
362  void appendHarpPedalsTuningToPart (
363  S_msrHarpPedalsTuning
364  harpPedalsTuning);
365 
366  // work around LilyPond issue 34
367 
368  void addSkipGraceNotesGroupBeforeAheadOfVoicesClonesIfNeeded (
369  S_msrVoice graceNotesGroupOriginVoice,
370  S_msrGraceNotesGroup skipGraceNotesGroup);
371 
372 /*
373  void appendSkipGraceNotesToVoicesClones ( // JMI ???
374  S_msrVoice graceNotesOriginVoice,
375  S_msrGraceNotes skipGraceNotes);
376 
377  */
378 
379  void handleBackupInPart (
380  int inputLineNumber,
381  rational backupStepLength);
382 
383  public:
384 
385  // visitors
386  // ------------------------------------------------------
387 
388  virtual void acceptIn (basevisitor* v);
389  virtual void acceptOut (basevisitor* v);
390 
391  virtual void browseData (basevisitor* v);
392 
393  public:
394 
395  // print
396  // ------------------------------------------------------
397 
398  virtual string asString () const;
399 
400  virtual void print (ostream& os) const;
401 
402  virtual void printSummary (ostream& os);
403 
404  private:
405 
406  // fields
407  // ------------------------------------------------------
408 
409  // upLinks
410 
411  S_msrPartGroup fPartPartGroupUpLink;
412 
413  // part ID and name
414 
415  string fPartID; // native
416 
417  string fPartMsrName;
418  // may be different than fPartID
419  // if renamed,
420  // coined in constructor
421 
422  string fPartName; // from '<part-name/>'
423  string fPartNameDisplayText;
424 
425  string fPartAbbreviation;
426  string fPartAbbreviationDisplayText;
427 
428  // part absolute number
429 
430  int fPartAbsoluteNumber;
431 
432  // part instrument names
433 
434  string fPartInstrumentName;
435  string fPartInstrumentAbbreviation;
436 
437  // measures
438 
439  string fPartCurrentMeasureNumber;
440 
441  int fPartNumberOfMeasures;
442 
443  // clef, key, time
444 
445  S_msrClef fPartCurrentClef;
446 
447  S_msrKey fPartCurrentKey;
448 
449  S_msrTime fPartCurrentTime;
450 
451  // transpose
452 
453  S_msrTranspose fPartCurrentTranspose;
454 
455  // figured bass
456 
457  S_msrStaff fPartFiguredBassStaff;
458  S_msrVoice fPartFiguredBassVoice;
459 
460  // the registered staves map
461 
462  map<int, S_msrStaff> fPartStavesMap;
463 
464  // counter
465 
466  static int gPartsCounter;
467 
468  // rest measures
469 
470  bool fPartContainsRestMeasures;
471 
472  public:
473 
474  // public work services
475  // ------------------------------------------------------
476 
477  // measure number
478 
479  void setPartCurrentMeasureNumber (
480  string measureNumber)
481  {
482  fPartCurrentMeasureNumber =
483  measureNumber;
484  }
485 
486  const string getPartCurrentMeasureNumber () const
487  { return fPartCurrentMeasureNumber; }
488 
489  // clef, key, time
490 
491  S_msrClef getPartCurrentClef () const
492  { return fPartCurrentClef; }
493 
494  S_msrKey getPartCurrentKey () const
495  { return fPartCurrentKey; }
496 
497  void setPartCurrentTime (S_msrTime time)
498  { fPartCurrentTime = time; }
499 
500  S_msrTime getPartCurrentTime () const
501  { return fPartCurrentTime; }
502 
503  // transpose
504 
505  S_msrTranspose getPartCurrentTranspose () const
506  { return fPartCurrentTranspose; }
507 
508  // staff details
509 
510  S_msrStaffDetails getCurrentPartStaffDetails () const
511  { return fCurrentPartStaffDetails; }
512 
513  // finalization
514 
515  void finalizeCurrentMeasureInPart (
516  int inputLineNumber);
517 
518  void finalizePart (
519  int inputLineNumber);
520 
521  void finalizePartClone (
522  int inputLineNumber);
523 
524  private:
525 
526  // private work services
527  // ------------------------------------------------------
528 
529  // measure elements
530 
531  private:
532 
533  // work fields
534  // ------------------------------------------------------
535 
536  // staff details
537 
538  S_msrStaffDetails fCurrentPartStaffDetails;
539 
540  // position in measure
541 
542  rational fPartCurrentPositionInMeasure;
543 };
544 typedef SMARTP<msrPart> S_msrPart;
545 EXP ostream& operator<< (ostream& os, const S_msrPart& elt);
546 
msrPart
Definition: msrParts_MUT_DEP.h:8
rational
Rational number representation.
Definition: rational.h:25