I'm a newbie with Xmos looking for some advice as I dug my head in the libraries and got a bit confused!
I'm using the latest Xcore multichannel evaluation board. I want to set up a usb audio interface for 8 channels and output it to a TDM single data line (so 8 samples per frame).
I've got the usb_sw_audio app working for usb 8 channels outputting to the 4 dacs, and I thought I could easily modify the configuration to output to TDM (with XUA_PCM_FORMAT=XUA_PCM_FORMAT_TDM and I2S_CHANS_DAC=8).
However to my understanding the USB audio app only handles stereo TDM, and the main loop in xua_audiohub.xc (lib xua): AudioHub_MainLoop loops over the number of DACs (4 for this board) and outputs the samples to each DAC, left then right, e.g for left:
Code: Select all
/* Output "even" channel to DAC (i.e. left) */
for(int i = 0; i < I2S_CHANS_DAC; i+=I2S_CHANS_PER_FRAME)
{
if(XUA_I2S_N_BITS == 32)
p_i2s_dac[index++] <: bitrev(samplesOut[frameCount +i]);
else
partout(p_i2s_dac[index++], XUA_I2S_N_BITS, bitrev(samplesOut[frameCount +i]));
}
Now I've spotted the TDM example: app_simple_tdm_master and wonder what's the best way to connect it.
What implementation would you recommend?
Should I instantiate a tdm_master task, and update AudioHub_MainLoop to send to it via tdm_send instead of the code quoted above?
And how would I deal with generating the FSYNC signal?
Also I couldn't find the source code for src_us3_voice_get_next_sample which is used I guess to sample the USB audio, is that right?:
Code: Select all
samplesOut[frameCount+i] = src_us3_voice_get_next_sample(i2sOutUs3.delayLine[i], src_ff3v_fir_coefs[2-audioToUsbRatioCounter]);
Ben