I have the following quite simple audioCallBack code to receive 8 channels of audio from a MOTU 828es, mix to 2 channels and send them over a socket connection to a node.js server:
void audioCallBack::audioDeviceIOCallbackWithContext (const float* const* inputChannelData,
int numInputChannels,
float* const* outputChannelData,
int numOutputChannels,
int numSamples,
const juce::AudioIODeviceCallbackContext& context)
{
for (int channel = 0; channel < numInputChannels; ++channel) {
if (inputChannelData[channel] == nullptr) {
DBG("inputChannelData[" << channel << "] is null");
}
}
// Ensure that there are exactly 2 output channels
jassert(numOutputChannels == 2);
// Process the incoming audio data
for (int sampleNo = 0; sampleNo < numSamples; ++sampleNo) {
float leftTotal = 0.0f;
float rightTotal = 0.0f;
for (int channel = 0; channel < numInputChannels; ++channel) {
const float* inputData = inputChannelData[channel];
if (inputData[sampleNo] != 0.0f)
DBG(inputData[sampleNo]);
leftTotal += inputData[sampleNo] * speakerConfig.speakers[channel]->leftGain;
rightTotal += inputData[sampleNo] * speakerConfig.speakers[channel]->rightGain;
}
// send samples to TCPConnection
if (tcpConnection != nullptr) {
tcpConnection->sendSamples(leftTotal, rightTotal);
}
}
}
From the output, I see that I do have inputChannelData (no nullPtr), but that the samples are always 0. This is confirmed on the node.js server side, where I am accumulating sample buffers, but with all sample values at 0. The code is working on a Windows machine, but not on my MacBook Pro. I am working under OSX 14.5 and am using the version 8.00 of JUCE. I put a similar request on the general discussion, but after no resolution there thought it might be more appropriate in the Apple discussion.