destSampleStrideSamples = bp->inputChannelCount;
destChannelStrideBytes = bp->bytesPerUserInputSample;
- /* process host buffer directly, or use temp buffer if formats differ or host buffer non-interleaved */
- if( bp->userInputSampleFormatIsEqualToHost && bp->hostInputIsInterleaved && bp->hostInputChannels[0][0].data)
+ /* process host buffer directly, or use temp buffer if formats differ or host buffer non-interleaved,
+ * or if the number of channels differs between the host (set in stride) and the user */
+ if( bp->userInputSampleFormatIsEqualToHost && bp->hostInputIsInterleaved
+ && bp->hostInputChannels[0][0].data && bp->inputChannelCount == hostInputChannels[0].stride )
{
userInput = hostInputChannels[0].data;
destBytePtr = (unsigned char *)hostInputChannels[0].data;
hostInputChannels[i].stride,
framesToCopy, &bp->ditherGenerator );
- destBytePtr += destChannelStrideBytes; /* skip to next source channel */
+ destBytePtr += destChannelStrideBytes; /* skip to next dest channel */
- /* advance dest ptr for next iteration */
+ /* advance source ptr for next iteration */
hostInputChannels[i].data = ((unsigned char*)hostInputChannels[i].data) +
framesToCopy * hostInputChannels[i].stride * bp->bytesPerHostInputSample;
}
destBytePtr += bp->bytesPerUserInputSample * framesToCopy;
nonInterleavedDestPtrs[i] = destBytePtr;
- /* advance dest ptr for next iteration */
+ /* advance source ptr for next iteration */
hostInputChannels[i].data = ((unsigned char*)hostInputChannels[i].data) +
framesToCopy * hostInputChannels[i].stride * bp->bytesPerHostInputSample;
}