pulse

package
v1.17.14 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: BSD-3-Clause Imports: 13 Imported by: 0 modules, 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

Overview

Package pulse is the PulseAudio backend of the audio service on Linux (SPEC §28.3, step 31.5): playback and capture streams of float32 frames on libpulse's threaded main loop, the devices and the default device of the server, and a notification when they change. libpulse is loaded when it is first needed; the library is never linked. It speaks to PulseAudio and to PipeWire's PulseAudio protocol alike. The design (a thread of the library that calls the handler, a write callback that asks for just what the server wants) follows the PulseAudio driver of SDL 3 (src/audio/pulseaudio/SDL_pulseaudio.c; zlib license, third_party/sdl/LICENSE), translated to Go and changed.

Flutter: no counterpart

Index

Constants

View Source
const LibraryEnv = "GLUTTER_PULSE_LIBRARY"

LibraryEnv names the environment variable that overrides the path of libpulse, for setups such as NixOS (SPEC §8.1).

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// AppName names the application to the server (it shows in a volume control); it defaults to the name of the program.
	AppName string
}

Options configure a Service.

type Service

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

Service is the PulseAudio backend: it implements platform.Audio. It connects to the server when it is first used, and again when the server was lost.

Flutter: no counterpart

func New

func New(opts Options) *Service

New makes a Service. Nothing is loaded or connected yet.

Flutter: no counterpart

func (*Service) Close

func (s *Service) Close()

Close ends the connection: the devices that are open are closed, the main loop stops and the context is freed. The service is not used afterwards: its calls fail with AudioUnavailable. The memory of the stopped main loop is kept, because a device that was open can still be closed or paused by its owner afterwards, and takes the loop's lock to find out that it is closed.

Flutter: no counterpart

func (*Service) Devices

func (s *Service) Devices(kind platform.AudioKind) ([]platform.AudioDeviceInfo, error)

Devices lists the sinks (playback) or the sources (capture) of the server, without the monitors of the sinks. It fails with AudioUnavailable when no server answers.

Flutter: no counterpart

func (*Service) Open

Open opens a playback or a capture stream. It fails with AudioUnavailable when no server answers, AudioFormatUnsupported when the server takes no such format, AudioCapturePermissionDenied when the server refuses the recording, and AudioDeviceOpenFailed for the rest (the device is not there, the stream cannot connect).

Flutter: no counterpart

func (*Service) SetChangeHandler

func (s *Service) SetChangeHandler(fn func())

SetChangeHandler sets what is called when a device appears, goes or changes, or the default changes. It is called on the thread of libpulse; nil clears it. The subscription is made when the service connects, which is when the app first asks for devices or opens one.

Flutter: no counterpart

Jump to

Keyboard shortcuts

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