Documentation
¶
Overview ¶
Package client provides the client-side functionality for Gophercast.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDisconnected = errors.New("disconnected") ErrRejected = errors.New("rejected") )
Sentinel errors for clean shutdown handling.
Functions ¶
This section is empty.
Types ¶
type AudioClient ¶
type AudioClient struct {
// contains filtered or unexported fields
}
AudioClient connects to a GopherCast server and plays audio.
func NewAudioClient ¶
func NewAudioClient(serverURL, name string, sink AudioSink, latencyOverride time.Duration) (*AudioClient, error)
NewAudioClient dials the server and sends a hello. Pass latencyOverride > 0 to skip auto-detection.
func (*AudioClient) Close ¶
func (c *AudioClient) Close()
func (*AudioClient) Start ¶
func (c *AudioClient) Start() error
type AudioSink ¶
type AudioSink interface {
Init(sampleRate, channels int) error
Write(p []byte) (int, error)
Close() error
// Latency is how long it takes from writing PCM to hearing it out the speaker.
Latency() time.Duration
}
AudioSink is the interface for audio output backends.
type FileSink ¶
type FileSink struct {
// contains filtered or unexported fields
}
FileSink writes raw PCM audio data to a file. Mostly useful for debugging.
func NewFileSink ¶
type SystemAudioSink ¶
type SystemAudioSink struct {
// contains filtered or unexported fields
}
SystemAudioSink plays PCM audio through the system audio output using oto.
func NewSystemAudioSink ¶
func NewSystemAudioSink() *SystemAudioSink
func (*SystemAudioSink) Close ¶
func (s *SystemAudioSink) Close() error
func (*SystemAudioSink) Init ¶
func (s *SystemAudioSink) Init(sampleRate, channels int) error
func (*SystemAudioSink) Latency ¶
func (s *SystemAudioSink) Latency() time.Duration
Click to show internal directories.
Click to hide internal directories.