player

package
v0.0.0-...-dd1cc55 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SeekSecs is the amount of seconds to skip forward or backward
	SeekSecs = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioController

type AudioController interface {
	Paused() bool
	PauseToggle() bool
	PlayState() (PlayState, error)
	SeekForward() error
	SeekBackward() error
	SpeedUp()
	SpeedDown()
	Stop()
	VolumeUp()
	VolumeDown()
}

AudioController will control playing audio

type AudioPlayer

type AudioPlayer interface {
	Play(library.Track, bool) (AudioController, error)
}

AudioPlayer is an interface for playing audio tracks.

type BeepAudioPlayer

type BeepAudioPlayer struct{}

BeepAudioPlayer is an audio player implementation that uses beep

func NewBeepAudioPlayer

func NewBeepAudioPlayer() (*BeepAudioPlayer, error)

NewBeepAudioPlayer --

func (*BeepAudioPlayer) Play

func (bmp *BeepAudioPlayer) Play(track library.Track, repeat bool) (AudioController, error)

Play a track and return a controller that lets you perform changes to a running track.

type BeepController

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

BeepController manages playing audio.

TODO: make this an interface. this is fine for now since we're only using beep our audio player.

func (*BeepController) Done

func (c *BeepController) Done() chan (bool)

Done returns a done channel

func (*BeepController) PauseToggle

func (c *BeepController) PauseToggle() bool

PauseToggle pauses/unpauses audio. Returns true if currently paused, false if unpaused.

func (*BeepController) Paused

func (c *BeepController) Paused() bool

Paused returns current pause state

func (*BeepController) PlayState

func (c *BeepController) PlayState() (PlayState, error)

PlayState returns the current state of playing audio.

func (*BeepController) SeekBackward

func (c *BeepController) SeekBackward() error

SeekBackward moves progress backward

func (*BeepController) SeekForward

func (c *BeepController) SeekForward() error

SeekForward moves progress forward

func (*BeepController) SpeedDown

func (c *BeepController) SpeedDown()

SpeedDown slows down speed

func (*BeepController) SpeedUp

func (c *BeepController) SpeedUp()

SpeedUp increases speed

func (*BeepController) Stop

func (c *BeepController) Stop()

Stop must be thread safe

func (*BeepController) VolumeDown

func (c *BeepController) VolumeDown()

VolumeDown the playing track

func (*BeepController) VolumeUp

func (c *BeepController) VolumeUp()

VolumeUp the playing track

type MockAudioController

type MockAudioController struct{}

func (*MockAudioController) PauseToggle

func (p *MockAudioController) PauseToggle() bool

func (*MockAudioController) Paused

func (p *MockAudioController) Paused() bool

func (*MockAudioController) PlayState

func (p *MockAudioController) PlayState() (PlayState, error)

func (*MockAudioController) SeekBackward

func (p *MockAudioController) SeekBackward() error

func (*MockAudioController) SeekForward

func (p *MockAudioController) SeekForward() error

func (*MockAudioController) SpeedDown

func (p *MockAudioController) SpeedDown()

func (*MockAudioController) SpeedUp

func (p *MockAudioController) SpeedUp()

func (*MockAudioController) Stop

func (p *MockAudioController) Stop()

func (*MockAudioController) VolumeDown

func (p *MockAudioController) VolumeDown()

func (*MockAudioController) VolumeUp

func (p *MockAudioController) VolumeUp()

type MockAudioPlayer

type MockAudioPlayer struct{}

MockAudioPlayer is an audio player implementation that uses beep

func NewMockAudioPlayer

func NewMockAudioPlayer() *MockAudioPlayer

NewMockAudioPlayer --

func (*MockAudioPlayer) Play

func (bmp *MockAudioPlayer) Play(track library.Track, repeat bool) (*MockAudioController, error)

Play a track and return a controller that lets you perform changes to a running track.

type PlayState

type PlayState struct {
	Finished bool
	Progress float32
	Position string
	Volume   string
	Speed    string
}

PlayState represents the current state of playing audio.

Jump to

Keyboard shortcuts

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