diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9234b25e..0e88288c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,11 +1,12 @@ sc_usb_audio Change Log ======================= -7.0.2 +7.1.0 ----- - ADDED: UserBufferManagementInit() to reset any state required in UserBufferManagement() - ADDED: I2S output up-sampling (I2S_UPSAMPLE_FACTOR_OUT) - CHANGE: Rename I2S input down-sampling (I2S_DOWNSAMPLE_FACTOR to I2S_DOWNSAMPLE_FACTOR_IN) + - RESOLVED: Crosstalk between input channels when I2S input down-sampling is enabled 7.0.1 ----- diff --git a/module_usb_audio/audio_io/audio_io.xc b/module_usb_audio/audio_io/audio_io.xc index 1be435d5..f7f3d621 100755 --- a/module_usb_audio/audio_io/audio_io.xc +++ b/module_usb_audio/audio_io/audio_io.xc @@ -700,27 +700,29 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out, #endif // I2S_MODE_TDM #endif // CODEC_MASTER - /* Note the use of readBuffNo changes based on frameCount */ - samplesIn[buffIndex][((frameCount-2)&(I2S_CHANS_PER_FRAME-1))+i] = bitrev(sample); // channels 0, 2, 4.. on each line. + sample = bitrev(sample); + int chanIndex = ((frameCount-2)&(I2S_CHANS_PER_FRAME-1))+i; // channels 0, 2, 4.. on each line. #if (USB_TO_AUD_RATIO > 1) if ((USB_TO_AUD_RATIO - 1) == usbToAudioRatioCounter) { - samplesIn[readBuffNo][((frameCount-2)&(I2S_CHANS_PER_FRAME-1))] = + samplesIn[buffIndex][chanIndex] = src_ds3_voice_add_final_sample( - i2sInDs3Sum[((frameCount-2)&(I2S_CHANS_PER_FRAME-1))+i], - i2sInDs3.delayLine[((frameCount-2)&(I2S_CHANS_PER_FRAME-1))+i][usbToAudioRatioCounter], + i2sInDs3Sum[chanIndex], + i2sInDs3.delayLine[chanIndex][usbToAudioRatioCounter], src_ff3v_fir_coefs[usbToAudioRatioCounter], - samplesIn[readBuffNo][((frameCount-2)&(I2S_CHANS_PER_FRAME-1))]); + sample); } else { - i2sInDs3Sum[((frameCount-2)&(I2S_CHANS_PER_FRAME-1))+i] = + i2sInDs3Sum[chanIndex] = src_ds3_voice_add_sample( - i2sInDs3Sum[((frameCount-2)&(I2S_CHANS_PER_FRAME-1))+i], - i2sInDs3.delayLine[((frameCount-2)&(I2S_CHANS_PER_FRAME-1))+i][usbToAudioRatioCounter], - src_ff3v_fir_coefs[usbToAudioRatioCounter], - samplesIn[readBuffNo][((frameCount-2)&(I2S_CHANS_PER_FRAME-1))]); + i2sInDs3Sum[chanIndex], + i2sInDs3.delayLine[chanIndex][usbToAudioRatioCounter], + src_ff3v_fir_coefs[usbToAudioRatioCounter], + sample); } +#else + samplesIn[buffIndex][chanIndex] = sample; #endif /* (USB_TO_AUD_RATIO > 1) */ } #endif @@ -850,28 +852,30 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out, #endif // I2S_MODE_TDM #endif // CODEC_MASTER - samplesIn[buffIndex][((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i] = bitrev(sample); // channels 1, 3, 5.. on each line. -#if ((USB_TO_AUD_RATIO > 1) && !I2S_DOWNSAMPLE_MONO_IN) + sample = bitrev(sample); + int chanIndex = ((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i; // channels 1, 3, 5.. on each line. +#if (USB_TO_AUD_RATIO > 1) if ((USB_TO_AUD_RATIO - 1) == usbToAudioRatioCounter) { - samplesIn[buffIndex][((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i] = + samplesIn[buffIndex][chanIndex] = src_ds3_voice_add_final_sample( - i2sInDs3Sum[((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i], - i2sInDs3.delayLine[((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i][usbToAudioRatioCounter], + i2sInDs3Sum[chanIndex], + i2sInDs3.delayLine[chanIndex][usbToAudioRatioCounter], src_ff3v_fir_coefs[usbToAudioRatioCounter], - samplesIn[readBuffNo][((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i]); + sample); } else { - i2sInDs3Sum[((frameCount-2)&(I2S_CHANS_PER_FRAME-1))+i] = + i2sInDs3Sum[chanIndex] = src_ds3_voice_add_sample( - i2sInDs3Sum[((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i], - i2sInDs3.delayLine[((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i][usbToAudioRatioCounter], - src_ff3v_fir_coefs[usbToAudioRatioCounter], - samplesIn[readBuffNo][((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i]); + i2sInDs3Sum[chanIndex], + i2sInDs3.delayLine[chanIndex][usbToAudioRatioCounter], + src_ff3v_fir_coefs[usbToAudioRatioCounter], + sample); } -#endif /* ((USB_TO_AUD_RATIO > 1) && !I2S_DOWNSAMPLE_MONO_IN) */ - +#else + samplesIn[buffIndex][chanIndex] = sample; +#endif /* (USB_TO_AUD_RATIO > 1) */ } #endif