|
|
@ -37,7 +37,7 @@ using std::cout;
|
|
|
|
using std::cerr;
|
|
|
|
using std::cerr;
|
|
|
|
using std::endl;
|
|
|
|
using std::endl;
|
|
|
|
|
|
|
|
|
|
|
|
//#define DEBUG_NOTATION_TQUANTIZER 1
|
|
|
|
//#define DEBUG_NOTATION_QUANTIZER 1
|
|
|
|
|
|
|
|
|
|
|
|
namespace Rosegarden {
|
|
|
|
namespace Rosegarden {
|
|
|
|
|
|
|
|
|
|
|
@ -83,7 +83,7 @@ public:
|
|
|
|
}
|
|
|
|
}
|
|
|
|
virtual timeT getQuantizedAbsoluteTime(const Event *e) const {
|
|
|
|
virtual timeT getQuantizedAbsoluteTime(const Event *e) const {
|
|
|
|
timeT t = m_impl->getProvisional((Event *)e, AbsoluteTimeValue);
|
|
|
|
timeT t = m_impl->getProvisional((Event *)e, AbsoluteTimeValue);
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "ProvisionalQuantizer::getQuantizedAbsoluteTime: returning " << t << endl;
|
|
|
|
cout << "ProvisionalQuantizer::getQuantizedAbsoluteTime: returning " << t << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
return t;
|
|
|
|
return t;
|
|
|
@ -295,7 +295,7 @@ NotationQuantizer::Impl::quantizeAbsoluteTime(Segment *s, Segment::iterator i) c
|
|
|
|
long bestScore = 0;
|
|
|
|
long bestScore = 0;
|
|
|
|
bool bestRight = false;
|
|
|
|
bool bestRight = false;
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "quantizeAbsoluteTime: t is " << t << ", d is " << d << endl;
|
|
|
|
cout << "quantizeAbsoluteTime: t is " << t << ", d is " << d << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
@ -321,7 +321,7 @@ NotationQuantizer::Impl::quantizeAbsoluteTime(Segment *s, Segment::iterator i) c
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
if (n != s->end() && n != nprime) {
|
|
|
|
if (n != s->end() && n != nprime) {
|
|
|
|
cout << "found n (distinct from nprime) at " << (*n)->getAbsoluteTime() << endl;
|
|
|
|
cout << "found n (distinct from nprime) at " << (*n)->getAbsoluteTime() << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -340,7 +340,7 @@ NotationQuantizer::Impl::quantizeAbsoluteTime(Segment *s, Segment::iterator i) c
|
|
|
|
t, d, noteType, n, nprime, right);
|
|
|
|
t, d, noteType, n, nprime, right);
|
|
|
|
|
|
|
|
|
|
|
|
if (depth == 0 || score < bestScore) {
|
|
|
|
if (depth == 0 || score < bestScore) {
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << " [*]";
|
|
|
|
cout << " [*]";
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
bestBase = base;
|
|
|
|
bestBase = base;
|
|
|
@ -348,13 +348,13 @@ NotationQuantizer::Impl::quantizeAbsoluteTime(Segment *s, Segment::iterator i) c
|
|
|
|
bestRight = right;
|
|
|
|
bestRight = right;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << endl;
|
|
|
|
cout << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (bestBase == -2) {
|
|
|
|
if (bestBase == -2) {
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "Quantizer::quantizeAbsoluteTime: weirdness: no snap found" << endl;
|
|
|
|
cout << "Quantizer::quantizeAbsoluteTime: weirdness: no snap found" << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -373,7 +373,7 @@ NotationQuantizer::Impl::quantizeAbsoluteTime(Segment *s, Segment::iterator i) c
|
|
|
|
|
|
|
|
|
|
|
|
t += sigTime;
|
|
|
|
t += sigTime;
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "snap base is " << bestBase << ", snapped to " << t << endl;
|
|
|
|
cout << "snap base is " << bestBase << ", snapped to " << t << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -457,7 +457,7 @@ NotationQuantizer::Impl::scoreAbsoluteTimeForBase(Segment *s,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << " depth/eff/dist/t/score/pen1/pen2/res: " << depth << "/" << effectiveDepth << "/" << distance << "/" << (right ? t + distance : t - distance) << "/" << score << "/" << penalty1 << "/" << penalty2 << "/" << (score * penalty1 * penalty2);
|
|
|
|
cout << " depth/eff/dist/t/score/pen1/pen2/res: " << depth << "/" << effectiveDepth << "/" << distance << "/" << (right ? t + distance : t - distance) << "/" << score << "/" << penalty1 << "/" << penalty2 << "/" << (score * penalty1 * penalty2);
|
|
|
|
if (right) cout << " -> ";
|
|
|
|
if (right) cout << " -> ";
|
|
|
|
else cout << " <- ";
|
|
|
|
else cout << " <- ";
|
|
|
@ -553,7 +553,7 @@ NotationQuantizer::Impl::quantizeDuration(Segment *s, Chord &c) const
|
|
|
|
|
|
|
|
|
|
|
|
Profiler profiler("NotationQuantizer::Impl::quantizeDuration");
|
|
|
|
Profiler profiler("NotationQuantizer::Impl::quantizeDuration");
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "quantizeDuration: chord has " << c.size() << " notes" << endl;
|
|
|
|
cout << "quantizeDuration: chord has " << c.size() << " notes" << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
@ -584,7 +584,7 @@ NotationQuantizer::Impl::quantizeDuration(Segment *s, Chord &c) const
|
|
|
|
if ((**ci)->has(m_provisionalDuration) &&
|
|
|
|
if ((**ci)->has(m_provisionalDuration) &&
|
|
|
|
(**ci)->has(BEAMED_GROUP_TUPLET_BASE)) {
|
|
|
|
(**ci)->has(BEAMED_GROUP_TUPLET_BASE)) {
|
|
|
|
// dealt with already in tuplet code, we'd only mess it up here
|
|
|
|
// dealt with already in tuplet code, we'd only mess it up here
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "not recalculating duration for tuplet" << endl;
|
|
|
|
cout << "not recalculating duration for tuplet" << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
@ -595,7 +595,7 @@ NotationQuantizer::Impl::quantizeDuration(Segment *s, Chord &c) const
|
|
|
|
if (!m_contrapuntal) {
|
|
|
|
if (!m_contrapuntal) {
|
|
|
|
// if not contrapuntal, give all notes in chord equal duration
|
|
|
|
// if not contrapuntal, give all notes in chord equal duration
|
|
|
|
if (nonContrapuntalDuration > 0) {
|
|
|
|
if (nonContrapuntalDuration > 0) {
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "setting duration trivially to " << nonContrapuntalDuration << endl;
|
|
|
|
cout << "setting duration trivially to " << nonContrapuntalDuration << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
setProvisional(**ci, DurationValue, nonContrapuntalDuration);
|
|
|
|
setProvisional(**ci, DurationValue, nonContrapuntalDuration);
|
|
|
@ -613,7 +613,7 @@ NotationQuantizer::Impl::quantizeDuration(Segment *s, Chord &c) const
|
|
|
|
|
|
|
|
|
|
|
|
timeT qt = getProvisional(**ci, AbsoluteTimeValue);
|
|
|
|
timeT qt = getProvisional(**ci, AbsoluteTimeValue);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "note at time " << (**ci)->getAbsoluteTime() << " (provisional time " << qt << ")" << endl;
|
|
|
|
cout << "note at time " << (**ci)->getAbsoluteTime() << " (provisional time " << qt << ")" << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
@ -626,7 +626,7 @@ NotationQuantizer::Impl::quantizeDuration(Segment *s, Chord &c) const
|
|
|
|
base /= divisions[depth];
|
|
|
|
base /= divisions[depth];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "duration is " << ud << ", probably between "
|
|
|
|
cout << "duration is " << ud << ", probably between "
|
|
|
|
<< bases.first << " and " << bases.second << endl;
|
|
|
|
<< bases.first << " and " << bases.second << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -645,7 +645,7 @@ NotationQuantizer::Impl::quantizeDuration(Segment *s, Chord &c) const
|
|
|
|
|
|
|
|
|
|
|
|
qd = Note::getNearestNote(spaceAvailable).getDuration();
|
|
|
|
qd = Note::getNearestNote(spaceAvailable).getDuration();
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "non-contrapuntal segment, rounded duration down to "
|
|
|
|
cout << "non-contrapuntal segment, rounded duration down to "
|
|
|
|
<< qd << " (as only " << spaceAvailable << " available)"
|
|
|
|
<< qd << " (as only " << spaceAvailable << " available)"
|
|
|
|
<< endl;
|
|
|
|
<< endl;
|
|
|
@ -675,7 +675,7 @@ NotationQuantizer::Impl::quantizeDuration(Segment *s, Chord &c) const
|
|
|
|
bases.second == absTimeBase) {
|
|
|
|
bases.second == absTimeBase) {
|
|
|
|
|
|
|
|
|
|
|
|
if (nextNoteTime >= qt + bases.second) {
|
|
|
|
if (nextNoteTime >= qt + bases.second) {
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "We rounded to " << qd
|
|
|
|
cout << "We rounded to " << qd
|
|
|
|
<< " but we're on " << absTimeBase << " absTimeBase"
|
|
|
|
<< " but we're on " << absTimeBase << " absTimeBase"
|
|
|
|
<< " and the next base is " << bases.second
|
|
|
|
<< " and the next base is " << bases.second
|
|
|
@ -699,14 +699,14 @@ NotationQuantizer::Impl::quantizeDuration(Segment *s, Chord &c) const
|
|
|
|
if (note.getNoteType() < Note::Longest) {
|
|
|
|
if (note.getNoteType() < Note::Longest) {
|
|
|
|
|
|
|
|
|
|
|
|
if (bases.second <= spaceAvailable) {
|
|
|
|
if (bases.second <= spaceAvailable) {
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "We rounded down to " << qd
|
|
|
|
cout << "We rounded down to " << qd
|
|
|
|
<< " but have room for " << bases.second
|
|
|
|
<< " but have room for " << bases.second
|
|
|
|
<< ", rounding up again" << endl;
|
|
|
|
<< ", rounding up again" << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
qd = bases.second;
|
|
|
|
qd = bases.second;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "We rounded down to " << qd
|
|
|
|
cout << "We rounded down to " << qd
|
|
|
|
<< "; can't fit " << bases.second << endl;
|
|
|
|
<< "; can't fit " << bases.second << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -720,7 +720,7 @@ NotationQuantizer::Impl::quantizeDuration(Segment *s, Chord &c) const
|
|
|
|
if (!m_contrapuntal) nonContrapuntalDuration = qd;
|
|
|
|
if (!m_contrapuntal) nonContrapuntalDuration = qd;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "totalFrac " << totalFrac << ", totalFracCount " << totalFracCount << ", avg " << (totalFracCount > 0 ? (totalFrac / totalFracCount) : 0) << endl;
|
|
|
|
cout << "totalFrac " << totalFrac << ", totalFracCount " << totalFracCount << ", avg " << (totalFracCount > 0 ? (totalFrac / totalFracCount) : 0) << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -746,7 +746,7 @@ NotationQuantizer::Impl::scanTupletsInBar(Segment *s,
|
|
|
|
if (depth >= 0) base /= divisions[depth];
|
|
|
|
if (depth >= 0) base /= divisions[depth];
|
|
|
|
if (base <= Note(Note::Semiquaver).getDuration()) break;
|
|
|
|
if (base <= Note(Note::Semiquaver).getDuration()) break;
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "\nscanTupletsInBar: trying at depth " << depth << " (base " << base << ")" << endl;
|
|
|
|
cout << "\nscanTupletsInBar: trying at depth " << depth << " (base " << base << ")" << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
@ -766,7 +766,7 @@ NotationQuantizer::Impl::scanTupletsInBar(Segment *s,
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "scanTupletsInBar: testing " << tupletStart << "," << base << " at tuplet base " << tupletBase << endl;
|
|
|
|
cout << "scanTupletsInBar: testing " << tupletStart << "," << base << " at tuplet base " << tupletBase << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
@ -786,7 +786,7 @@ NotationQuantizer::Impl::scanTupletsInBar(Segment *s,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (jTime >= tupletEnd) { // nothing to make tuplets of
|
|
|
|
if (jTime >= tupletEnd) { // nothing to make tuplets of
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "scanTupletsInBar: nothing here" << endl;
|
|
|
|
cout << "scanTupletsInBar: nothing here" << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
tupletStart = tupletEnd;
|
|
|
|
tupletStart = tupletEnd;
|
|
|
@ -827,14 +827,14 @@ NotationQuantizer::Impl::scanTupletsAt(Segment *s,
|
|
|
|
|
|
|
|
|
|
|
|
if (!(*j)->isa(Note::EventType)) { ++j; continue; }
|
|
|
|
if (!(*j)->isa(Note::EventType)) { ++j; continue; }
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "scanTupletsAt time " << jTime << " (unquantized "
|
|
|
|
cout << "scanTupletsAt time " << jTime << " (unquantized "
|
|
|
|
<< (*j)->getAbsoluteTime() << "), found note" << endl;
|
|
|
|
<< (*j)->getAbsoluteTime() << "), found note" << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// reject any group containing anything already a tuplet
|
|
|
|
// reject any group containing anything already a tuplet
|
|
|
|
if ((*j)->has(BEAMED_GROUP_TUPLET_BASE)) {
|
|
|
|
if ((*j)->has(BEAMED_GROUP_TUPLET_BASE)) {
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "already made tuplet here" << endl;
|
|
|
|
cout << "already made tuplet here" << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -843,19 +843,19 @@ NotationQuantizer::Impl::scanTupletsAt(Segment *s,
|
|
|
|
timeT originalBase;
|
|
|
|
timeT originalBase;
|
|
|
|
|
|
|
|
|
|
|
|
if (!(*j)->get<Int>(m_provisionalBase, originalBase)) {
|
|
|
|
if (!(*j)->get<Int>(m_provisionalBase, originalBase)) {
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "some notes not provisionally quantized, no good" << endl;
|
|
|
|
cout << "some notes not provisionally quantized, no good" << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (originalBase == base) {
|
|
|
|
if (originalBase == base) {
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "accepting note at original base" << endl;
|
|
|
|
cout << "accepting note at original base" << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
candidates.push_back(*j);
|
|
|
|
candidates.push_back(*j);
|
|
|
|
} else if (((jTime - sigTime) % base) == 0) {
|
|
|
|
} else if (((jTime - sigTime) % base) == 0) {
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "accepting note that happens to lie on original base" << endl;
|
|
|
|
cout << "accepting note that happens to lie on original base" << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
candidates.push_back(*j);
|
|
|
|
candidates.push_back(*j);
|
|
|
@ -867,7 +867,7 @@ NotationQuantizer::Impl::scanTupletsAt(Segment *s,
|
|
|
|
// any of the likelihood tests for tuplets.
|
|
|
|
// any of the likelihood tests for tuplets.
|
|
|
|
|
|
|
|
|
|
|
|
if (!isValidTupletAt(s, j, depth, base, sigTime, tupletBase)) {
|
|
|
|
if (!isValidTupletAt(s, j, depth, base, sigTime, tupletBase)) {
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "no good" << endl;
|
|
|
|
cout << "no good" << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -883,13 +883,13 @@ NotationQuantizer::Impl::scanTupletsAt(Segment *s,
|
|
|
|
// must have at least one note that is not already quantized to the
|
|
|
|
// must have at least one note that is not already quantized to the
|
|
|
|
// original base
|
|
|
|
// original base
|
|
|
|
if (count < 1) {
|
|
|
|
if (count < 1) {
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "scanTupletsAt: found no note not already quantized to " << base << endl;
|
|
|
|
cout << "scanTupletsAt: found no note not already quantized to " << base << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "scanTupletsAt: Tuplet group of duration " << base << " starting at " << tupletStart << endl;
|
|
|
|
cout << "scanTupletsAt: Tuplet group of duration " << base << " starting at " << tupletStart << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
@ -970,7 +970,7 @@ NotationQuantizer::Impl::isValidTupletAt(Segment *s,
|
|
|
|
timeT ud = m_q->getFromSource(*i, DurationValue);
|
|
|
|
timeT ud = m_q->getFromSource(*i, DurationValue);
|
|
|
|
|
|
|
|
|
|
|
|
if (ud > (tupletBase * 5 / 4)) {
|
|
|
|
if (ud > (tupletBase * 5 / 4)) {
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "\nNotationQuantizer::isValidTupletAt: note too long at "
|
|
|
|
cout << "\nNotationQuantizer::isValidTupletAt: note too long at "
|
|
|
|
<< (*i)->getDuration() << " (tupletBase is " << tupletBase << ")"
|
|
|
|
<< (*i)->getDuration() << " (tupletBase is " << tupletBase << ")"
|
|
|
|
<< endl;
|
|
|
|
<< endl;
|
|
|
@ -981,7 +981,7 @@ NotationQuantizer::Impl::isValidTupletAt(Segment *s,
|
|
|
|
//!!! This bit is a cop-out. It means we reject anything that looks
|
|
|
|
//!!! This bit is a cop-out. It means we reject anything that looks
|
|
|
|
// like it's going to have rests in it. Bah.
|
|
|
|
// like it's going to have rests in it. Bah.
|
|
|
|
if (ud <= (tupletBase * 3 / 8)) {
|
|
|
|
if (ud <= (tupletBase * 3 / 8)) {
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "\nNotationQuantizer::isValidTupletAt: note too short at "
|
|
|
|
cout << "\nNotationQuantizer::isValidTupletAt: note too short at "
|
|
|
|
<< (*i)->getDuration() << " (tupletBase is " << tupletBase << ")"
|
|
|
|
<< (*i)->getDuration() << " (tupletBase is " << tupletBase << ")"
|
|
|
|
<< endl;
|
|
|
|
<< endl;
|
|
|
@ -1000,7 +1000,7 @@ NotationQuantizer::Impl::isValidTupletAt(Segment *s,
|
|
|
|
bool dummy;
|
|
|
|
bool dummy;
|
|
|
|
long tupletScore = scoreAbsoluteTimeForBase
|
|
|
|
long tupletScore = scoreAbsoluteTimeForBase
|
|
|
|
(s, i, depth, tupletBase, sigTime, t, d, noteType, s->end(), s->end(), dummy);
|
|
|
|
(s, i, depth, tupletBase, sigTime, t, d, noteType, s->end(), s->end(), dummy);
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "\nNotationQuantizer::isValidTupletAt: score " << score
|
|
|
|
cout << "\nNotationQuantizer::isValidTupletAt: score " << score
|
|
|
|
<< " vs tupletScore " << tupletScore << endl;
|
|
|
|
<< " vs tupletScore " << tupletScore << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -1027,7 +1027,7 @@ NotationQuantizer::Impl::quantizeRange(Segment *s,
|
|
|
|
int events = 0, notes = 0, passes = 0;
|
|
|
|
int events = 0, notes = 0, passes = 0;
|
|
|
|
int setGood = 0, setBad = 0;
|
|
|
|
int setGood = 0, setBad = 0;
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "NotationQuantizer::Impl::quantizeRange: from time "
|
|
|
|
cout << "NotationQuantizer::Impl::quantizeRange: from time "
|
|
|
|
<< (from == s->end() ? -1 : (*from)->getAbsoluteTime())
|
|
|
|
<< (from == s->end() ? -1 : (*from)->getAbsoluteTime())
|
|
|
|
<< " to "
|
|
|
|
<< " to "
|
|
|
@ -1177,7 +1177,7 @@ NotationQuantizer::Impl::quantizeRange(Segment *s,
|
|
|
|
(*i)->getDuration() == d) ++setBad;
|
|
|
|
(*i)->getDuration() == d) ++setBad;
|
|
|
|
else ++setGood;
|
|
|
|
else ++setGood;
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_NOTATION_TQUANTIZER
|
|
|
|
#ifdef DEBUG_NOTATION_QUANTIZER
|
|
|
|
cout << "Setting to target at " << t << "," << d << endl;
|
|
|
|
cout << "Setting to target at " << t << "," << d << endl;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|