I struggle reading data from a QAudioInput. What I'd like to do is read data from the buffer in chunks and then perform some processing on it. I don't want to write the data stream to a file as in most examples.
What I tried is this:
audioInput = new QAudioInput(info);
audioInput->setBufferSize(buffer_size);
audioInput->setNotifyInterval(250);
qDebug() << "Error = " << audioInput->error();
audioIODevice = audioInput->start();
qDebug() << "dev=" << audioIODevice;
It seems that I can create the QAudioInput object. However, when I start it I get a null pointer back as QIODevice. Based on the documentation...
QIODevice *QAudioInput::start()
Returns a pointer to the internal QIODevice being used to transfer data from the system's audio input. The device will already be open and read() can read data directly from it.
... I'd have expected to get back a valid handle.
The device I try to read from is reported as "alsa_input.usb-Logitech_Logitech_USB_Headset-00.mono-fallback", in case this matters.