Skip to content

Commit

Permalink
resolves #1 handle non present start tempo marking
Browse files Browse the repository at this point in the history
  • Loading branch information
jeetee committed Apr 24, 2020
1 parent 8b43e97 commit 921039d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion TempoStretch.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import MuseScore 3.0

MuseScore {
menuPath: "Plugins.TempoStretch"
version: "1.0.0"
version: "1.1.0"
description: qsTr("Apply a % change to (selected) tempo markers")
pluginType: "dialog"
requiresScore: true
Expand Down Expand Up @@ -86,6 +86,18 @@ MuseScore {
}
startBPMvalue = Math.round(foundTempo.tempo * 60 * 10) / 10;;
}
else { // No tempo marking found, add one ourselves
curScore.startCmd();
var newTempo = newElement(Element.TEMPO_TEXT);
newTempo.text = beatBaseList[5].text.split('').join(' ') + ' = ' + startBPMvalue;
newTempo.followText = true;
newTempo.visible = false;
var cursor = curScore.newCursor();
cursor.rewind(Cursor.SCORE_START);
cursor.add(newTempo);
newTempo.tempo = startBPMvalue / 60; // Changing tempo is only possible after being added to the score
curScore.endCmd(false);
}
}

/// Analyses tempo marking text
Expand Down

0 comments on commit 921039d

Please sign in to comment.