Skip to content

Volume scale in programmatic interfaces

This is about interfaces such as the CLI or HTTP API, that have a volume command using integers on a scale where 256 is 100% volume. This value actually comes from the AOUT_VOLUME_DEFAULT and AOUT_VOLUME_MAX macros. They seem like internal implementation details, or perhaps leftovers from a previous one - that's not how the core currently handles volume.

As for the user, this scale would be rather arbitrary. But even then there are issues: AOUT_VOLUME_DEFAULT isn't exposed to lua, so for example the web interface's front end hardcodes that scale value.

Yet another piece of the current situation is that in 4.0, the C CLI's scale was silently changed, in https://git.videolan.org/?p=vlc.git;a=commitdiff;h=46ea30cd17ef8a33eceac23fdd1c2506ad51c00c This isn't a GUI volume slider whose change users will naturally deal with and maybe not even notice. This is a breaking change and an issue, both for users expecting to type in a number and not get their speakers blowing up with 256% volume, and for scripts or external applications interfacing with the CLI.

As I said, the current 256 scale is arbitrary from the user's point of view. It could be something that makes more sense, like a percentage (makes sense to me, but there may be cultural bias), a dB value, or something else. But changing it would be a breaking change, so technically the way to go would be to introduce a new command using the new scale, in parallel to the old one.

I haven't commented on maximum values and upper bounds for the scale; I'm not clear what the exact purpose of AOUT_VOLUME_MAX is and what happens with values above it.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information