From d9516cd47d23cbb99f34fdb24a3b40ba682b8dc3 Mon Sep 17 00:00:00 2001 From: jeetee Date: Wed, 15 Apr 2020 00:18:05 +0200 Subject: [PATCH] resolves #22 - adjust tempo to reference beat --- TempoChanges.qml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/TempoChanges.qml b/TempoChanges.qml index 9717f23..4148b24 100644 --- a/TempoChanges.qml +++ b/TempoChanges.qml @@ -23,6 +23,7 @@ MuseScore { requiresScore: true property int margin: 10 + property int previousBeatIndex: 5 width: 360 height: 240 @@ -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 {