Don't mark the current track as changed when falling off the end of the queue

custom
jacqueline 1 year ago
parent 4509ab8d6e
commit c035ed2b4d
  1. 17
      src/audio/track_queue.cpp

@ -200,6 +200,9 @@ auto TrackQueue::append(Item i) -> void {
} }
auto TrackQueue::next() -> void { auto TrackQueue::next() -> void {
bool changed = true;
{
const std::unique_lock<std::shared_mutex> lock(mutex_); const std::unique_lock<std::shared_mutex> lock(mutex_);
if (shuffle_) { if (shuffle_) {
shuffle_->next(); shuffle_->next();
@ -208,16 +211,23 @@ auto TrackQueue::next() -> void {
if (pos_ + 1 >= tracks_.size()) { if (pos_ + 1 >= tracks_.size()) {
if (replay_) { if (replay_) {
pos_ = 0; pos_ = 0;
} else {
pos_ = tracks_.size();
changed = false;
} }
} else { } else {
pos_++; pos_++;
} }
} }
}
notifyChanged(true); notifyChanged(changed);
} }
auto TrackQueue::previous() -> void { auto TrackQueue::previous() -> void {
bool changed = true;
{
const std::unique_lock<std::shared_mutex> lock(mutex_); const std::unique_lock<std::shared_mutex> lock(mutex_);
if (shuffle_) { if (shuffle_) {
shuffle_->prev(); shuffle_->prev();
@ -226,13 +236,16 @@ auto TrackQueue::previous() -> void {
if (pos_ == 0) { if (pos_ == 0) {
if (repeat_) { if (repeat_) {
pos_ = tracks_.size() - 1; pos_ = tracks_.size() - 1;
} else {
changed = false;
} }
} else { } else {
pos_--; pos_--;
} }
} }
}
notifyChanged(true); notifyChanged(changed);
} }
auto TrackQueue::finish() -> void { auto TrackQueue::finish() -> void {

Loading…
Cancel
Save