Skip to content

Commit

Permalink
fixed updating the playback loop after changing the global tempo value
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanPudashkin committed Aug 15, 2022
1 parent 3c71ec7 commit 2e59307
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 7 additions & 4 deletions src/playback/internal/playbackcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ void PlaybackController::onNotationChanged()
});

notationPlayback()->loopBoundariesChanged().onNotify(this, [this]() {
setLoop(notationPlayback()->loopBoundaries());
updateLoop();
});

m_notation->interaction()->selectionChanged().onNotify(this, [this]() {
Expand All @@ -345,7 +345,7 @@ void PlaybackController::onSelectionChanged()

if (!isRangeSelection) {
if (selectionTypeChanged) {
setLoop(notationPlayback()->loopBoundaries());
updateLoop();
updateMuteStates();
}

Expand Down Expand Up @@ -577,12 +577,14 @@ void PlaybackController::addLoopBoundaryToTick(LoopBoundaryType type, int tick)
}
}

void PlaybackController::setLoop(const LoopBoundaries& boundaries)
void PlaybackController::updateLoop()
{
IF_ASSERT_FAILED(playback()) {
IF_ASSERT_FAILED(notationPlayback() && playback()) {
return;
}

const LoopBoundaries& boundaries = notationPlayback()->loopBoundaries();

if (!boundaries.visible) {
hideLoop();
return;
Expand Down Expand Up @@ -1106,6 +1108,7 @@ void PlaybackController::setTempoMultiplier(double multiplier)

playback->setTempoMultiplier(multiplier);
seek(tick);
updateLoop();

if (playing) {
resume();
Expand Down
3 changes: 1 addition & 2 deletions src/playback/internal/playbackcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ class PlaybackController : public IPlaybackController, public actions::Actionabl

void addLoopBoundary(notation::LoopBoundaryType type);
void addLoopBoundaryToTick(notation::LoopBoundaryType type, int tick);

void setLoop(const notation::LoopBoundaries& boundaries);
void updateLoop();

void showLoop();
void hideLoop();
Expand Down

0 comments on commit 2e59307

Please sign in to comment.