private void waveIncoming( double[] l, double[] r, int length )
{
//int length = l.Length;
int offset = 0;
if ( mTrimRemain > 0 ) {
if ( length <= mTrimRemain ) {
mTrimRemain -= length;
return;
} else {
offset = mTrimRemain;
mTrimRemain = 0;
}
}
int remain = length - offset;
while ( remain > 0 ) {
int amount = (remain > BUFLEN) ? BUFLEN : remain;
for ( int i = 0; i < amount; i++ ) {
mBufferL[i] = l[i + offset];
mBufferR[i] = r[i + offset];
}
#if DEBUG
log.WriteLine( "waveIncoming; sending " + amount + " samples..." );
#endif
mReceiver.push( mBufferL, mBufferR, amount );
#if DEBUG
log.WriteLine( "waveIncoming; ...done." );
#endif
remain -= amount;
offset += amount;
mTotalAppend += amount;
}
}