Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions src/private/mx/impl/DirectionWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,11 @@ void DirectionWriter::emitTempo(const api::TempoData &tempo, core::Direction &di
return;
}

if (tempo.isParenthetical != api::Bool::unspecified)
{
metronome.setParentheses(myConverter.convert(tempo.isParenthetical));
}

core::DirectionType dt{};
dt.setChoice(core::DirectionTypeChoice::metronome(metronome));
addDirectionType(std::move(dt), direction);
Expand Down
6 changes: 6 additions & 0 deletions src/private/mx/impl/MetronomeReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ api::TempoData MetronomeReader::getTempoData() const
myOutTempoData = api::TempoData{};
// the old core's beatUnitPer is the new core's group; the old core's
// noteRelationNote (metronome-note based) is group2
if (myMetronome.parentheses().has_value())
{
Converter converter;
myOutTempoData.isParenthetical = converter.convert(*myMetronome.parentheses());
}

using FirstChoice = core::MetronomeChoice::Kind;
const auto firstChoice = myBeatUnitPerOrNoteRelationNoteChoice.kind();

Expand Down
29 changes: 29 additions & 0 deletions src/private/mxtest/api/MetronomeApiTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,33 @@ TEST(roundTripMetricModulation, MetronomeApi)

T_END

TEST(roundTripParentheses, MetronomeApi)
{
// <metronome parentheses="yes"> must round-trip via TempoData::isParenthetical.
ScoreData score;
score.ticksPerQuarter = 100;
score.parts.emplace_back();
auto &part = score.parts.back();
part.measures.emplace_back();
auto &measure = part.measures.back();
measure.staves.emplace_back();
auto &staff = measure.staves.back();
staff.directions.emplace_back();
auto &direction = staff.directions.back();
direction.tempos.emplace_back();
auto &tempo = direction.tempos.back();
tempo.tempoType = TempoType::beatsPerMinute;
tempo.isParenthetical = Bool::yes;
tempo.beatsPerMinute.durationName = DurationName::quarter;
tempo.beatsPerMinute.beatsPerMinute = 100;

auto actualScoreData = roundTrip(score);

const auto &actualTempo =
actualScoreData.parts.back().measures.back().staves.back().directions.back().tempos.back();
CHECK(actualTempo.isParenthetical == Bool::yes);
}

T_END

#endif
5 changes: 5 additions & 0 deletions src/private/mxtest/api/roundtrip-baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -414,3 +414,8 @@ synthetic/non-arpeggiate.3.1.xml
ksuite/k001a_Articulations.xml
musuite/testNoteAttributes2.xml
musuite/testNoteAttributes2_ref.xml

# Unblocked by wiring TempoData::isParenthetical: the metronome parentheses
# attribute now round-trips.
lysuite/ly31c_MetronomeMarks.xml
musuite/testTempo1.xml
Loading