Small bug fix for HotSwap behavior, version bump, release notes.

This commit is contained in:
casey langen 2017-07-14 19:13:18 -07:00
parent 28806c4f77
commit 2a2688f1bf
4 changed files with 42 additions and 26 deletions

View File

@ -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 0.19.2
* start the metadata indexer immediately after adding or removing paths from * start the metadata indexer immediately after adding or removing paths from

View File

@ -7,8 +7,8 @@ cmake_minimum_required(VERSION 3.0)
project(musikbox) project(musikbox)
set (musikbox_VERSION_MAJOR 0) set (musikbox_VERSION_MAJOR 0)
set (musikbox_VERSION_MINOR 19) set (musikbox_VERSION_MINOR 20)
set (musikbox_VERSION_PATCH 2) set (musikbox_VERSION_PATCH 0)
set (musikbox_VERSION "${musikbox_VERSION_MAJOR}.${musikbox_VERSION_MINOR}.${musikbox_VERSION_PATCH}") set (musikbox_VERSION "${musikbox_VERSION_MAJOR}.${musikbox_VERSION_MINOR}.${musikbox_VERSION_PATCH}")
include(CMakeToolsHelpers OPTIONAL) include(CMakeToolsHelpers OPTIONAL)

View File

@ -467,12 +467,15 @@ PlaybackState PlaybackService::GetPlaybackState() {
} }
bool PlaybackService::HotSwap(const TrackList& tracks, size_t index) { bool PlaybackService::HotSwap(const TrackList& tracks, size_t index) {
bool swap = false;
if (&tracks == &playlist) { if (&tracks == &playlist) {
return true; return true;
} }
if (!tracks.Count()) {
return false;
}
bool found = false;
auto playingTrack = this->GetPlaying(); auto playingTrack = this->GetPlaying();
if (playingTrack && tracks.Count() > index) { if (playingTrack && tracks.Count() > index) {
auto supplantTrack = tracks.Get(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 /* look at the index hint, see if we can find a matching track without
iteration. */ iteration. */
if (supplantId == playingId && supplantLibrary == playingLibrary) { if (supplantId == playingId && supplantLibrary == playingLibrary) {
swap = true; found = true;
} }
/* otherwise search the input */ /* otherwise search the input */
else { else {
@ -496,30 +499,29 @@ bool PlaybackService::HotSwap(const TrackList& tracks, size_t index) {
if (supplantId == playingId && supplantLibrary == playingLibrary) { if (supplantId == playingId && supplantLibrary == playingLibrary) {
index = i; index = i;
swap = true; found = true;
} }
} }
} }
} }
if (swap) { {
{ std::unique_lock<std::recursive_mutex> lock(this->playlistMutex);
std::unique_lock<std::recursive_mutex> lock(this->playlistMutex); TrackList temp(this->library);
TrackList temp(this->library); temp.CopyFrom(tracks);
temp.CopyFrom(tracks); this->playlist.Swap(temp);
this->playlist.Swap(temp); this->unshuffled.Clear();
this->unshuffled.Clear(); this->index = found ? index : NO_POSITION;
this->index = index; this->nextIndex = NO_POSITION;
this->nextIndex = NO_POSITION;
}
POST(this, MESSAGE_PREPARE_NEXT_TRACK, this->index, 0);
POST(this, MESSAGE_NOTIFY_EDITED, NO_POSITION, 0);
return true;
} }
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) { void PlaybackService::Play(const TrackList& tracks, size_t index) {
@ -842,7 +844,8 @@ PlaybackService::Editor::~Editor() {
if (this->edited) { if (this->edited) {
/* we've been tracking the playback index through edit operations. let's /* we've been tracking the playback index through edit operations. let's
update it here. */ 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->playIndex != this->playback.GetIndex() || this->nextTrackInvalidated) {
if (this->playback.Count() > 0 && this->playIndex != NO_POSITION) { if (this->playback.Count() > 0 && this->playIndex != NO_POSITION) {
this->playIndex = std::min(this->playback.Count() - 1, this->playIndex); this->playIndex = std::min(this->playback.Count() - 1, this->playIndex);

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 19 #define VERSION_MINOR 20
#define VERSION_PATCH 2 #define VERSION_PATCH 0
#define VERSION "0.19.2" #define VERSION "0.20.0"