pulseaudio

package module
v0.0.0-...-22b9443 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 10 Imported by: 0

README

go-barebones-pulseaudio

This is a fork of the-jonsey/pulseaudio that includes just the bare minimum functionality I need for other projects of mine that rely on Pulseaudio. This also works with pipewire-pulse (which is what I use).

Usage:

package main

import (
	pulseaudio "codeberg.org/djmattyg007/go-barebones-pulseaudio"
)

func main() {
    client, clientErr := pulseaudio.NewClient()
    if clientErr != nil {
        panic(clientErr)
    }
    client.SetSinkVolume("mysink", 0.5)
    client.SetSinkMute("mysink", false)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetermineCookiePath

func DetermineCookiePath() (string, error)

func DetermineSocketPath

func DetermineSocketPath(filename string) (string, error)

DetermineSocketPath resolves a file in the PulseAudio 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 NewClient

func NewClient(co *ClientOptions) (*Client, error)

func (*Client) Close

func (c *Client) Close()

Close closes the connection to PulseAudio server and makes the Client unusable.

func (*Client) Connected

func (c *Client) Connected() bool

Connected returns a bool specifying if the connection to PulseAudio is alive

func (*Client) SetSinkMute

func (c *Client) SetSinkMute(sinkName string, muted bool) error

func (*Client) SetSinkVolume

func (c *Client) SetSinkVolume(sinkName string, volume float32) error

type ClientOptions

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

func NewClientOptions

func NewClientOptions(options ...Option) (*ClientOptions, error)

type Error

type Error struct {
	Cmd  string
	Code uint32
}

func (*Error) Error

func (err *Error) Error() string

type Option

type Option func(*ClientOptions)

func WithApplicationLanguage

func WithApplicationLanguage(lang string) Option

func WithApplicationName

func WithApplicationName(name string) Option

func WithCookiePath

func WithCookiePath(cookiePath string) Option

func WithSocketPath

func WithSocketPath(socketPath string) Option

func WithX11Display

func WithX11Display(display string) Option

Jump to

Keyboard shortcuts

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