forked from PAWPAW-Mirror/lib_xua
Un-balls the merge.
This commit is contained in:
@@ -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)
|
||||||
{
|
{
|
||||||
@@ -750,23 +749,22 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
|
|||||||
#if (I2S_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT != 0)
|
#if (I2S_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT != 0)
|
||||||
index = 0;
|
index = 0;
|
||||||
#pragma loop unroll
|
#pragma loop unroll
|
||||||
/* Output "even" channel to DAC (i.e. left) */
|
/* Output "even" channel to DAC (i.e. left) */
|
||||||
for(int i = 0; i < I2S_CHANS_DAC; i+=I2S_CHANS_PER_FRAME)
|
for(int i = 0; i < I2S_CHANS_DAC; i+=I2S_CHANS_PER_FRAME)
|
||||||
{
|
{
|
||||||
#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) */
|
|
||||||
|
|
||||||
p_i2s_dac[index++] <: bitrev(samplesOut[frameCount +i]);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* (I2S_UPSAMPLE_FACTOR_OUT > 1) */
|
||||||
|
p_i2s_dac[index++] <: bitrev(samplesOut[frameCount +i]);
|
||||||
|
}
|
||||||
|
#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 */
|
||||||
@@ -895,30 +893,18 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
|
|||||||
#if (I2S_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT != 0)
|
#if (I2S_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT != 0)
|
||||||
/* Output "odd" channel to DAC (i.e. right) */
|
/* Output "odd" channel to DAC (i.e. right) */
|
||||||
#pragma loop unroll
|
#pragma loop unroll
|
||||||
for(int i = 1; i < I2S_CHANS_DAC; i+=I2S_CHANS_PER_FRAME)
|
for(int i = 1; i < I2S_CHANS_DAC; i+=I2S_CHANS_PER_FRAME)
|
||||||
{
|
|
||||||
#if (I2S_UPSAMPLE_FACTOR_OUT > 1)
|
|
||||||
if(outUpsamplingCounter == 0) {
|
|
||||||
samplesOut[frameCount+i] = src_us3_voice_input_sample(us3OutputDelayLine[i],
|
|
||||||
src_ff3v_fir_coefs[2],
|
|
||||||
samplesOut[frameCount+i]);
|
|
||||||
} else { /* outUpsamplingCounter is 1 or 2 */
|
|
||||||
samplesOut[frameCount+i] = src_us3_voice_get_next_sample(us3OutputDelayLine[i],
|
|
||||||
src_ff3v_fir_coefs[2-outUpsamplingCounter]);
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif /* (I2S_UPSAMPLE_FACTOR_OUT > 1) */
|
|
||||||
|
|
||||||
p_i2s_dac[index++] <: bitrev(samplesOut[frameCount + i]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CODEC_MASTER
|
|
||||||
doI2SClocks(divide);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
#if (I2S_UPSAMPLE_FACTOR_OUT > 1)
|
||||||
|
if(outUpsamplingCounter == 0) {
|
||||||
|
samplesOut[frameCount+i] = src_us3_voice_input_sample(us3Data.outputDelayLine[i],
|
||||||
|
src_ff3v_fir_coefs[2],
|
||||||
|
samplesOut[frameCount+i]);
|
||||||
|
} else { /* outUpsamplingCounter is 1 or 2 */
|
||||||
|
samplesOut[frameCount+i] = src_us3_voice_get_next_sample(us3Data.outputDelayLine[i],
|
||||||
|
src_ff3v_fir_coefs[2-outUpsamplingCounter]);
|
||||||
|
}
|
||||||
|
#endif /* (I2S_UPSAMPLE_FACTOR_OUT > 1) */
|
||||||
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)
|
||||||
@@ -1383,13 +1369,13 @@ chanend ?c_config, chanend ?c
|
|||||||
|
|
||||||
/* Currently no more audio will happen after this point */
|
/* Currently no more audio will happen after this point */
|
||||||
if ((curSamFreq / I2S_DOWNSAMPLE_FACTOR_IN) == AUDIO_STOP_FOR_DFU)
|
if ((curSamFreq / I2S_DOWNSAMPLE_FACTOR_IN) == AUDIO_STOP_FOR_DFU)
|
||||||
{
|
{
|
||||||
outct(c_mix_out, XS1_CT_END);
|
outct(c_mix_out, XS1_CT_END);
|
||||||
|
|
||||||
outuint(c_mix_out, 0);
|
outuint(c_mix_out, 0);
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
#if XUD_TILE != 0
|
#if XUD_TILE != 0
|
||||||
[[combine]]
|
[[combine]]
|
||||||
par
|
par
|
||||||
@@ -1402,12 +1388,12 @@ chanend ?c_config, chanend ?c
|
|||||||
#endif
|
#endif
|
||||||
curSamFreq = inuint(c_mix_out);
|
curSamFreq = inuint(c_mix_out);
|
||||||
|
|
||||||
if (curSamFreq == AUDIO_START_FROM_DFU)
|
if (curSamFreq == AUDIO_START_FROM_DFU)
|
||||||
{
|
{
|
||||||
outct(c_mix_out, XS1_CT_END);
|
outct(c_mix_out, XS1_CT_END);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* NO_USB */
|
#endif /* NO_USB */
|
||||||
|
|
||||||
@@ -1430,5 +1416,5 @@ chanend ?c_config, chanend ?c
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user