Search guides and the APICtrl K
  1. API reference
  2. System, devices and network

system_volume.h

SystemAudioVolume: the machine's master output level and mute.

#include <sonore/system_volume.h>
On this page

Design notes

The volume and mute of the default output device -- the ones the speaker icon in the taskbar or the menu bar changes. Windows reaches them through the default render endpoint's IAudioEndpointVolume, macOS through the default output device's virtual main volume (the property the volume keys drive), Linux through ALSA's "Master" mixer control, falling back to "PCM".

Whose setting this is

It is the USER's, for everything on the machine, which is why nothing in this SDK calls the setters on its own. They are here for an application that is asked to -- a practice tool with its own volume keys, a kiosk -- and a plugin has no business reaching for them. Reading is harmless; a meter that wants to warn "your system volume is muted" is the honest use.

Gains are the OS's own scale

0..1 as each system defines it: Windows and macOS hand out an audio-tapered scalar (what their sliders show), ALSA a raw control range mapped linearly (what alsamixer's raw view shows). None of them is decibels, and the three do not agree with each other at 0.5 -- converting would need each device's own curve, which only Windows publishes.

Linux

libasound is dlopened, exactly as the ALSA audio backend does it: the SDK builds without ALSA's development package, and a machine without ALSA says isAvailable() == false instead of refusing to load the plugin. A PipeWire or PulseAudio desktop routes "default" through its own ALSA plugin, whose Master control is the desktop's volume.

Every call opens the device, does one thing and closes it: these are rare calls from a UI, and holding a mixer or an endpoint open between them would pin a device the user may unplug. Never from the audio thread.

Types 1

The system's master output gain and mute. All static, as the reference's: there is one master volume per machine.

↑↓ to move↵ to openEvery public name in the headers, and every guide