I wrote a simple audio univer, which should change the left and right channels of a stereo source. The ported version of this code worked fine in C for the command line, which used the BASS library, but I had a problem with the same code working in Xcode for an audio device.
To enter a buffer, for example, {1, 2, 3, 4, 5, 6}, I expect stereo reversal to be {2, 1, 4, 3, 6, 5}.
My code correctly changes the samples in this way, but all I hear is a kind of low-pass filtering, not a stereo-reversal of the samples.
The first 4 values ββin my input buffer are: 0.000104 0.000101 0.000080 0.000113
Output: 0.000101 0.000104 0.000113 0.000080
Did I not understand something about how I / O buffers are structured?
void First::FirstKernel::Process( const Float32 *inSourceP,
Float32 *inDestP,
UInt32 inSamplesToProcess,
UInt32 inNumChannels,
bool &ioSilence )
{
if (!ioSilence) {
const Float32 *sourceP = inSourceP;
Float32 *destP = inDestP;
for (int i = inSamplesToProcess/2; i>0; --i) {
*(destP+1) = *sourceP;
*destP = *(sourceP+1);
sourceP = sourceP +2;
destP = destP +2;
}
}
}