Details
-
Bug
-
Resolution: Incomplete
-
P2: Important
-
None
-
6.2.8
-
-
Multimedia Next Next
Description
OS: Ubuntu 22.04
Description: When you try to read quad channel audio data from the input device with QAudioSource, it will always read as if the number of channels is defined as 2.
Here is CE:
void ReadAudioThread::readQuadAudioData() { m_inputBuffer.setBuffer(nullptr); m_inputBuffer.open(QIODevice::WriteOnly | QIODevice::Truncate); QAudioFormat format; format.setSampleRate(m_defaultSampleRate); format.setChannelCount(m_quadNumChannels); // defined as 4 format.setSampleFormat(QAudioFormat::Int16); QAudioDevice inputDevice = getInputAudioDevice(); m_audio = new QAudioSource(inputDevice, format); connect(m_audio, &QAudioSource::stateChanged, this, &ReadAudioThread::handleStateChanged); createRecordingFile(); m_timer = std::make_shared<QTimer>(); m_timer->setInterval(200); // 200 msec. m_timer->callOnTimeout(this, &ReadAudioThread::reportReadProgress); m_audio->start(&m_inputBuffer); ... }
Even when the channels number is explicitly specified as 4 in the format.setChannelCount(), data for channels 3 and 4 repeats data for channels 1 and 2 in the {}m_inputBuffer.
P.S. Format is supported by the device