Un-balls the merge.

This commit is contained in:
louis
2017-01-25 13:42:18 +00:00
parent 9a9227edb8
commit 195f1a3611

View File

@@ -57,20 +57,15 @@ static unsigned samplesIn[2][MAX(NUM_USB_CHAN_IN, IN_CHAN_COUNT)];
#undef SPDIF_RX #undef SPDIF_RX
#endif #endif
static int inDownsamplingCounter = 0;
#if (I2S_DOWNSAMPLE_FACTOR_IN > 1)
#include "src.h"
#endif // (I2S_DOWNSAMPLE_FACTOR_IN > 1)
#ifndef I2S_UPSAMPLE_FACTOR_OUT #ifndef I2S_UPSAMPLE_FACTOR_OUT
#define I2S_UPSAMPLE_FACTOR_OUT 1 #define I2S_UPSAMPLE_FACTOR_OUT (1)
#endif #endif
static int inDownsamplingCounter = 0;
static int outUpsamplingCounter = 0; static int outUpsamplingCounter = 0;
#if (I2S_UPSAMPLE_FACTOR_OUT > 1) #if (I2S_DOWNSAMPLE_FACTOR_IN > 1) || (I2S_UPSAMPLE_FACTOR_OUT > 1)
#include "src.h" #include "src.h"
static int32_t us3OutputDelayLine[I2S_CHANS_DAC][24]; #endif // (I2S_DOWNSAMPLE_FACTOR_IN > 1)
#endif /* (I2S_UPSAMPLE_FACTOR_OUT > 1) */
#if (DSD_CHANS_DAC != 0) #if (DSD_CHANS_DAC != 0)
extern buffered out port:32 p_dsd_dac[DSD_CHANS_DAC]; extern buffered out port:32 p_dsd_dac[DSD_CHANS_DAC];
@@ -526,8 +521,13 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
#endif // (I2S_DOWNSAMPLE_FACTOR_IN > 1) #endif // (I2S_DOWNSAMPLE_FACTOR_IN > 1)
#if (I2S_UPSAMPLE_FACTOR_OUT > 1) #if (I2S_UPSAMPLE_FACTOR_OUT > 1)
memset(us3OutputDelayLine, 0, sizeof us3OutputDelayLine); union us3Data
#endif {
long long doubleWordAlignmentEnsured;
int32_t outputDelayLine[I2S_CHANS_DAC][24];
} us3Data;
memset(&us3Data.outputDelayLine, 0, sizeof us3Data.outputDelayLine);
#endif // (I2S_UPSAMPLE_FACTOR_OUT > 1)
unsigned command = DoSampleTransfer(c_out, readBuffNo, underflowWord, i_audMan); unsigned command = DoSampleTransfer(c_out, readBuffNo, underflowWord, i_audMan);
@@ -568,7 +568,6 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
while (!syncError) while (!syncError)
#endif // CODEC_MASTER #endif // CODEC_MASTER
{ {
#if (DSD_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT > 0) #if (DSD_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT > 0)
if(dsdMode == DSD_MODE_NATIVE) if(dsdMode == DSD_MODE_NATIVE)
{ {
@@ -755,18 +754,17 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
{ {
#if (I2S_UPSAMPLE_FACTOR_OUT > 1) #if (I2S_UPSAMPLE_FACTOR_OUT > 1)
if(outUpsamplingCounter == 0) { if(outUpsamplingCounter == 0) {
samplesOut[frameCount+i] = src_us3_voice_input_sample(us3OutputDelayLine[i], samplesOut[frameCount+i] = src_us3_voice_input_sample(us3Data.outputDelayLine[i],
src_ff3v_fir_coefs[2], src_ff3v_fir_coefs[2],
samplesOut[frameCount+i]); samplesOut[frameCount+i]);
} else { /* outUpsamplingCounter is 1 or 2 */ } else { /* outUpsamplingCounter is 1 or 2 */
samplesOut[frameCount+i] = src_us3_voice_get_next_sample(us3OutputDelayLine[i], samplesOut[frameCount+i] = src_us3_voice_get_next_sample(us3Data.outputDelayLine[i],
src_ff3v_fir_coefs[2-outUpsamplingCounter]); src_ff3v_fir_coefs[2-outUpsamplingCounter]);
} }
#endif /* (I2S_UPSAMPLE_FACTOR_OUT > 1) */ #endif /* (I2S_UPSAMPLE_FACTOR_OUT > 1) */
p_i2s_dac[index++] <: bitrev(samplesOut[frameCount +i]); p_i2s_dac[index++] <: bitrev(samplesOut[frameCount +i]);
} }
#endif #endif // (I2S_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT != 0)
#ifndef CODEC_MASTER #ifndef CODEC_MASTER
/* Clock out the LR Clock, the DAC data and Clock in the next sample into ADC */ /* Clock out the LR Clock, the DAC data and Clock in the next sample into ADC */
@@ -899,26 +897,14 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
{ {
#if (I2S_UPSAMPLE_FACTOR_OUT > 1) #if (I2S_UPSAMPLE_FACTOR_OUT > 1)
if(outUpsamplingCounter == 0) { if(outUpsamplingCounter == 0) {
samplesOut[frameCount+i] = src_us3_voice_input_sample(us3OutputDelayLine[i], samplesOut[frameCount+i] = src_us3_voice_input_sample(us3Data.outputDelayLine[i],
src_ff3v_fir_coefs[2], src_ff3v_fir_coefs[2],
samplesOut[frameCount+i]); samplesOut[frameCount+i]);
} else { /* outUpsamplingCounter is 1 or 2 */ } else { /* outUpsamplingCounter is 1 or 2 */
samplesOut[frameCount+i] = src_us3_voice_get_next_sample(us3OutputDelayLine[i], samplesOut[frameCount+i] = src_us3_voice_get_next_sample(us3Data.outputDelayLine[i],
src_ff3v_fir_coefs[2-outUpsamplingCounter]); src_ff3v_fir_coefs[2-outUpsamplingCounter]);
} }
#endif /* (I2S_UPSAMPLE_FACTOR_OUT > 1) */ #endif /* (I2S_UPSAMPLE_FACTOR_OUT > 1) */
p_i2s_dac[index++] <: bitrev(samplesOut[frameCount + i]);
}
#endif
#ifndef CODEC_MASTER
doI2SClocks(divide);
#endif
}
else
{
p_i2s_dac[index++] <: bitrev(samplesOut[frameCount + i]); p_i2s_dac[index++] <: bitrev(samplesOut[frameCount + i]);
} }
#endif // (I2S_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT != 0) #endif // (I2S_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT != 0)