It’s weird how I nominally know this but never really thought about the implications... How does the hardware world do it? I’d expect the normal way to make a volume control would be to have an adjustable-gain amplifier using the standard opamp circuit somewhere, but those aren’t logarithmic in any resistance you could wire to a knob, are they? (Yes, I am deeply ignorant about electronics.)
It's exactly as you sugggest/doubt - in audio hardware you use potentiometers (the thing under the knob that has different resistance depending on the rotation) that are designed to have logarithmic scale.
A lot of digital audio applications just do programmable gain in the digital domain. My main rig extends samples to 42 bits and attenuates in the digital domain, then dithers to 32 bits for the analog conversion.