Documentation ¶
Overview ¶
Package playback implements audio playback using PlaybackDevices. It is used to implement the Jukebox mode in turn. It makes use of the MPV library to do the playback. Major parts are: - decoder which includes decoding and transcoding of various audio file formats - device implementing the basic functions to work with audio devices like set, play, stop, skip, ... - queue a simple playlist
Index ¶
- Constants
- func NewPlaybackDevice(ctx context.Context, playbackServer PlaybackServer, name string, ...) *playbackDevice
- type DeviceStatus
- type PlaybackServer
- type Queue
- func (pd *Queue) Add(items model.MediaFiles)
- func (pd *Queue) Clear()
- func (pd *Queue) Current() *model.MediaFile
- func (pd *Queue) Get() model.MediaFiles
- func (pd *Queue) IncreaseIndex()
- func (pd *Queue) IsAtLastElement() bool
- func (pd *Queue) IsEmpty() bool
- func (pd *Queue) Remove(idx int)
- func (pd *Queue) Set(items model.MediaFiles)
- func (pd *Queue) SetIndex(idx int)
- func (pd *Queue) Shuffle()
- func (pd *Queue) Size() int
- func (pd *Queue) String() string
- type Track
Constants ¶
const DefaultGain float32 = 1.0
Variables ¶
This section is empty.
Functions ¶
func NewPlaybackDevice ¶
func NewPlaybackDevice(ctx context.Context, playbackServer PlaybackServer, name string, deviceName string) *playbackDevice
NewPlaybackDevice creates a new playback device which implements all the basic Jukebox mode commands defined here: http://www.subsonic.org/pages/api.jsp#jukeboxControl Starts the trackSwitcher goroutine for the device.
Types ¶
type DeviceStatus ¶
type PlaybackServer ¶
type PlaybackServer interface { Run(ctx context.Context) error GetDeviceForUser(user string) (*playbackDevice, error) GetMediaFile(id string) (*model.MediaFile, error) }
func GetInstance ¶
func GetInstance(ds model.DataStore) PlaybackServer
GetInstance returns the playback-server singleton
type Queue ¶
type Queue struct { Index int Items model.MediaFiles }
func (*Queue) Set ¶
func (pd *Queue) Set(items model.MediaFiles)
set is similar to a clear followed by a add, but will not change the currently playing track.