On Tue, 28.04.09 14:43, pl bossart (bossart.nospam at gmail.com) wrote: > Lennart, heya, > I wasn't really addressing the difference between sink and stream > volume. Your answer on which volumes are saved when was extremely > interesting and educational, but my concern was: 'how do I prevent the > user from setting a volume (stream or sink) that is too high when > he/she plays with the sliders. I understand some people want to boost > their volume of their poorly mastered tracks, but for most products > you want to avoid being too loud. I think there's even a EU directive > that the sound cannot be louder than xx dB for mobile devices. > Likewise iPods provide a means to lock the max volume. How would we go > about that in a PulseAudio/ALSA context. Ah, I see. dB in this case refers to SPL or something like that I guess? Hmm, in ALSA the dB scales are only very vaguely defined, there is no established reference level for the sliders. On the inner volume sliders 0dB usually means 'no attenuation/amplification compared to the previous element`. On the outer ones 0dB can however mean everything. On my USB speakers 0dB is max amplification. On many other drivers the reference level is some specific 'standard' voltage, and on others a different 'standard' voltage. What we'd need is some way that we can determine the SPL from the mixer settings and the actual signal. That's a bit hard if we don't even know which reference level those mixer dB values use. In addition, the SPL depends on the speakers too, I guess. If we had the replay gain logic in PA I mentioned then we'd have an easy way to query the 'loudness' of a specific stream. What's left to do then is adding an ALSA API to query the reference level of a mixer element (if it is known) or how it translates to dB SPL. The actual policy module would then be easy to write. Lennart -- Lennart Poettering Red Hat, Inc. lennart [at] poettering [dot] net ICQ# 11060553 http://0pointer.net/lennart/ GnuPG 0x1A015CC4