Documentation ¶
Overview ¶
Example ¶
client, err := NewClient() if err != nil { panic(err) } defer client.Close() // Use `client` to interact with PulseAudio
Output:
Index ¶
- func RuntimePath(fn string) (string, error)
- type Card
- type Client
- func (c *Client) Cards() ([]Card, error)
- func (c *Client) Close()
- func (c *Client) Connected() bool
- func (c *Client) GetDefaultSink() (*Sink, error)
- func (c *Client) GetSinkInfo(index uint32) (*Sink, error)
- func (c *Client) GetSinkInputInfo(index uint32) (*SinkInput, error)
- func (c *Client) GetSourceInfo(index uint32) (*Source, error)
- func (c *Client) GetSourceOutputInfo(index uint32) (*SourceOutput, error)
- func (c *Client) LoadModule(name string, argument string) (index uint32, err error)
- func (c *Client) ModuleList() ([]Module, error)
- func (c *Client) Mute() (bool, error)
- func (c *Client) ServerInfo() (*Server, error)
- func (c *Client) SetCardProfile(cardIndex uint32, profileName string) error
- func (c *Client) SetDefaultSink(sinkName string) error
- func (c *Client) SetDefaultSource(name string) error
- func (c *Client) SetMute(b bool) error
- func (c *Client) SetSinkInputMute(index uint32, mute bool) error
- func (c *Client) SetSinkInputVolume(index uint32, volume float32) error
- func (c *Client) SetSinkMute(name string, b bool) error
- func (c *Client) SetSinkPort(name, port string) error
- func (c *Client) SetSinkVolume(name string, volume float32) error
- func (c *Client) SetSourceMute(name string, b bool) error
- func (c *Client) SetSourceOutputMute(index uint32, mute bool) error
- func (c *Client) SetSourceOutputVolume(index uint32, volume float32) error
- func (c *Client) SetSourceVolume(name string, volume float32) error
- func (c *Client) SetVolume(volume float32) error
- func (c *Client) SinkInputs() ([]SinkInput, error)
- func (c *Client) Sinks() ([]Sink, error)
- func (c *Client) SourceOutputs() ([]SourceOutput, error)
- func (c *Client) Sources() ([]Source, error)
- func (c *Client) ToggleMute() (bool, error)
- func (c *Client) UnloadModule(index uint32) error
- func (c *Client) Updates() (updates <-chan SubscriptionEvent, err error)
- func (c *Client) Volume() (float32, error)
- type Error
- type Event
- type Module
- type Server
- type Sink
- type SinkInput
- type Source
- type SourceOutput
- type SubscriptionEvent
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RuntimePath ¶
RuntimePath resolves a file in the pulse runtime path E.g. pass "native" to get the address for pulse' native socket Original implementation: https://github.com/pulseaudio/pulseaudio/blob/6c58c69bb6b937c1e758410d3114fc3bc0606fbe/src/pulsecore/core-util.c Except we do not support legacy $HOME paths
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) Connected ¶ added in v1.0.0
Connected returns a bool specifying if the connection to pulse is alive
func (*Client) GetDefaultSink ¶ added in v0.0.2
func (*Client) GetSinkInfo ¶ added in v1.0.0
func (*Client) GetSinkInputInfo ¶ added in v1.0.0
func (*Client) GetSourceInfo ¶ added in v1.0.0
func (*Client) GetSourceOutputInfo ¶ added in v1.0.0
func (c *Client) GetSourceOutputInfo(index uint32) (*SourceOutput, error)
func (*Client) LoadModule ¶
LoadModule requests pulseaudio to load the module with the specified name and argument string. More information on how to supply these can be found in the pulseaudio documentation: https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#loadablemodules e.g. LoadModule("module-alsa-sink", "sink_name=headphones sink_properties=device.description=Headphones") would be equivalent to the pulse config directive: load-module module-alsa-sink sink_name=headphones sink_properties=device.description=Headphones Returns the index of the loaded module or an error
func (*Client) ModuleList ¶
ModuleList queries pulseaudio for a list of loaded modules and returns an array
func (*Client) ServerInfo ¶
ServerInfo queries the pulseaudio server for its information
func (*Client) SetCardProfile ¶
func (*Client) SetDefaultSink ¶
func (*Client) SetDefaultSource ¶ added in v1.0.0
func (*Client) SetSinkInputMute ¶ added in v1.0.0
func (*Client) SetSinkInputVolume ¶ added in v1.0.0
func (*Client) SetSinkMute ¶ added in v1.0.0
func (*Client) SetSinkPort ¶ added in v1.0.3
func (*Client) SetSourceMute ¶ added in v1.0.0
ToggleMute reverse mute status
func (*Client) SetSourceOutputMute ¶ added in v1.0.0
func (*Client) SetSourceOutputVolume ¶ added in v1.0.0
func (*Client) SetSourceVolume ¶ added in v1.0.0
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) SinkInputs ¶ added in v1.0.0
SinkInputs queries PulseAudio for a list of sink inputs and returns an array
func (*Client) SourceOutputs ¶ added in v1.0.0
func (c *Client) SourceOutputs() ([]SourceOutput, error)
SinkInputs queries PulseAudio for a list of sink inputs and returns an array
func (*Client) Sources ¶
Sources queries pulseaudio for a list of all it's sources and returns an array of them
func (*Client) ToggleMute ¶
ToggleMute reverse mute status
func (*Client) UnloadModule ¶
UnloadModule requests pulseaudio to unload the module with the specified index. The index can be found e.g. with ModuleList()
func (*Client) Updates ¶
func (c *Client) Updates() (updates <-chan SubscriptionEvent, err error)
Updates returns a channel with PulseAudio updates.
type Event ¶ added in v1.0.0
type Event uint32
const ( EventSink Event = iota EventSource EventSinkInput EventSourceOutput EventModule EventClient EventSimpleCache EventServer EventAutoload EventCard EventFacilityMask Event = 0x000f EventTypeNew Event = 0x0000 EventTypeChange Event = 0x0010 EventTypeRemove Event = 0x0020 EventTypeMask Event = 0x0030 )
type Module ¶
type Module struct { Index uint32 Name string Argument string NUsed uint32 PropList map[string]string }
Module contains information about a pulseaudio module
type Server ¶
type Server struct { PackageName string PackageVersion string User string Hostname string SampleSpec sampleSpec DefaultSink string DefaultSource string Cookie uint32 ChannelMap channelMap }
Server contains information about the pulseaudio server
type Sink ¶
type Sink struct { Index uint32 Name string Description string SampleSpec sampleSpec ChannelMap channelMap ModuleIndex uint32 Cvolume cvolume Muted bool MonitorSourceIndex uint32 MonitorSourceName string Latency uint64 Driver string Flags uint32 PropList map[string]string RequestedLatency uint64 BaseVolume uint32 SinkState uint32 NVolumeSteps uint32 CardIndex uint32 Ports []sinkPort ActivePortName string Formats []formatInfo }
Sink contains information about a sink in pulseaudio
type SinkInput ¶ added in v1.0.0
type SinkInput struct { Index uint32 Name string ModuleIndex uint32 ClientIndex uint32 SinkIndex uint32 SampleSpec sampleSpec ChannelMap channelMap Cvolume cvolume BufferLatency uint64 SinkLatency uint64 ResampleMethod string Driver string Muted bool PropList map[string]string Corked bool HasVolume bool VolumeWritable bool Format formatInfo }
SinkInput contains information about a sink inputs in pulseaudio https://github.com/pulseaudio/pulseaudio/blob/7f4d7fcf5f6407913e50604c6195d0d5356195b1/src/pulsecore/protocol-native.c#L3397 https://freedesktop.org/software/pulseaudio/doxygen/structpa__sink__input__info.html
type Source ¶
type Source struct { Index uint32 Name string Description string SampleSpec sampleSpec ChannelMap channelMap ModuleIndex uint32 Cvolume cvolume Muted bool MonitorSourceIndex uint32 MonitorSourceName string Latency uint64 Driver string Flags uint32 PropList map[string]string RequestedLatency uint64 BaseVolume uint32 SinkState uint32 NVolumeSteps uint32 CardIndex uint32 Ports []sinkPort ActivePortName string Formats []formatInfo }
Source contains information about a source in pulseaudio, e.g. a microphone
type SourceOutput ¶ added in v1.0.0
type SourceOutput struct { Index uint32 Name string ModuleIndex uint32 ClientIndex uint32 SourceIndex uint32 SampleSpec sampleSpec ChannelMap channelMap BufferLatency uint64 SourceLatency uint64 ResampleMethod string Driver string PropList map[string]string Corked bool Cvolume cvolume Muted bool HasVolume bool VolumeWritable bool Format formatInfo }
SinkInput contains information about a sink inputs in pulseaudio https://freedesktop.org/software/pulseaudio/doxygen/structpa__source__output__info.html https://github.com/pulseaudio/pulseaudio/blob/7f4d7fcf5f6407913e50604c6195d0d5356195b1/src/pulsecore/protocol-native.c#L3440