Important: Please read the Qt Code of Conduct -

Obtaining system volume/mute settings.

  • I am running Qt 5.2.1. I am using QAudioOutput to play music for my Android application.

    On my tablet, if I mute the system sound and then run my application, sound plays.
    If I turn the system volume down to something very quiet and the run my application, sound plays at the default setting for the application.

    I would like my application to honor the system settings for volume (is it set on mute or vibrate? what is the system volume?). I understand that I cannot change these settings from my application within Qt (see, for example, "Change System Volume": -- that's fine.

    My question is not how do I change the system settings, but rather how do I simply obey them? Its problematic that someone might play my game in a meeting having muted the system sound and find that instead my game starts blaring music !

    I can google how to write the java code to try to get access to the settings for my android application (see, for example, "AudioManager": But using Qt, my goal is to by OS agnostic and be able to run under Windows as well. So my hope is that there is some way I am missing to sample the system state within Qt rather than having to make my own, OS dependent solution.

    Suggestions? Is there some way to do this within Qt that I am missing?



Log in to reply