player

package
v0.0.0-...-f8832d1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2023 License: GPL-3.0 Imports: 12 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event interface {
	Name() string
	Serialize() []serialize.Serializable
}

type Output

type Output interface {
	// Output driver name. E.g. ALSA.
	Name() string
	// Open opens output audio device.
	Open() error
	// IsOpen returns true if output is in open state.
	IsOpen() bool
	// Returns current sample rate.
	SampleRate() int
	// Set new value for sample rate parameter.
	SetSampleRate(rate int)
	// Returns current channels value.
	Channels() int
	// Set number of channels.
	SetChannels(channels int)
	// Wait waits some free space in output buffer, but not more than
	// maxDelay milliseconds. true result value means that output is
	// ready for new portion of data, false -- timeout has occured.
	Wait(maxDelay int) (ok bool, err error)
	// AvailUpdate returns free size of output buffer. In bytes.
	AvailUpdate() (size int, err error)
	// Write new portion of data into buffer.
	Write(buf []byte) (written int, err error)
	// Reset empties ouput buffer.
	Reset()
	// Pause pauses or resumes playback process.
	Pause()
	// Paused returns true if output driver is in paused state now.
	Paused() bool
	// Close closes output audio device.
	Close()
}

Output interface represents audio autput driver (ALSA, OSS, ...).

type Player

type Player struct {
	// contains filtered or unexported fields
}

func New

func New(fmts []format.Format, output Output) *Player

func (*Player) Append

func (p *Player) Append(name string, path *vfs.Path) error

func (*Player) Clear

func (p *Player) Clear(name string) error

func (*Player) Close

func (p *Player) Close()

func (*Player) Create

func (p *Player) Create(name string) error

func (*Player) Delete

func (p *Player) Delete(name string) error

func (*Player) Events

func (p *Player) Events() <-chan Event

func (*Player) Next

func (p *Player) Next()

func (*Player) Pause

func (p *Player) Pause()

func (*Player) Play

func (p *Player) Play(path *vfs.Path) error

func (*Player) Playlist

func (p *Player) Playlist(name string) (*Playlist, error)

func (*Player) Playlists

func (p *Player) Playlists() []*Playlist

func (*Player) Prev

func (p *Player) Prev()

func (*Player) Rename

func (p *Player) Rename(from string, to string) error

func (*Player) Seek

func (p *Player) Seek(pos int, rel bool)

func (*Player) Status

func (p *Player) Status() *Status

func (*Player) Stop

func (p *Player) Stop()

type Playlist

type Playlist struct {
	// contains filtered or unexported fields
}

func NewPlaylist

func NewPlaylist(name string) *Playlist

func (*Playlist) Append

func (pl *Playlist) Append(tracks ...*vfs.Track) *Playlist

func (*Playlist) Clear

func (pl *Playlist) Clear() *Playlist

func (*Playlist) Duration

func (pl *Playlist) Duration() int

func (*Playlist) Get

func (pl *Playlist) Get(i int) *vfs.Track

func (*Playlist) Len

func (pl *Playlist) Len() int

func (*Playlist) Name

func (pl *Playlist) Name() string

func (*Playlist) Serialize

func (pl *Playlist) Serialize() string

func (*Playlist) SetName

func (pl *Playlist) SetName(name string) *Playlist

func (*Playlist) Tracks

func (pl *Playlist) Tracks() []*vfs.Track

type PlistCreateEvent

type PlistCreateEvent struct {
	Plist string
}

func (*PlistCreateEvent) Name

func (e *PlistCreateEvent) Name() string

func (*PlistCreateEvent) Serialize

func (e *PlistCreateEvent) Serialize() []serialize.Serializable

type PlistDeleteEvent

type PlistDeleteEvent struct {
	Plist string
}

func (*PlistDeleteEvent) Name

func (e *PlistDeleteEvent) Name() string

func (*PlistDeleteEvent) Serialize

func (e *PlistDeleteEvent) Serialize() []serialize.Serializable

type PlistRenameEvent

type PlistRenameEvent struct {
	From string
	To   string
}

func (*PlistRenameEvent) Name

func (e *PlistRenameEvent) Name() string

func (*PlistRenameEvent) Serialize

func (e *PlistRenameEvent) Serialize() []serialize.Serializable

type State

type State int
const (
	StatePaused State = iota
	StatePlaying
	StateStopped
)

func (State) String

func (s State) String() string

type Status

type Status struct {
	State    State
	Plist    *Playlist
	PlistPos int
	Pos      int
}

type StatusEvent

type StatusEvent struct {
	State    State
	Plist    *Playlist
	PlistPos int
	Track    *vfs.Track
	TrackPos int
}

func (*StatusEvent) Name

func (e *StatusEvent) Name() string

func (*StatusEvent) Serialize

func (e *StatusEvent) Serialize() []serialize.Serializable

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL