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

Beats: Round positions to lower frame boundary on translate #4499

Merged
merged 2 commits into from
Nov 10, 2021
Merged
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
6 changes: 4 additions & 2 deletions src/track/beats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,12 +599,14 @@ std::optional<BeatsPointer> Beats::tryTranslate(audio::FrameDiff_t offsetFrames)
m_markers.cend(),
std::back_inserter(markers),
[offsetFrames](const BeatMarker& marker) -> BeatMarker {
return BeatMarker(marker.position() + offsetFrames,
const auto translatedPosition = marker.position() + offsetFrames;
return BeatMarker(translatedPosition.toLowerFrameBoundary(),
marker.beatsTillNextMarker());
});

const auto endMarkerPosition = m_endMarkerPosition + offsetFrames;
return BeatsPointer(new Beats(markers,
m_endMarkerPosition + offsetFrames,
endMarkerPosition.toLowerFrameBoundary(),
m_endMarkerBpm,
m_sampleRate,
m_subVersion));
Expand Down