Can't understand the reasons behind complaints; "QAudioInput: failed to set input volume" and "Got a buffer underflow!"?
-
Is it the right branch to post this question,? In which branch should I post this so that I have higher probability of getting an answer? Is the way I have formulated the question is a hindrance to getting any answer at all?
-
Hi and welcome to devnet,
Please allow 24 to 48 hours before bumping your own thread. This forum is community driven and not all people lives in the same timezone as you.
That said, both problems comes from Pulse. Is it working properly ?
-
Hi,
thanks for the reply. Well I'm not sure if pulse is working correctly all the time. It seems unpredictable sometimes. Although I can't see these complaints in windows, but they are persistent in linux.Anyway, I have changed my application as I don't need any more server client connection. Currently all I'm doing is a simple redirecting of QAudioInput to QAudioOutput. The main methods for that are as below:
void MainWindow::on_startButton_clicked() { QAudioDeviceInfo inputDevinfo = ui->inputDevice->itemData(ui->inputDevice->currentIndex()).value<QAudioDeviceInfo>(); QAudioFormat audioFormat; audioFormat.setChannelCount(2); audioFormat.setCodec("audio/pcm"); audioFormat.setSampleRate(44100); audioFormat.setSampleSize(16); audioFormat.setByteOrder(QAudioFormat::LittleEndian); audioFormat.setSampleType(QAudioFormat::SignedInt); if (!inputDevinfo.isFormatSupported(audioFormat)) { //Default format not supported - trying to use nearest audioFormat = inputDevinfo.nearestFormat(audioFormat); } m_audioInput = new QAudioInput(inputDevinfo, audioFormat, this); QAudioDeviceInfo outputDevinfo = ui->outputDevice->itemData(ui->outputDevice->currentIndex()).value<QAudioDeviceInfo>(); if (!outputDevinfo.isFormatSupported(audioFormat)) { //Default format not supported - trying to use nearest audioFormat = outputDevinfo.nearestFormat(audioFormat); } m_audioOutput = new QAudioOutput(outputDevinfo, audioFormat, this); m_audioOutput->start(m_audioInput->start()); } void MainWindow::on_stopButton_clicked() { m_audioOutput->stop(); m_audioInput->stop(); m_audioOutput->~QAudioOutput(); m_audioInput->~QAudioInput(); }
Despite such simple approach of redirecting, where all the memory is supposedly dealt natively by Qt, there are at times complaints like "QAudioInput: failed to set input volume" and "Got a buffer underflow!". The application seems to work smoothly, but not quite dependable enough as the behaviour differs with different input and output devices. I have no idea what could be the problem. Is it the problem with my code or is there a bug in Qt's Audio module? The issues seem persistent in linux, in Windows I haven't faced many issues.
I didn't want to flood my response with codes, so if you want to fully test the code you can get it from the following Dropbox link.
https://www.dropbox.com/s/qwckg9midiqgp4q/duplexaudio.zip?dl=0Well, just checked this code in my windows system. I cannot hear any sound there at all. So, in linux it complains "QAudioInput: failed to set input volume" and "Got a buffer underflow!" and in windows, no sound at all, but no complaints. Do you have any idea why such is the case?
Thanks.
-
Calling a destructor like that is not the right way to delete an object. Either use the delete operator or, since they are QObject derived classes, deleteLater.
Did you found a pattern when these messages can be seen ?
-
Thank you for an important rectification of my code.
As for the pattern, well, the code runs in Linux, it complains "QAudioInput: failed to set input volume" exactly when QAudioInput object is started by calling the start() function, while "Got a buffer underflow!" is rather an unpredictable complaint, I couldn't find a definitive stage when it would make that complaint.
As I have told you in the previous response, this approach of redirecting QAudioInput object to QAudioOutput object produces mere quietness in Windows, but the approach shown in this link:
http://www.codeproject.com/Articles/421287/Cross-Platform-Microphone-Audio-Processing-Utility
works perfectly in Windows, yet produces rampant "Got a buffer underflow!" complaints and eventual crash in Linux. The project from that link itself, when run in Linux leads to an eventual crash along with the aforementioned complaints, while running smoothly in Windows.Why is such different behaviour for two different operating systems?
-
Because both platform have rather radically different multimedia frameworks. Windows has DirectX and the Windows Media Foundation and linux has e.g. Pulse, GStreamer.
-
So, this sort of difference should be expected then? Should I be worried that the code that actually manages to do the job is different for two different OS or this is normal in this case?
I'm sorry, I'm rather new and inexperienced, so I've these questions.
Thanks!
-
Yes, it is to be expected, every OS is different so there will be differences. Qt abstracts them away for you quite nicely however there will some points where what the OS supports will show some differences. e.g. QMediaPlayer will play video on all OSes however Windows might require some additional Codecs to be installed where Linux would already read them because the default installed packages has supports for them already.
-
I'd say probably, but right now I don't know what might be interfering here to trigger that message.