Audio Input Only 0


#1

Hi guys, I’m trying to get some audio input from my built in core audio mic, I make an audio device setup as follows:

setup.inputDeviceName           = //Core audio built in mic device name from scan
setup.useDefaultInputChannels   = false;
setup.inputChannels.setRange(0, 2, true);
setup.outputDeviceName          = //Core audio built in output device name from scan
setup.sampleRate                = 44100
setup.bufferSize                = 512
setup.useDefaultOutputChannels  = true;

//Apply the new audio device setup
String connectError = deviceManager.setAudioDeviceSetup(setup, true);

//We good?
jassert(connectError.isEmpty());

I add the audio callback to the device manager like this:

deviceManager.addAudioCallback(this);

After that I receive audio callbacks with 2 numInputChannels. The problem is that the input channels are always full of 0.f for some reason, what am I be missing? (I am getting audio input on the recording demo app, and don’t see how the initialise function is any different from settings the device setup manually?).


#2

Is this on macOS Mojave? You now need to request microphone access permission which can be done via the Projucer’s Xcode exporter:


#3

It is Mojave! Thank youuu! Which permission do I have to ask for? I tried this because I saw it in the recording app, but in the comments it said it’s only for Android. What I did was RuntimePermissions::isRequired(RuntimePermissions::recordAudio) and got a false.


#4

You’ll need to rebuild the Projucer from the develop branch and then enable this option in the Xcode exporter:


#5

Thanks! For a moment I thought I was going crazy. Is there a way to do this without the rebuild? Can I add a define somewhere?