output

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: GPL-3.0 Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NewOutputOptions

type NewOutputOptions struct {
	// Backend is the audio backend to use (also, pulseaudio, etc).
	Backend string

	// Reader provides data for the output device.
	//
	// The format of data is as follows:
	//
	//	[data]      = [sample 1] [sample 2] [sample 3] ...
	//	[sample *]  = [channel 1] [channel 2] ...
	//	[channel *] = [byte 1] [byte 2] ...
	//
	// Byte ordering is little endian.
	Reader librespot.Float32Reader

	// SampleRate specifies the number of samples that should be played during one second.
	// Usual numbers are 44100 or 48000. One context has only one sample rate. You cannot play multiple audio
	// sources with different sample rates at the same time.
	SampleRate int

	// ChannelCount specifies the number of channels. One channel is mono playback. Two
	// channels are stereo playback. No other values are supported.
	ChannelCount int

	// Device specifies the audio device name.
	//
	// This feature is support only for the alsa backend.
	Device string

	// Mixer specifies the audio mixer name.
	//
	// This feature is support only for the alsa backend.
	Mixer string
	// Control specifies the mixer control name
	//
	// This only works in combination with Mixer
	Control string

	// BufferTimeMicro is the buffer time in microseconds.
	//
	// This is only supported on the alsa backend.
	BufferTimeMicro int

	// PeriodCount is the number of periods to request.
	//
	// This is only supported on the alsa backend.
	PeriodCount int

	// InitialVolume specifies the initial output volume.
	//
	// This is only supported on the alsa backend. The PulseAudio backend uses
	// the PulseAudio default volume.
	InitialVolume float32

	// ExternalVolume specifies, if the volume is controlled outside of the app.
	//
	// This is only supported on the alsa backend. The PulseAudio backend always
	// uses external volume.
	ExternalVolume bool

	// VolumeUpdate is a channel on which volume updates will be sent back to
	// Spotify. All updates come through this channel, including those sent by
	// Spotify.
	// This must be a buffered channel.
	VolumeUpdate chan float32
}

type Output

type Output interface {
	// Pause pauses the output.
	Pause() error

	// Resume resumes the output.
	Resume() error

	// Drop empties the audio buffer without waiting.
	Drop() error

	// DelayMs returns the output device delay in milliseconds.
	DelayMs() (int64, error)

	// SetVolume sets the volume (0-1).
	SetVolume(vol float32)

	// Error returns the error that stopped the device (if any).
	Error() <-chan error

	// Close closes the output.
	Close() error
}

func NewOutput

func NewOutput(options *NewOutputOptions) (Output, error)

Jump to

Keyboard shortcuts

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