Sinks, sources, sink inputs and samples can all have their own volumes. To deal with these, The PulseAudio libray contains a number of functions that ease handling.
Volumes commonly span between muted (0%), and normal (100%). It is possible to set volumes to higher than 100%, but clipping might occur.
The volumes in PulseAudio are logarithmic in nature and applications shouldn't perform calculations with them directly. Instead, they should be converted to and from either dB or a linear scale:
Calculations can only be reliably performed on software volumes as it is commonly unknown what scale hardware volumes relate to.
The functions described above are only valid when used with software volumes. Hence it is usually a better idea to treat all volume values as opaque with a range from PA_VOLUME_MUTED (0%) to PA_VOLUME_NORM (100%) and to refrain from any calculations with them.
To handle the pa_cvolume structure, the PulseAudio library provides a number of convenienc functions: