diff --git a/core/audio.cpp b/core/audio.cpp index 4c2ea5d4..fee81ff5 100644 --- a/core/audio.cpp +++ b/core/audio.cpp @@ -67,7 +67,7 @@ void AudioDriver :: eos() { if (cur_track) { track_played(cur_track); - collection :: get_queue()->updated(cur_track); + queue_updated(collection :: get_queue(), cur_track); } _load_track(deck :: next(), continue_playback()); diff --git a/core/queue.cpp b/core/queue.cpp index 0141ad39..a7525ea9 100644 --- a/core/queue.cpp +++ b/core/queue.cpp @@ -143,11 +143,11 @@ void queue :: del(struct track *track) } } -void queue :: updated(struct track *track) +void queue_updated(struct queue *queue, struct track *track) { - for (unsigned int i = 0; i < q_tracks.size(); i++) { - if (q_tracks[i] == track) - q_notify->on_track_updated(i); + for (unsigned int i = 0; i < queue_size(queue); i++) { + if (queue->q_tracks[i] == track) + queue->q_notify->on_track_updated(i); } } diff --git a/include/core/queue.h b/include/core/queue.h index 6cf3ec39..c23f5c00 100644 --- a/include/core/queue.h +++ b/include/core/queue.h @@ -156,13 +156,6 @@ struct queue { */ virtual void del(struct track *); - /** - * Signal to the queue that a track has been updated. - * - * @param track The track that has been modified. - */ - void updated(struct track *); - /** * Add a new sort field to the queue. If the field is already in the @@ -191,6 +184,10 @@ static inline struct track *queue_at(struct queue *queue, unsigned int index) } +/* Called to tell the queue that a track has been updated. */ +void queue_updated(struct queue *, struct track *); + + /* Called to tell the queue that a specific index has been selected. */ void queue_selected(struct queue *, unsigned int); diff --git a/tests/core/queue.cpp b/tests/core/queue.cpp index dd8841cd..95952e54 100644 --- a/tests/core/queue.cpp +++ b/tests/core/queue.cpp @@ -146,9 +146,9 @@ static void test_stress(unsigned int N) test_equal(q.q_length, ex_length); test_equal(queue_size(&q), ex_size); - /* Queue :: updated(struct track *) */ + /* queue_updated() */ track = track_get(2); - q.updated(track); + queue_updated(&q, track); test_equal(count_updated, N / 13); test_equal(queue_next(&q), NULL);