We found a bug with input device mappings that is reproducible in the DemoRunner (using the Audio Recording demo). If we go into Audio Settings and disable input 1 with the intention to record using input 2 we get silence.
In debug mode it stops on the assert in the following function (tracktion_WaveInputDevice.cpp):
void copyIncomingDataIntoBuffer (const float* const* allChannels, int numChannels, int numSamples)
{
if (numChannels == 0)
return;
auto& wi = getWaveInput();
auto& channelSet = wi.getChannelSet();
inputBuffer.setSize (channelSet.size(), numSamples);
for (const auto& ci : wi.getChannels())
{
if (juce::isPositiveAndBelow (ci.indexInDevice, numChannels))
{
auto inputIndex = channelSet.getChannelIndexForType (ci.channel);
juce::FloatVectorOperations::copy (inputBuffer.getWritePointer (inputIndex),
allChannels[ci.indexInDevice], numSamples);
}
else
{
jassertfalse; // Is an input device getting created with more channels than the total number of device channels?
}
}
}
numChannels
appears to represent the total number of channels available and decreases when disabling an input in the settings. The if (juce::isPositiveAndBelow (ci.indexInDevice, numChannels))
compares the index of the enabled channels with numChannels so the assert will happen every time you disable any input but the last one.
On a two input interface these are the settings where we get unexpected results:
Mic in input 2, Settings input 1 disabled input 2 enabled, Track input 1+2: No sound
Mic in input 2, Settings input 1 disabled input 2 enabled, Track input 2: No sound (also arming turns off).
Mic in input 2, Settings input 1 disabled input 2 enabled, Track input 1: Sound (??)
Any idea what could be going on?