MuseScore  3.4
Music composition and notation
importmidi_meter.h
Go to the documentation of this file.
1 #ifndef IMPORTMIDI_METER_H
2 #define IMPORTMIDI_METER_H
3 
4 
5 namespace Ms {
6 
7 class ReducedFraction;
8 class TDuration;
9 
10 namespace MidiTuplet {
11 struct TupletData;
12 }
13 
14 namespace Meter {
15 
16 enum class DurationType : char
17  {
18  NOTE,
19  REST
20  };
21 
22 bool isSimple(const ReducedFraction &barFraction);
23 bool isCompound(const ReducedFraction &barFraction);
24 bool isComplex(const ReducedFraction &barFraction);
25 bool isDuple(const ReducedFraction &barFraction);
26 bool isTriple(const ReducedFraction &barFraction);
27 bool isQuadruple(const ReducedFraction &barFraction);
28 bool isQuintuple(const ReducedFraction &barFraction);
29 bool isSeptuple(const ReducedFraction &barFraction);
30 
31 ReducedFraction beatLength(const ReducedFraction &barFraction);
32 
33 struct DivisionInfo;
34 
37  int tupletStartLevel);
38 
39 // result in vector: first elements - all tuplets info, one at the end - bar division info
40 std::vector<DivisionInfo> divisionInfo(const ReducedFraction &barFraction,
41  const std::vector<MidiTuplet::TupletData> &tupletsInBar);
42 
43 // tick is counted from the beginning of bar
44 int levelOfTick(const ReducedFraction &tick, const std::vector<DivisionInfo> &divsInfo);
45 
46 std::vector<int> metricLevelsOfBar(const ReducedFraction &barFraction,
47  const std::vector<DivisionInfo> &divsInfo,
48  const ReducedFraction &minDuration);
49 
50 bool isSimpleNoteDuration(const ReducedFraction &duration); // quarter, half, eighth, 16th ...
51 
52  // division lengths of bar, each can be a tuplet length
53 std::vector<ReducedFraction> divisionsOfBarForTuplets(const ReducedFraction &barFraction);
54 
55  // duration and all tuplets should belong to the same voice
56 // nested tuplets are not allowed
57 QList<std::pair<ReducedFraction, TDuration> >
58 toDurationList(const ReducedFraction &startTickInBar,
59  const ReducedFraction &endTickInBar,
60  const ReducedFraction &barFraction,
61  const std::vector<MidiTuplet::TupletData> &tupletsInBar,
62  DurationType durationType,
63  bool useDots,
64  bool printRestRemains = true);
65 
66 } // namespace Meter
67 } // namespace Ms
68 
69 
70 #endif // IMPORTMIDI_METER_H
DurationType
Definition: importmidi_meter.h:16
std::vector< TDuration > toDurationList(Fraction l, bool useDots, int maxDots, bool printRestRemains)
Definition: durationtype.cpp:505
bool isTriple(const ReducedFraction &barFraction)
Definition: importmidi_meter.cpp:33
bool isSimpleNoteDuration(const ReducedFraction &duration)
Definition: importmidi_meter.cpp:287
Definition: importmidi_inner.h:43
ReducedFraction beatLength(const ReducedFraction &barFraction)
Definition: importmidi_meter.cpp:115
bool isSeptuple(const ReducedFraction &barFraction)
Definition: importmidi_meter.cpp:48
DivisionInfo metricDivisionsOfTuplet(const MidiTuplet::TupletData &tuplet, int tupletStartLevel)
Definition: importmidi_meter.cpp:98
std::vector< int > metricLevelsOfBar(const ReducedFraction &barFraction, const std::vector< DivisionInfo > &divsInfo, const ReducedFraction &minDuration)
Definition: importmidi_meter.cpp:183
bool isCompound(const ReducedFraction &barFraction)
Definition: importmidi_meter.cpp:18
bool isQuintuple(const ReducedFraction &barFraction)
Definition: importmidi_meter.cpp:43
DivisionInfo metricDivisionsOfBar(const ReducedFraction &barFraction)
Definition: importmidi_meter.cpp:57
int levelOfTick(const ReducedFraction &tick, const std::vector< DivisionInfo > &divsInfo)
Definition: importmidi_meter.cpp:169
Definition: aeolus.cpp:26
Definition: importmidi_tuplet.h:19
bool isDuple(const ReducedFraction &barFraction)
Definition: importmidi_meter.cpp:28
std::vector< ReducedFraction > divisionsOfBarForTuplets(const ReducedFraction &barFraction)
Definition: importmidi_meter.cpp:129
std::vector< DivisionInfo > divisionInfo(const ReducedFraction &barFraction, const std::vector< MidiTuplet::TupletData > &tupletsInBar)
Definition: importmidi_meter.cpp:146
Definition: importmidi_fraction.h:9
bool isSimple(const ReducedFraction &barFraction)
Definition: importmidi_meter.cpp:13
bool isComplex(const ReducedFraction &barFraction)
Definition: importmidi_meter.cpp:23
bool isQuadruple(const ReducedFraction &barFraction)
Definition: importmidi_meter.cpp:38