Documentation ¶
Overview ¶
Package pulseaudio is a pure-Go (no libpulse) implementation of the PulseAudio native protocol.
Rather than exposing the PulseAudio protocol directly this library attempts to hide the PulseAudio complexity behind a Go interface. Some of the things which are deliberately not exposed in the API are:
→ backwards compatibility for old PulseAudio servers
→ transport mechanism used for the connection (Unix sockets / memfd / shm)
→ encoding used in the pulseaudio-native protocol
Working features ¶
Querying and setting the volume.
Listing audio outputs.
Changing the default audio output.
Notifications on config updates.
Example ¶
client, err := NewClient() if err != nil { panic(err) } defer client.Close() // Use `client` to interact with PulseAudio
Output:
Index ¶
- type Card
- type Client
- func (c *Client) Cards() ([]Card, error)
- func (c *Client) Close()
- func (c *Client) Mute() (bool, error)
- func (c *Client) Outputs() (outputs []Output, activeIndex int, err error)
- func (c *Client) ServerInfo() (*Server, error)
- func (c *Client) SetCardProfile(cardIndex uint32, profileName string) error
- func (c *Client) SetMute(b bool) error
- func (c *Client) SetSinkVolume(sinkName string, volume float32) error
- func (c *Client) SetVolume(volume float32) error
- func (c *Client) Sinks() ([]sink, error)
- func (c *Client) ToggleMute() (bool, error)
- func (c *Client) Updates() (updates <-chan struct{}, err error)
- func (c *Client) Volume() (float32, error)
- type Error
- type Output
- type Server
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client maintains a connection to the PulseAudio server.
func (*Client) Close ¶
func (c *Client) Close()
Close closes the connection to PulseAudio server and makes the Client unusable.
func (*Client) Outputs ¶
Outputs returns a list of all audio outputs and an index of the active audio output.
The last audio output is always called "None" and indicates that audio is disabled.
func (*Client) ServerInfo ¶
func (*Client) SetCardProfile ¶
func (*Client) SetSinkVolume ¶
func (*Client) SetVolume ¶
SetVolume changes the current volume to a specified value from 0 to 1 (or more than 1 - if volume should be boosted).
func (*Client) ToggleMute ¶
ToggleMute reverse mute status