Skip to content

Commit

Permalink
beatToMilliseconds uses played ticks
Browse files Browse the repository at this point in the history
  • Loading branch information
22justinl committed Jul 27, 2024
1 parent d910ca8 commit 5fd330f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/notation/internal/notationactioncontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ void NotationActionController::move(MoveDirection direction, bool quickly)

audio::secs_t targetSec = playbackController()->beatToSecs(targetMeasureIdx, targetBeatIdx);
playbackController()->seek(targetSec);
break;
return;
}

if (selectedElement && selectedElement->isTextBase()) {
Expand Down
9 changes: 8 additions & 1 deletion src/playback/internal/playbackcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,14 @@ MeasureBeat PlaybackController::currentBeat() const

msecs_t PlaybackController::beatToMilliseconds(int measureIndex, int beatIndex) const
{
return notationPlayback() ? playedTickToMsecs(notationPlayback()->beatToRawTick(measureIndex, beatIndex)) : 0;
if (!notationPlayback()) {
return 0;
}

muse::midi::tick_t rawTick = notationPlayback()->beatToRawTick(measureIndex, beatIndex);
muse::midi::tick_t playedTick = notationPlayback()->playPositionTickByRawTick(rawTick).val;

return playedTickToMsecs(playedTick);
}

secs_t PlaybackController::beatToSecs(int measureIndex, int beatIndex) const
Expand Down

0 comments on commit 5fd330f

Please sign in to comment.