Qt World Summit: Submit your Presentation

QAudioOutput::setVolume not working correctly ?

  • i everyone !
    As the title suggest, I'm having an issue with QAudioOutput::setVolume .

    It works fine until I reach 50% (0.5).
    Can someone try and tell me if it's a bug or if I did something wrong please ?

    To check if it works correctly, you can try to link it to a slider (0-100 range), signal-slot it, set it to the QAudioOuput volume (don't forget to divide it by 100 to get it from 0 to 1) and check in your windows mixer if your app move beyond 50%.

    Thanks in advance for your help :) !

    Here is a minimalist code exemple :
    @void MainWindow::on_volumeSlider_valueChanged(int value)
    qreal newVolume = (qreal)value/100;
    qDebug() << QString::number(value) + "->" + QString::number(newVolume);
    //I access my audioOutput and set the volume after that

    showing : "10->0.1" etc... so it's working.
    Sound volume changes from 0 to 0.5, then after this I can't hear any difference and the windows mixer cursor doesn't move further than 50% which confirm volume isn't set up correctly beyond this.

    Edit : I also called the "volume" methode to see it the volume is correctly set, and it seems to be okay as it returns values from 0 to 1.
    I have no idea where the problem is.

  • No ideas ?

  • Couple of questions:

    • Which Qt version is this?
    • Which version of Windows are you using?
    • ...

    Please consider creating a report at: https://bugreports.qt-project.org/secure/Dashboard.jspa as well, where bug reports are usually handled.

  • Bug report created :).

    I'm on windows 7 64bits.
    Using Qt 5.0.2 32bits.

    Thanks for your concern ! :)

Log in to reply