Unsolved Audio Input Example
-
Hi! I'm trying to run the Audio Input Example - running it in debug mode is all fine and dandy, but running it in release mode yields no data from the mic (the amplitude bar is not displaying anything), with an accompanying message:
- QIODevice::write (AudioInfo): device not open
Trying to debug if the QIODevice is open or not, returns "open".
Snippet from example, toggling between push and pull modes:
// Change bewteen pull and push modes if (m_pullMode) { m_modeButton->setText(tr("Enable push mode")); m_audioInput->start(m_audioInfo.data()); qDebug() << "Is device open?: " << m_audioInfo.data()->isOpen(); } else { m_modeButton->setText(tr("Enable pull mode")); auto io = m_audioInput->start(); qDebug() << "Is device open?: " << io->isOpen();
Any ideas?
Qt Creator 4.8.0
Based on Qt 5.12.0 (Clang 10.0 (Apple), 64 bit)
Mac OS Mojave 10.14.2Br,
Bjørn Rudi -
Hi and welcome to devnet,
Just a wild guess, but since Mojave, you may have to give permission to access the microphone to your application in release mode.
-
Thanks SGaist!
I'm able to make it work by navigating to the build folder and running the .app from there, with appropriate permissions - but still not working by running it from Qt creator.
Enabling "Run in terminal" enables the audio when running it from Qt Creator though..
/Bjorn
-
There might be something you can add to the plist file of the application but I currently don't know the exact key.
This article might also provide a solution in the mean time.
-
So tested the key:
NSMicrophoneUsageDescriptionas described in:
https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macosin a custom Info.plist (copy-pasted the default .plist and added the new key), defined in the .pro file with:
QMAKE_INFO_PLIST = Info.plistbut still no audio.
Resetting the microphone permissions (via tccutil) requires me to accept microphone usage when running the .app from e.g. finder, but will still not prompt me for mic .usage when running the application from Qt Creator in Release mode.
/Bjorn
-
Just found this thread:
https://forum.qt.io/topic/97570/macos-mojave-privacy-prompt-not-appearing-when-debugging-audio-app-in-qt-creator/6that deals with the same issue regarding microphone audio issues in Mojave. The solution does not seem to work for me. Interestingly, I get:
"Unable to load Info.plist exceptions (eGPUOverrides)"
when running the application in debug mode.