Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Set volume globally



  • Hi,
    is it possible to globally set volume of audio output of my application?

    I have several QSoundEffect sounds in my QML application. I thought about the possibility to set some global context variable (double with 0.0 to 1.0 value) to QML and then use it in my sounds:

    SoundEffect {
            volume: 0.25 * myGlobalVolume
        }
    

    However, is there a better way to achieve this?


  • Lifetime Qt Champion

    Hi,

    Do you mean something like a VolumeController object that has a volume property ? You could set it using setContextProperty, then it would be available to your effects.

    Hope it helps.


Log in to reply