From 2a2688f1bf9bdb125aaf0bdf5d9304571b48d236 Mon Sep 17 00:00:00 2001 From: casey langen Date: Fri, 14 Jul 2017 19:13:18 -0700 Subject: [PATCH] Small bug fix for HotSwap behavior, version bump, release notes. --- CHANGELOG.txt | 13 +++++++++ CMakeLists.txt | 4 +-- src/core/audio/PlaybackService.cpp | 45 ++++++++++++++++-------------- src/musikbox/app/util/Version.h | 6 ++-- 4 files changed, 42 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ba977337e..8a8c5c906 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,16 @@ +0.20.0 + +* added play queue "hot-swap". you can now swap a different list of tracks + into an active play queue without disrupting playback. if the hot-swap + action finds the playing track in the new list, it'll be automatically + selected as the active track +* fixed a bug that was causing extended track metadata to be parsed incorrectly + examples include bitrate, channels, lyrics, etc. +* fixed a bug where the category list view may jump around a bit during the + indexing process + +-------------------------------------------------------------------------------- + 0.19.2 * start the metadata indexer immediately after adding or removing paths from diff --git a/CMakeLists.txt b/CMakeLists.txt index c4a06c022..365f920c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,8 +7,8 @@ cmake_minimum_required(VERSION 3.0) project(musikbox) set (musikbox_VERSION_MAJOR 0) -set (musikbox_VERSION_MINOR 19) -set (musikbox_VERSION_PATCH 2) +set (musikbox_VERSION_MINOR 20) +set (musikbox_VERSION_PATCH 0) set (musikbox_VERSION "${musikbox_VERSION_MAJOR}.${musikbox_VERSION_MINOR}.${musikbox_VERSION_PATCH}") include(CMakeToolsHelpers OPTIONAL) diff --git a/src/core/audio/PlaybackService.cpp b/src/core/audio/PlaybackService.cpp index 3e50fb561..563019ef9 100755 --- a/src/core/audio/PlaybackService.cpp +++ b/src/core/audio/PlaybackService.cpp @@ -467,12 +467,15 @@ PlaybackState PlaybackService::GetPlaybackState() { } bool PlaybackService::HotSwap(const TrackList& tracks, size_t index) { - bool swap = false; - if (&tracks == &playlist) { return true; } + if (!tracks.Count()) { + return false; + } + + bool found = false; auto playingTrack = this->GetPlaying(); if (playingTrack && tracks.Count() > index) { auto supplantTrack = tracks.Get(index); @@ -485,7 +488,7 @@ bool PlaybackService::HotSwap(const TrackList& tracks, size_t index) { /* look at the index hint, see if we can find a matching track without iteration. */ if (supplantId == playingId && supplantLibrary == playingLibrary) { - swap = true; + found = true; } /* otherwise search the input */ else { @@ -496,30 +499,29 @@ bool PlaybackService::HotSwap(const TrackList& tracks, size_t index) { if (supplantId == playingId && supplantLibrary == playingLibrary) { index = i; - swap = true; + found = true; } } } } - if (swap) { - { - std::unique_lock lock(this->playlistMutex); - TrackList temp(this->library); - temp.CopyFrom(tracks); - this->playlist.Swap(temp); - this->unshuffled.Clear(); - this->index = index; - this->nextIndex = NO_POSITION; - } - - POST(this, MESSAGE_PREPARE_NEXT_TRACK, this->index, 0); - POST(this, MESSAGE_NOTIFY_EDITED, NO_POSITION, 0); - - return true; + { + std::unique_lock lock(this->playlistMutex); + TrackList temp(this->library); + temp.CopyFrom(tracks); + this->playlist.Swap(temp); + this->unshuffled.Clear(); + this->index = found ? index : NO_POSITION; + this->nextIndex = NO_POSITION; } - return false; + if (found) { + POST(this, MESSAGE_PREPARE_NEXT_TRACK, this->index, 0); + } + + POST(this, MESSAGE_NOTIFY_EDITED, NO_POSITION, 0); + + return true; } void PlaybackService::Play(const TrackList& tracks, size_t index) { @@ -842,7 +844,8 @@ PlaybackService::Editor::~Editor() { if (this->edited) { /* we've been tracking the playback index through edit operations. let's update it here. */ - /* make sure the play index we're requesting is in bounds */ + + /* make sure the play index we're requesting is in bounds */ if (this->playIndex != this->playback.GetIndex() || this->nextTrackInvalidated) { if (this->playback.Count() > 0 && this->playIndex != NO_POSITION) { this->playIndex = std::min(this->playback.Count() - 1, this->playIndex); diff --git a/src/musikbox/app/util/Version.h b/src/musikbox/app/util/Version.h index e5e951693..590844002 100644 --- a/src/musikbox/app/util/Version.h +++ b/src/musikbox/app/util/Version.h @@ -1,6 +1,6 @@ #pragma once #define VERSION_MAJOR 0 -#define VERSION_MINOR 19 -#define VERSION_PATCH 2 -#define VERSION "0.19.2" +#define VERSION_MINOR 20 +#define VERSION_PATCH 0 +#define VERSION "0.20.0"