2

I'm trying to use Qt5 Multimedia to record audio with QAudioInput. I noticed, however, that when my QAudioInput starts, it raises the master volume of my sound device to 100%.

How can I prevent QAudioInput from changing the master volume?

My current development platform is Linux with PulseAudio (with flat audio disabled).

This is how I'm using QAudioInput:

QAudioDeviceInfo device_info = QAudioDeviceInfo::defaultInputDevice();

QAudioFormat format;
format.setSampleRate(44100);
format.setChannelCount(1);
format.setSampleSize(16) ;
format.setCodec("audio/pcm");
format.setSampleType(QAudioFormat::SignedInt);
format.setByteOrder(QAudioFormat::LittleEndian);

std::cout << device_info.deviceName().toUtf8().constData() << std::endl;
QAudioInput *default_device = new QAudioInput(device_info, format);

QIODevice *default_io_device = default_device->start();
Joshua
  • 1,148
  • 3
  • 17
  • 34
  • 1
    Since I have observed similar behaviour and after trying several options I have concluded it is a bug in Qt and hence I opened a bug report - https://bugreports.qt.io/browse/QTBUG-47148 – Hemant Kumar Jul 11 '15 at 16:47

1 Answers1

0

There is a QAudioInput.setVolume() method if you have not seen. Having said that, I tried using QAudioRecorder.setVolume() and Qt is telling me - "Setting volume while recording is not supported".

Hemant Kumar
  • 1,988
  • 2
  • 13
  • 21