diff --git a/src/audio/queue.ts b/src/audio/queue.ts index f63980c..31b993a 100644 --- a/src/audio/queue.ts +++ b/src/audio/queue.ts @@ -21,6 +21,16 @@ export class PlayQueue { private currentIndex = -1; private mode: PlayMode = PlayMode.Sequential; private playedIndices = new Set(); + private history: number[] = []; + private static readonly HISTORY_LIMIT = 50; + + private pushHistory(idx: number): void { + if (idx < 0 || idx >= this.songs.length) return; + this.history.push(idx); + if (this.history.length > PlayQueue.HISTORY_LIMIT) { + this.history.shift(); + } + } add(song: QueuedSong): void { this.songs.push(song);