Skip to content
Snippets Groups Projects
Commit 856dc3b1 authored by SeeLook's avatar SeeLook
Browse files

Don't add ties when there is a rest

parent 0fe8949c
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@ OS2Version: 3
OS2_WeightWidthSlopeOnly: 0
OS2_UseTypoMetrics: 0
CreationTime: 1461314537
ModificationTime: 1488791707
ModificationTime: 1488792473
PfmFamily: 81
TTFWeight: 400
TTFWidth: 5
......@@ -47674,18 +47674,19 @@ StartChar: uniE204
Encoding: 57860 57860 959
Width: 365
Flags: W
HStem: -234 51<99.1636 271.767>
HStem: 5 51<99.1636 271.767>
LayerCount: 2
Fore
SplineSet
0 -326 m 5
32 -231 110 -183 187 -183 c 4
262 -183 336 -230 365 -326 c 5
361 -326 l 5
331 -265 259 -234 186 -234 c 4
113 -234 39 -265 4 -326 c 5
0 -326 l 5
0 -87 m 5
32 8 110 56 187 56 c 4
262 56 336 9 365 -87 c 5
361 -87 l 5
331 -26 259 5 186 5 c 4
113 5 39 -26 4 -87 c 5
0 -87 l 5
EndSplineSet
Validated: 1
EndChar
EndChars
EndSplineFont
......@@ -119,6 +119,8 @@ void solveList(const Tnote& n, int dur, QList<Tnote>& outList) {
void TscoreObject::addNote(const Tnote& n) {
CHECKTIME (
qDebug() << "Note" << n.toText() << n.rtm.string();
auto lastMeasure = m_measures.last();
if (lastMeasure->free() == 0) { // new measure is needed
lastMeasure = new TmeasureObject(m_measures.count(), this);
......@@ -135,9 +137,11 @@ CHECKTIME (
if (notesToCurrent.isEmpty())
qDebug() << "[TscoreObject] can't resolve duration of" << lastMeasure->free();
else {
if (!n.isRest()) {
notesToCurrent.first().rtm.setTie(Trhythm::e_tieStart);
if (notesToCurrent.count() == 2)
notesToCurrent.last().rtm.setTie(Trhythm::e_tieCont);
}
appendNoteList(notesToCurrent);
lastMeasure->appendNewNotes(lastNoteId, notesToCurrent.count());
}
......@@ -148,12 +152,14 @@ CHECKTIME (
if (notesToNext.isEmpty())
qDebug() << "[TscoreObject] can't resolve duration" << leftDuration;
else {
if (!n.isRest()) {
if (notesToNext.count() == 1)
notesToNext.first().rtm.setTie(Trhythm::e_tieEnd);
else {
notesToNext.first().rtm.setTie(Trhythm::e_tieCont);
notesToNext.last().rtm.setTie(Trhythm::e_tieEnd);
}
}
appendNoteList(notesToNext);
auto newLastMeasure = new TmeasureObject(m_measures.count(), this); // add a new measure
m_measures << newLastMeasure;
......
......@@ -132,6 +132,7 @@ public:
int groupCount() { return m_meterGroups.count(); }
QList<Tnote>& notes();
int notesCount() { return m_notes.count(); }
signals:
void meterChanged();
......
......@@ -119,12 +119,13 @@ ApplicationWindow {
// }
// }
function randNotes() {
var rest = false //(Math.random() * 100) % 6 > 4
var rest = (Math.random() * 100) > 90
// var accid = rest ? 0 : Math.min(Math.max(-2, -3 + Math.random() * 6), 2)
var accid = rest ? 0 : Math.min(Math.floor(Math.random() * 2), 1)
var note = rest ? 0 : 1 + Math.random() * 7
var octave = -2 + Math.random() * 5
score.addNote(Noo.note(note, octave, accid, 2 + Math.random() * 4, rest))
var rtm = /*Math.random() * 100 > 50 ? 4 : 5 */ 2 + Math.random() * 4
score.addNote(Noo.note(note, octave, accid, rtm, rest))
// var noteNr = Math.random() * 7
// var rest = Math.floor((Math.random() * 100) % 2)
// var note = Noo.note(1 + Math.random() * 7, -3 + Math.random() * 7, accid, 1 + Math.random() * 5, rest)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment