Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.8.0, 5.9.0
-
None
-
Windows 7, Qt 5.9.1 (and also verified in PyQt5)
Description
Reading the volume from the default input device always returns 0. Trying to write to it also does not work.
This seems to be a regression compared to Qt 5.7 and might be connected with a change in behavior of how the default device is determined. Instead of just taking the first device from the list of all devices, something more clever is done. Unlike Qt 5.7 the device's name in PyQt5.8+ is "Default Input Device" instead of the actual name.
Here is some code I ran on Windows 7 with Qt 5.9.1 and which shows the problem. The variable v0 should reflect the current volume settings but it's always 0.0. And the variable v1 should be 0.5 after the volume was set to 0.5 in the previous step, but it's always 0.0.
#include <iostream> #include <QAudioInput> using namespace std; int main() { QAudioInput* audio; { QAudioFormat format; // Set up the desired format, for example: format.setSampleRate(8000); format.setChannelCount(1); format.setSampleSize(8); format.setCodec("audio/pcm"); format.setByteOrder(QAudioFormat::LittleEndian); format.setSampleType(QAudioFormat::UnSignedInt); QAudioDeviceInfo info = QAudioDeviceInfo::defaultInputDevice(); if (!info.isFormatSupported(format)) { cout << "Default format not supported, trying to use the nearest."; format = info.nearestFormat(format); } audio = new QAudioInput(format); qreal v0 = audio->volume(); cout << "v0 = " << v0 << endl; // v0 is always 0.0 audio->setVolume(qreal(0.5)); qreal v1 = audio->volume(); cout << "v1 = " << v1 << endl; // v1 is always 0.0 (should be 0.5) } }
Attachments
Issue Links
- relates to
-
QTBUG-75024 QAudioInput forces to use 100% volume on initialization
- Closed
For Gerrit Dashboard: QTBUG-61920 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
208084,5 | Fix adjusting volume for default device | 5.11 | qt/qtmultimedia | Status: MERGED | +2 | 0 |