Hi, I think I’ve found an error in AudioFormatReader::read()
When fillLeftoverChannelsWithCopies is set true the code executed is
[code]if (fillLeftoverChannelsWithCopies)
{
int* lastFullChannel = destSamples[0];
for (int i = numDestChannels; --i > 0;)
{
if (destSamples[i] != 0)
{
lastFullChannel = destSamples[i];
break;
}
}
if (lastFullChannel != 0)
for (int i = numChannels; i < numDestChannels; ++i)
if (destSamples[i] != 0)
memcpy (destSamples[i], lastFullChannel, sizeof (int) * numSamplesToRead);
}[/code]
I think the right one should be
if (fillLeftoverChannelsWithCopies)
{
int* lastFullChannel = destSamples[0];
for (int i = numChannels; --i > 0;)
{
if (destSamples[i] != 0)
{
lastFullChannel = destSamples[i];
break;
}
}
if (lastFullChannel != 0)
for (int i = numChannels; i < numDestChannels; ++i)
if (destSamples[i] != 0)
memcpy (destSamples[i], lastFullChannel, sizeof (int) * numSamplesToRead);
}
The difference is in the for cycle:
Bye bye!