0 sample values in audioCallBack::audioDeviceIOCallbackWithContext

I am getting 0 sample values in my audioDeviceIOCallbackwithContext function. I have this simple code:

for (int sampleNo = 0; sampleNo < numSamples; ++sampleNo) {
          for (int channel = 0; channel < numInputChannels; ++channel) {
              const float* inputData = inputChannelData[channel];
              if (inputData != nullptr && inputData[sampleNo] != 0.0f) {
                  DBG("Input sample[" << channel << "][" << sampleNo << "]: " << inputData[sampleNo]);"
              }
          }
      }
    noCallbacks++;
    DBG(noCallbacks);

which just generates incremental callback values.

I have tried it when connected to both a Presonus 64S and a MOTU 828es. I can see USB channels active when I use a mixer in a DAW.

In my MainComponent, I have:

// Initialize and configure deviceManager here if needed
    error = deviceManager.initialise(8, 2, nullptr, true);
    if (!error.isEmpty()) {
        // Handle initialization error
        DBG("AudioDeviceManager initialization failed: " + error);
    }
// Set the output device to "MacBook Pro Speakers"
    setup.outputDeviceName = "MacBook Pro Speakers";
    setup.inputDeviceName = "Studio 828es"; // Ensure input device is also set
// Apply the new device setup
    error = deviceManager.setAudioDeviceSetup(setup, true);
    if (!error.isEmpty()) {
        // Handle setup error
        DBG("AudioDeviceSetup failed: " + error);
    }
   // Verify the device setup
    setup = deviceManager.getAudioDeviceSetup();
    DBG("Input and Output device names after applying setup: ");
// Add the audio callback
    deviceManager.addAudioCallback(&AudioCallBack);
    AudioCallBack.startAudioProcessing()

I get the following output from the device manager setup:

Input and Output device names after applying setup:
Studio 828es
MacBook Pro Speakers

Everything seems to work as expected except for no audio! Any guidance would be much appreciated.

Apologies, my code looks a mess - need to figure how to edit! But looking better now :slightly_smiling_face:

Have you set up the audio input permissions?

Thanks for the response - I haven’t - I will see how to do that and try! I do see this in the RuntimePermissions class documentation - “On Windows, OS X, and Linux, runtime permissions are not
used at all.”

xenakios, you were quite right about permissions, thank you! I am working in XCode and running/debugging the app from there. I needed to go to the Info-App.plist file in the Resources window and add a row - “Privacy - Microphone Usage Description”. Then I was able to pick up audio from the MOTU 828es in the audioCallBack. If I run my app out of the XCode environment, then I can go to the Apple privacy settings and enable microphone access there. This does not seem very intuitive - changing microphone access to get audio device access! If you have another approach I would very much like to know it. Thanks again.