MuseScore  3.4
Music composition and notation
importmidi_quant.h
Go to the documentation of this file.
1 #ifndef IMPORTMIDI_QUANT_H
2 #define IMPORTMIDI_QUANT_H
3 
4 #include "importmidi_operation.h"
5 
6 
7 namespace Ms {
8 
9 class MidiChord;
10 class MTrack;
11 class TimeSigMap;
12 class ReducedFraction;
13 
14 namespace Quantize {
15 
16 ReducedFraction quantValueToFraction(MidiOperations::QuantValue quantValue);
17 MidiOperations::QuantValue fractionToQuantValue(const ReducedFraction &fraction);
19 
20 ReducedFraction findQuantForRange(
21  const std::multimap<ReducedFraction, MidiChord>::const_iterator &beg,
22  const std::multimap<ReducedFraction, MidiChord>::const_iterator &end,
23  const ReducedFraction &basicQuant);
24 
25 ReducedFraction findQuantizedTupletChordOnTime(
26  const std::pair<const ReducedFraction, MidiChord> &chord,
27  const ReducedFraction &tupletLen,
28  const ReducedFraction &tupletRatio,
29  const ReducedFraction &rangeStart);
30 
31 ReducedFraction findQuantizedChordOnTime(
32  const std::pair<const ReducedFraction, MidiChord> &chord,
33  const ReducedFraction &basicQuant);
34 
35  // <offTime, resulting quant>
36 std::pair<ReducedFraction, ReducedFraction>
38  const ReducedFraction &onTime,
39  const ReducedFraction &offTime,
40  const ReducedFraction &tupletLen,
41  const ReducedFraction &tupletRatio,
42  const ReducedFraction &rangeStart);
43 
44  // <offTime, resulting quant>
45 std::pair<ReducedFraction, ReducedFraction>
47  const std::pair<const ReducedFraction, MidiChord> &chord,
48  const ReducedFraction &offTime,
49  const ReducedFraction &basicQuant);
50 
51 ReducedFraction findMinQuantizedOnTime(
52  const std::pair<const ReducedFraction, MidiChord> &chord,
53  const ReducedFraction &basicQuant);
54 
55 ReducedFraction findMaxQuantizedTupletOffTime(
56  const std::pair<const ReducedFraction, MidiChord> &chord,
57  const ReducedFraction &tupletLen,
58  const ReducedFraction &tupletRatio,
59  const ReducedFraction &rangeStart);
60 
61 ReducedFraction findMaxQuantizedOffTime(
62  const std::pair<const ReducedFraction, MidiChord> &chord,
63  const ReducedFraction &basicQuant);
64 
65 ReducedFraction findOnTimeTupletQuantError(
66  const std::pair<const ReducedFraction, MidiChord> &chord,
67  const ReducedFraction &tupletLen,
68  const ReducedFraction &tupletRatio,
69  const ReducedFraction &rangeStart);
70 
71 ReducedFraction findOnTimeQuantError(
72  const std::pair<const ReducedFraction, MidiChord> &chord,
73  const ReducedFraction &basicQuant);
74 
75 ReducedFraction findOffTimeTupletQuantError(
76  const ReducedFraction &onTime,
77  const ReducedFraction &offTime,
78  const ReducedFraction &tupletLen,
79  const ReducedFraction &tupletRatio,
80  const ReducedFraction &rangeStart);
81 
82 ReducedFraction findOffTimeQuantError(
83  const std::pair<const ReducedFraction, MidiChord> &chord,
84  const ReducedFraction &offTime,
85  const ReducedFraction &basicQuant);
86 
88  const std::multimap<int, MTrack> &tracks,
89  TimeSigMap *sigmap);
90 
91 ReducedFraction quantizeValue(
92  const ReducedFraction &value,
93  const ReducedFraction &quant);
94 
95 ReducedFraction quantForLen(
96  const ReducedFraction &noteLen,
97  const ReducedFraction &basicQuant);
98 
99 ReducedFraction quantizeToLarge(
100  const ReducedFraction &time,
101  const ReducedFraction &quant);
102 
103 void quantizeChords(
104  std::multimap<ReducedFraction, MidiChord> &chords,
105  const TimeSigMap *sigmap,
106  const ReducedFraction &basicQuant);
107 
108 } // namespace Quantize
109 } // namespace Ms
110 
111 
112 #endif // IMPORTMIDI_QUANT_H
ReducedFraction findQuantForRange(const std::multimap< ReducedFraction, MidiChord >::const_iterator &beg, const std::multimap< ReducedFraction, MidiChord >::const_iterator &end, const ReducedFraction &basicQuant)
Definition: importmidi_quant.cpp:327
ReducedFraction quantizeValue(const ReducedFraction &value, const ReducedFraction &quant)
Definition: importmidi_quant.cpp:119
std::pair< ReducedFraction, ReducedFraction > findQuantizedNoteOffTime(const std::pair< const ReducedFraction, MidiChord > &chord, const ReducedFraction &offTime, const ReducedFraction &basicQuant)
Definition: importmidi_quant.cpp:220
ReducedFraction findOnTimeTupletQuantError(const std::pair< const ReducedFraction, MidiChord > &chord, const ReducedFraction &tupletLen, const ReducedFraction &tupletRatio, const ReducedFraction &rangeStart)
Definition: importmidi_quant.cpp:287
QuantValue
Definition: importmidi_operation.h:16
ReducedFraction findMaxQuantizedOffTime(const std::pair< const ReducedFraction, MidiChord > &chord, const ReducedFraction &basicQuant)
Definition: importmidi_quant.cpp:274
ReducedFraction findMaxQuantizedTupletOffTime(const std::pair< const ReducedFraction, MidiChord > &chord, const ReducedFraction &tupletLen, const ReducedFraction &tupletRatio, const ReducedFraction &rangeStart)
Definition: importmidi_quant.cpp:256
MidiOperations::QuantValue fractionToQuantValue(const ReducedFraction &fraction)
Definition: importmidi_quant.cpp:55
ReducedFraction findQuantizedTupletChordOnTime(const std::pair< const ReducedFraction, MidiChord > &chord, const ReducedFraction &tupletLen, const ReducedFraction &tupletRatio, const ReducedFraction &rangeStart)
Definition: importmidi_quant.cpp:171
ReducedFraction findOffTimeTupletQuantError(const ReducedFraction &onTime, const ReducedFraction &offTime, const ReducedFraction &tupletLen, const ReducedFraction &tupletRatio, const ReducedFraction &rangeStart)
Definition: importmidi_quant.cpp:306
void setIfHumanPerformance(const std::multimap< int, MTrack > &tracks, TimeSigMap *sigmap)
Definition: importmidi_quant.cpp:392
void quantizeChords(std::multimap< ReducedFraction, MidiChord > &chords, const TimeSigMap *sigmap, const ReducedFraction &basicQuant)
Definition: importmidi_quant.cpp:1399
Definition: aeolus.cpp:26
ReducedFraction findQuantizedChordOnTime(const std::pair< const ReducedFraction, MidiChord > &chord, const ReducedFraction &basicQuant)
Definition: importmidi_quant.cpp:183
ReducedFraction quantForLen(const ReducedFraction &noteLen, const ReducedFraction &basicQuant)
Definition: importmidi_quant.cpp:131
ReducedFraction findMinQuantizedOnTime(const std::pair< const ReducedFraction, MidiChord > &chord, const ReducedFraction &basicQuant)
Definition: importmidi_quant.cpp:242
ReducedFraction findOffTimeQuantError(const std::pair< const ReducedFraction, MidiChord > &chord, const ReducedFraction &offTime, const ReducedFraction &basicQuant)
Definition: importmidi_quant.cpp:318
MidiOperations::QuantValue defaultQuantValueFromPreferences()
Definition: importmidi_quant.cpp:81
ReducedFraction quantizeToLarge(const ReducedFraction &time, const ReducedFraction &quant)
Definition: importmidi_quant.cpp:748
ReducedFraction findOnTimeQuantError(const std::pair< const ReducedFraction, MidiChord > &chord, const ReducedFraction &basicQuant)
Definition: importmidi_quant.cpp:298
std::pair< ReducedFraction, ReducedFraction > findQuantizedTupletNoteOffTime(const ReducedFraction &onTime, const ReducedFraction &offTime, const ReducedFraction &tupletLen, const ReducedFraction &tupletRatio, const ReducedFraction &rangeStart)
Definition: importmidi_quant.cpp:192
ReducedFraction quantValueToFraction(MidiOperations::QuantValue quantValue)
Definition: importmidi_quant.cpp:23