Skip to content

Commit

Permalink
resolves #22 - adjust tempo to reference beat
Browse files Browse the repository at this point in the history
  • Loading branch information
jeetee committed Apr 14, 2020
1 parent 68ea23b commit d9516cd
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions TempoChanges.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ MuseScore {
requiresScore: true

property int margin: 10
property int previousBeatIndex: 5

width: 360
height: 240
Expand Down Expand Up @@ -386,6 +387,22 @@ MuseScore {
padding.top: 5
padding.bottom: 5
}
onCurrentIndexChanged: { // update the value fields to match the new beatBase
var changeFactor = beatBase.model.get(currentIndex).mult / beatBase.model.get(previousBeatIndex).mult;
if (startBPMvalue.text == "") {
startBPMvalue.placeholderText = Math.round(getFloatFromInput(startBPMvalue) / changeFactor * 10) / 10;
}
else {
startBPMvalue.text = Math.round(getFloatFromInput(startBPMvalue) / changeFactor * 10) / 10;
}
if (endBPMvalue.text == "") {
endBPMvalue.placeholderText = Math.round(getFloatFromInput(endBPMvalue) / changeFactor * 10) / 10;
}
else {
endBPMvalue.text = Math.round(getFloatFromInput(endBPMvalue) / changeFactor * 10) / 10;
}
previousBeatIndex = currentIndex; // keep track reference for next change
}
}

Label {
Expand Down

0 comments on commit d9516cd

Please sign in to comment.