Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #14678: Tempo set in New Score other than quarter note doesn't reflect supposed BPM #21458

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/notation/internal/masternotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,37 +413,48 @@ void MasterNotation::applyOptions(mu::engraving::MasterScore* score, const Score
QString text("<sym>metNoteQuarterUp</sym> = %1");
double bpm = scoreOptions.tempo.valueBpm;

double quarterNotesPerDuration = 1;

bool withDot = scoreOptions.tempo.withDot;
switch (scoreOptions.tempo.duration) {
case DurationType::V_WHOLE:
text = "<sym>metNoteWhole</sym> = %1";
quarterNotesPerDuration = 4;
break;
case DurationType::V_HALF:
if (withDot) {
text = "<sym>metNoteHalfUp</sym><sym>space</sym><sym>metAugmentationDot</sym> = %1";
quarterNotesPerDuration = 3;
} else {
text = "<sym>metNoteHalfUp</sym> = %1";
quarterNotesPerDuration = 2;
}
break;
case DurationType::V_QUARTER:
if (withDot) {
text = "<sym>metNoteQuarterUp</sym><sym>space</sym><sym>metAugmentationDot</sym> = %1";
quarterNotesPerDuration = 1.5;
} else {
text = "<sym>metNoteQuarterUp</sym> = %1";
quarterNotesPerDuration = 1;
}
break;
case DurationType::V_EIGHTH:
if (withDot) {
text = "<sym>metNote8thUp</sym><sym>space</sym><sym>metAugmentationDot</sym> = %1";
quarterNotesPerDuration = 0.75;
} else {
text = "<sym>metNote8thUp</sym> = %1";
quarterNotesPerDuration = 0.5;
}
break;
case DurationType::V_16TH:
if (withDot) {
text = "<sym>metNote16thUp</sym><sym>space</sym><sym>metAugmentationDot</sym> = %1";
quarterNotesPerDuration = 0.375;
} else {
text = "<sym>metNote16thUp</sym> = %1";
quarterNotesPerDuration = 0.25;
}
break;
default:
Expand All @@ -455,6 +466,7 @@ void MasterNotation::applyOptions(mu::engraving::MasterScore* score, const Score
tt->setXmlText(text.arg(bpm));

double tempo = scoreOptions.tempo.valueBpm;
tempo *= quarterNotesPerDuration; // setTempo expects a value in Quarter Notes Per Second
tempo /= 60; // bpm -> bps

tt->setTempo(tempo);
Expand Down