From 62c25d50a632335bd5b7f4b515dd6ad9e466a573 Mon Sep 17 00:00:00 2001 From: casey langen Date: Tue, 7 Feb 2017 23:22:04 -0800 Subject: [PATCH] Make sure we notify remotes when shuffle status changes. --- src/core/audio/PlaybackService.cpp | 15 ++++++++++----- src/core/audio/PlaybackService.h | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/core/audio/PlaybackService.cpp b/src/core/audio/PlaybackService.cpp index 29c25a87b..cd6da8973 100755 --- a/src/core/audio/PlaybackService.cpp +++ b/src/core/audio/PlaybackService.cpp @@ -326,14 +326,11 @@ void PlaybackService::ProcessMessage(IMessage &message) { this->VolumeChanged(); } else if (type == MESSAGE_MODE_CHANGED) { - RepeatMode mode = this->repeatMode; - bool shuffled = this->IsShuffled(); - for (auto it = remotes.begin(); it != remotes.end(); it++) { - (*it)->OnModeChanged(repeatMode, shuffled); - } + this->NotifyRemotesModeChanged(); this->ModeChanged(); } else if (type == MESSAGE_SHUFFLED) { + this->NotifyRemotesModeChanged(); this->Shuffled(!!message.UserData1()); } else if (type == MESSAGE_TIME_CHANGED) { @@ -344,6 +341,14 @@ void PlaybackService::ProcessMessage(IMessage &message) { } } +void PlaybackService::NotifyRemotesModeChanged() { + RepeatMode mode = this->repeatMode; + bool shuffled = this->IsShuffled(); + for (auto it = remotes.begin(); it != remotes.end(); it++) { + (*it)->OnModeChanged(repeatMode, shuffled); + } +} + void PlaybackService::OnTrackChanged(size_t pos, TrackPtr track) { this->playingTrack = track; this->TrackChanged(this->index, track); diff --git a/src/core/audio/PlaybackService.h b/src/core/audio/PlaybackService.h index 1b4f2314a..efec8e115 100755 --- a/src/core/audio/PlaybackService.h +++ b/src/core/audio/PlaybackService.h @@ -167,6 +167,7 @@ namespace musik { namespace core { namespace audio { void OnTrackChanged(size_t pos, musik::core::TrackPtr track); void OnVolumeChanged(); void OnTimeChanged(double time); + void NotifyRemotesModeChanged(); void PrepareNextTrack(); void InitRemotes(); void ResetRemotes();