Documentation
¶
Overview ¶
Package queue is the playback queue model shared by the TUI and the C API (via corelib), so shuffle/repeat/prev-history behaviour is defined once instead of being re-implemented per frontend.
Index ¶
- type Queue
- func (q *Queue) AdvanceAuto() bool
- func (q *Queue) Append(tracks ...deezer.Track)
- func (q *Queue) Current() (deezer.Track, bool)
- func (q *Queue) CycleRepeat() Repeat
- func (q *Queue) Index() int
- func (q *Queue) Len() int
- func (q *Queue) Next() bool
- func (q *Queue) Prev() bool
- func (q *Queue) Repeat() Repeat
- func (q *Queue) Set(tracks []deezer.Track, start int)
- func (q *Queue) SetIndex(i int)
- func (q *Queue) SetRepeat(r Repeat)
- func (q *Queue) SetShuffle(on bool)
- func (q *Queue) Shuffle() bool
- func (q *Queue) ToggleShuffle() bool
- func (q *Queue) Tracks() []deezer.Track
- type Repeat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue holds an ordered track list plus a cursor, shuffle/repeat state and a visited-index history (so Prev under shuffle retraces the real path). The zero value is a valid empty queue. Not safe for concurrent use; callers serialize.
func (*Queue) AdvanceAuto ¶
AdvanceAuto is called when a track ends naturally: RepeatOne replays the current track (reports true, cursor unchanged); otherwise it behaves like Next. Returns whether playback should continue.
func (*Queue) CycleRepeat ¶
func (*Queue) Next ¶
Next advances the cursor following shuffle/repeat rules and reports whether it moved to a playable track. RepeatOne is treated as a normal advance here (the caller decides whether a natural finish should instead replay current — see AdvanceAuto).
func (*Queue) Set ¶
Set replaces the queue contents and positions the cursor at start (clamped). History is cleared.
func (*Queue) SetIndex ¶
SetIndex moves the cursor (clamped); use when the user picks a row directly.