Documentation
¶
Overview ¶
Package sounds plays notification sounds: names resolve through the freedesktop sound theme, files decode once (Ogg Vorbis and WAV) into the PCM the audio server's sample cache keeps, and a notification's sound plays from that cache through the session's PipeWire.
Index ¶
Constants ¶
const FallbackTheme = "freedesktop"
FallbackTheme is the theme every lookup ends in.
Variables ¶
var ErrNoSound = errors.New("no sound theme file for this name")
ErrNoSound is a name no theme in the chain has a file for.
var ErrUnsupported = errors.New("unsupported sound file")
ErrUnsupported is a sound file that is neither Ogg Vorbis nor PCM WAV.
Functions ¶
Types ¶
type Announcer ¶
type Announcer struct {
// contains filtered or unexported fields
}
Announcer plays the sound of each new notification that may make one.
func NewAnnouncer ¶
func NewAnnouncer(svc *notifications.Service, player Player, theme Theme, muted func() bool, policy soundpolicy.Policy) *Announcer
NewAnnouncer plays notification sounds of svc through player, sound names resolving in theme; muted reports the default sink muted.
func (*Announcer) Announce ¶
func (a *Announcer) Announce(n *notifications.Notification)
Announce plays n's sound when the policy, do-not-disturb, a share and the sink's mute all let it.
func (*Announcer) Run ¶
func (a *Announcer) Run(events <-chan notifications.Event)
Run follows the service's feed until stop, playing each new notification's sound.
func (*Announcer) SetPolicy ¶
func (a *Announcer) SetPolicy(p soundpolicy.Policy)
SetPolicy replaces the sound configuration.
type Player ¶
type Player interface {
PlaySample(ctx context.Context, p native.SamplePlay, load func() (native.Sample, error)) error
}
Player plays a sample through the audio server's cache, loading it on the first play (*pulse.Service).
type Theme ¶
type Theme struct {
// contains filtered or unexported fields
}
Theme resolves sound names in a sound theme and those it inherits, over the XDG data directories.