diff --git a/core/audio.c b/core/audio.c index 76e3574b..2e1e55c9 100644 --- a/core/audio.c +++ b/core/audio.c @@ -37,6 +37,7 @@ static bool __audio_change_state(GstState state) /* Load a track, but don't add it to the history. */ static struct track *__audio_load_basic(struct track *track, GstState state) { + struct track *prev = audio_track; gchar *path, *uri; if (!track) @@ -51,6 +52,10 @@ static struct track *__audio_load_basic(struct track *track, GstState state) audio_ops->on_load(track); __audio_change_state(state); + tempq_updated(prev); + queue_updated(collection_get_queue(), prev); + queue_updated(collection_get_queue(), audio_track); + __audio_save(); g_free(uri); g_free(path); @@ -202,10 +207,8 @@ struct track *audio_prev() struct track *audio_eos() { /* Mark current track as played */ - if (audio_track) { + if (audio_track) track_played(audio_track); - queue_updated(collection_get_queue(), audio_track); - } /* Check pause count and pick the next track */ if (audio_pause_count >= 0) { diff --git a/core/tempq.c b/core/tempq.c index 15bdb65a..e444761f 100644 --- a/core/tempq.c +++ b/core/tempq.c @@ -152,3 +152,11 @@ unsigned int tempq_count() { return g_slist_length(tempq_list); } + +void tempq_updated(struct track *track) +{ + GSList *cur; + + for (cur = tempq_list; cur; cur = g_slist_next(cur)) + queue_updated((struct queue *)cur->data, track); +} diff --git a/include/core/tempq.h b/include/core/tempq.h index 18bd5cf7..98bbfd66 100644 --- a/include/core/tempq.h +++ b/include/core/tempq.h @@ -45,4 +45,7 @@ struct track *tempq_next(); /* Called to find the number of temporary queues currently allocated. */ unsigned int tempq_count(); +/* Called to tell temporary queues that a track has been updated. */ +void tempq_updated(struct track *); + #endif /* OCARINA_CORE_DECK_H */