From c85d8206e209bcb69ebb6db08d5731be3f3d7bf4 Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 13 Feb 2017 08:37:07 +0000 Subject: [PATCH] Re-add support for I2S_DOWNSAMPLE_MONO_IN. --- module_usb_audio/audio_io/audio_io.xc | 9 ++++----- module_usb_audio/devicedefines.h | 4 +--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/module_usb_audio/audio_io/audio_io.xc b/module_usb_audio/audio_io/audio_io.xc index f7f3d621..c7884a5f 100755 --- a/module_usb_audio/audio_io/audio_io.xc +++ b/module_usb_audio/audio_io/audio_io.xc @@ -507,11 +507,10 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out, { long long doubleWordAlignmentEnsured; /* [Number of I2S channels][Number of samples/phases][Taps per phase] */ - /* TODO: Fix for mono */ - int32_t delayLine[I2S_CHANS_ADC][USB_TO_AUD_RATIO][24]; + int32_t delayLine[I2S_DOWNSAMPLE_CHANS_IN][USB_TO_AUD_RATIO][24]; } i2sInDs3; memset(&i2sInDs3.delayLine, 0, sizeof i2sInDs3.delayLine); - int64_t i2sInDs3Sum[I2S_CHANS_ADC]; + int64_t i2sInDs3Sum[I2S_DOWNSAMPLE_CHANS_IN]; union i2sOutUs3 { @@ -854,7 +853,7 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out, 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 && !I2S_DOWNSAMPLE_MONO_IN) if ((USB_TO_AUD_RATIO - 1) == usbToAudioRatioCounter) { samplesIn[buffIndex][chanIndex] = @@ -875,7 +874,7 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out, } #else samplesIn[buffIndex][chanIndex] = sample; -#endif /* (USB_TO_AUD_RATIO > 1) */ +#endif /* (USB_TO_AUD_RATIO > 1) && !I2S_DOWNSAMPLE_MONO_IN */ } #endif diff --git a/module_usb_audio/devicedefines.h b/module_usb_audio/devicedefines.h index eebb42ae..12a5058c 100644 --- a/module_usb_audio/devicedefines.h +++ b/module_usb_audio/devicedefines.h @@ -154,7 +154,6 @@ * @brief Only downsample one channel per input I2S frame. * * Default: 0 i.e. mono mode is disabled, all input channels will be downsampled. - * TODO: Remove this define or reintroduce support in audio_io.xc */ #ifndef I2S_DOWNSAMPLE_MONO_IN #define I2S_DOWNSAMPLE_MONO_IN (0) @@ -164,7 +163,6 @@ * @brief Number of incoming (device to host) I2S channels to downsample. * * Default: The number of I2S incoming channels, or half this if mono downsampling is enabled. - * TODO: Remove this define or reintroduce support in audio_io.xc */ #if (I2S_DOWNSAMPLE_MONO_IN == 1) #define I2S_DOWNSAMPLE_CHANS_IN (I2S_CHANS_ADC / 2) @@ -172,7 +170,7 @@ #error Mono I2S input downsampling is not avaliable in TDM mode #endif #else -#define I2S_DOWNSAMPLE_CHANS_IN I2S_CHANS_ADC + #define I2S_DOWNSAMPLE_CHANS_IN I2S_CHANS_ADC #endif /**