Ubuntu – How to adjust system volume from within XBMC

volume-controlxbmc

While running XBMC, I can adjust the volume of the XBMC application itself. However, this volume is limited by the current system volume. For example, if the system volume is at 80% and XBMC is at 100%, I am effectively at 80% and cannot go higher. Or if the sound is too soft and needs a boost, I would normally increase the system volume beyond 100%.

XBMC takes over the whole screen, so the system volume is not accessible. Pressing the Super key brings up the dash and top menu, but clicking on it is difficult and inconsistent, and very quickly XBMC takes over the screen again.

How can I adjust the system volume without having to quit XBMC?

Best Answer

I had the same problem, that's why I wrote a little script to start xbmc that first gets the current volume, then sets the system volume to 100%, starts xbmc, and after exiting, resets the volume to the original level. That way controlling the volume in xbmc is the same as controlling the system volume since the system volume is on max.
Here is the script:

device=1
volume=$(pacmd list-sinks | sed "1,/index: ${device}/d" | grep volume | head -1 | awk ' {print $3}')
mute=$(pacmd list-sinks | sed "1,/index: ${device}/d" | grep muted | awk ' {print $2}')
pactl set-sink-mute $device 0
pactl set-sink-volume   $device 100%
xbmc 
pactl set-sink-volume   $device $volume
if [[ $mute == "yes" ]]
then
pactl set-sink-mute $device 1
fi
exit;

The first line sets your audio device id. I have hdmi (device 0) and analog (device 1), you can check this with alsamixer or pacmd list-sinks. It also automatically unmutes your system, and when you exit xbmc it mutes it again if it was previously muted.

Note: you can also boost your volume to 150 instead if you find the volume too low, however you can also do this in xbmc in the audio osd settings.