Skip to content

Commit 89eb000

Browse files
Play from selection: show online sound errors
1 parent 3cc821f commit 89eb000

File tree

2 files changed

+25
-20
lines changed

2 files changed

+25
-20
lines changed

src/playback/internal/playbackcontroller.cpp

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ PlaybackController::PlaybackController()
9999
void PlaybackController::init()
100100
{
101101
dispatcher()->reg(this, PLAY_CODE, [this]() { PlaybackController::togglePlay(); });
102-
dispatcher()->reg(this, PLAY_FROM_SELECTION, this, &PlaybackController::playFromSelection);
102+
dispatcher()->reg(this, PLAY_FROM_SELECTION, [this]() { &PlaybackController::playFromSelection() });
103103
dispatcher()->reg(this, STOP_CODE, [this]() { PlaybackController::pause(/*select*/ false); });
104104
dispatcher()->reg(this, PAUSE_AND_SELECT_CODE, [this]() { PlaybackController::pause(/*select*/ true); });
105105
dispatcher()->reg(this, REWIND_CODE, this, &PlaybackController::rewind);
@@ -656,28 +656,14 @@ void PlaybackController::togglePlay(bool showErrors)
656656
}
657657
}
658658

659-
void PlaybackController::play()
659+
void PlaybackController::playFromSelection(bool showErrors)
660660
{
661-
IF_ASSERT_FAILED(currentPlayer()) {
661+
if (selection()->isNone()) {
662662
return;
663663
}
664664

665-
if (isLoopEnabled()) {
666-
secs_t startSecs = playbackStartSecs();
667-
seek(startSecs);
668-
}
669-
670-
secs_t delay = 0.;
671-
if (notationConfiguration()->isCountInEnabled()) {
672-
notationPlayback()->triggerCountIn(m_currentTick, delay);
673-
}
674-
675-
currentPlayer()->play(delay);
676-
}
677-
678-
void PlaybackController::playFromSelection()
679-
{
680-
if (selection()->isNone()) {
665+
if (showErrors && m_onlineSoundsController->shouldShowOnlineSoundsProcessingError(isPlaying())) {
666+
m_onlineSoundsController->showOnlineSoundsProcessingError([this]() { playFromSelection(false /*showErrors*/); });
681667
return;
682668
}
683669

@@ -707,6 +693,25 @@ void PlaybackController::playFromSelection()
707693
}
708694
}
709695

696+
void PlaybackController::play()
697+
{
698+
IF_ASSERT_FAILED(currentPlayer()) {
699+
return;
700+
}
701+
702+
if (isLoopEnabled()) {
703+
secs_t startSecs = playbackStartSecs();
704+
seek(startSecs);
705+
}
706+
707+
secs_t delay = 0.;
708+
if (notationConfiguration()->isCountInEnabled()) {
709+
notationPlayback()->triggerCountIn(m_currentTick, delay);
710+
}
711+
712+
currentPlayer()->play(delay);
713+
}
714+
710715
void PlaybackController::rewind(const ActionData& args)
711716
{
712717
secs_t startSecs = playbackStartSecs();

src/playback/internal/playbackcontroller.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ class PlaybackController : public IPlaybackController, public muse::actions::Act
168168
void addSoundFlagsIfNeed(const std::vector<engraving::EngravingItem*>& selection);
169169

170170
void togglePlay(bool showErrors = true);
171+
void playFromSelection(bool showErrors = true);
171172
void rewind(const muse::actions::ActionData& args);
172173
void play();
173-
void playFromSelection();
174174
void pause(bool select = false);
175175
void stop();
176176
void resume();

0 commit comments

Comments
 (0)