xmos / lib_src

Sample rate conversion library
Other
16 stars 18 forks source link

SSRC app note needed #9

Open samchesney opened 7 years ago

alexjaw commented 6 years ago

In this xmos forum thread , there is binary and source code from infiniteimprobability that provides an SSRC example. Would be great if it could be run with the latest sw_usb_audio. Have successfully run the binary provided by infiniteimprobability. Now I am trying to compile the source code with sw_usb_audio - usb_audio6.15.2. This is what I have done so far (replacing/adding code to sw_usb_audio from the source code provided from infiniteimprobability):

I did not expect to be able to compile the code without errors, but the errors that I get are confusing me - asrc_ctrl_t from lib_src is recognized but not ssrc_ctrl_t:


xmake CONFIG=i0o2xxxxxx all 
Checking build modules
WARNING: Required version of lib_xassert is >=2.0.0 and actual version has greater major version: 3.0.0. There could be API incompatibilities.
Using build modules: module_usb_shared module_xud module_usb_audio module_spdif_tx module_spdif_rx module_usb_midi module_dfu module_usb_device module_i2c_shared module_i2c_single_port module_adat_tx module_adat_rx lib_src(1.0.0) module_queue module_locks lib_logging(2.1.0) lib_xassert(3.0.0)
Analyzing dsp_wrapper.c
In file included from ../src/extensions/dsp_wrapper.c:9:
In file included from /home/alexander/workspace-xmos/lib_src/src/ssrc.h:25:
/home/alexander/workspace-xmos/lib_src/api/src.h:59:63: error: unknown type name 'ssrc_ctrl_t'; did you mean 'asrc_ctrl_t'?
void ssrc_init(const fs_code_t sr_in, const fs_code_t sr_out, ssrc_ctrl_t ssrc_ctrl[],
                                                              ^~~~~~~~~~~
                                                              asrc_ctrl_t
/home/alexander/workspace-xmos/lib_src/src/asrc.h:184:11: note: 'asrc_ctrl_t' declared here
        } asrc_ctrl_t;
          ^
In file included from ../src/extensions/dsp_wrapper.c:9:
In file included from /home/alexander/workspace-xmos/lib_src/src/ssrc.h:25:
/home/alexander/workspace-xmos/lib_src/api/src.h:69:54: error: unknown type name 'ssrc_ctrl_t'; did you mean 'asrc_ctrl_t'?
unsigned ssrc_process(int in_buff[], int out_buff[], ssrc_ctrl_t ssrc_ctrl[]);
                                                     ^~~~~~~~~~~
                                                     asrc_ctrl_t
/home/alexander/workspace-xmos/lib_src/src/asrc.h:184:11: note: 'asrc_ctrl_t' declared here
        } asrc_ctrl_t;
          ^
../src/extensions/dsp_wrapper.c:20:8: error: unknown type name 'SSRCState_t'
static SSRCState_t     sSSRCState[SSRC_N_CHANNELS];
       ^
../src/extensions/dsp_wrapper.c:21:52: error: use of undeclared identifier 'SSRC_N_IN_SAMPLES'
static int             iSSRCStack[SSRC_N_CHANNELS][SSRC_STACK_LENGTH_MULT * NUM_SSRC_SAMPS_IN];
                                                   ^
/home/alexander/workspace-xmos/lib_src/src/ssrc.h:35:77: note: expanded from macro 'SSRC_STACK_LENGTH_MULT'
    #define        SSRC_STACK_LENGTH_MULT                (SSRC_N_CHANNELS * SSRC_N_IN_SAMPLES)    // Multiplier for stack length (stack length = this value x the number of input samples to process)
                                                                            ^
../src/extensions/dsp_wrapper.c:22:8: error: unknown type name 'SSRCCtrl_t'; did you mean 'FIRCtrl_t'?
static SSRCCtrl_t      sSSRCCtrl[SSRC_N_CHANNELS];
       ^~~~~~~~~~
       FIRCtrl_t
/home/alexander/workspace-xmos/lib_src/src/FIR.h:211:11: note: 'FIRCtrl_t' declared here
        } FIRCtrl_t;
          ^
../src/extensions/dsp_wrapper.c:33:25: error: no member named 'psState' in 'struct _FIRCtrl'
    sSSRCCtrl[instance].psState                   = &sSSRCState[instance];
    ~~~~~~~~~~~~~~~~~~~ ^
../src/extensions/dsp_wrapper.c:34:25: error: no member named 'piStack' in 'struct _FIRCtrl'
    sSSRCCtrl[instance].piStack                   = iSSRCStack[instance];
    ~~~~~~~~~~~~~~~~~~~ ^
../src/extensions/dsp_wrapper.c:40:25: error: no member named 'uiDitherOnOff' in 'struct _FIRCtrl'
    sSSRCCtrl[instance].uiDitherOnOff             = SSRC_DITHER_OFF;
    ~~~~~~~~~~~~~~~~~~~ ^
../src/extensions/dsp_wrapper.c:41:25: error: no member named 'uiRndSeedInit' in 'struct _FIRCtrl'
    sSSRCCtrl[instance].uiRndSeedInit             = 1234567;
    ~~~~~~~~~~~~~~~~~~~ ^
../src/extensions/dsp_wrapper.c:44:25: error: no member named 'eInFs' in 'struct _FIRCtrl'
    sSSRCCtrl[instance].eInFs                     = sr_in;
    ~~~~~~~~~~~~~~~~~~~ ^
../src/extensions/dsp_wrapper.c:45:25: error: no member named 'eOutFs' in 'struct _FIRCtrl'
    sSSRCCtrl[instance].eOutFs                    = sr_out;
    ~~~~~~~~~~~~~~~~~~~ ^
../src/extensions/dsp_wrapper.c:48:18: warning: incompatible pointer types passing 'FIRCtrl_t *' (aka 'struct _FIRCtrl *') to parameter of type 'ssrc_ctrl_t *' (aka 'struct _SSRCCtrl *') [-Wincompatible-pointer-types]
    if(SSRC_init(&sSSRCCtrl[instance]) != SSRC_NO_ERROR) bomb_out();
                 ^~~~~~~~~~~~~~~~~~~~
/home/alexander/workspace-xmos/lib_src/src/ssrc.h:178:65: note: passing argument to parameter 'pssrc_ctrl' here
        SSRCReturnCodes_t                SSRC_init(ssrc_ctrl_t* pssrc_ctrl);    
                                                                ^
../src/extensions/dsp_wrapper.c:63:18: warning: incompatible pointer types passing 'FIRCtrl_t *' (aka 'struct _FIRCtrl *') to parameter of type 'ssrc_ctrl_t *' (aka 'struct _SSRCCtrl *') [-Wincompatible-pointer-types]
    if(SSRC_proc(&sSSRCCtrl[instance]) != SSRC_NO_ERROR) bomb_out();
                 ^~~~~~~~~~~~~~~~~~~~
/home/alexander/workspace-xmos/lib_src/src/ssrc.h:196:65: note: passing argument to parameter 'pssrc_ctrl' here
        SSRCReturnCodes_t                SSRC_proc(ssrc_ctrl_t* pssrc_ctrl);                            
                                                                ^
../src/extensions/dsp_wrapper.c:64:50: error: no member named 'puiNOutSamples' in 'struct _FIRCtrl'; did you mean 'uiNOutSamples'?
    unsigned n_samps_out = (*sSSRCCtrl[instance].puiNOutSamples);   //Get number of samples returned
                                                 ^~~~~~~~~~~~~~
                                                 uiNOutSamples
/home/alexander/workspace-xmos/lib_src/src/FIR.h:196:53: note: 'uiNOutSamples' declared here
            unsigned int                            uiNOutSamples;    // Number of output samples produced
                                                    ^
../src/extensions/dsp_wrapper.c:64:29: error: indirection requires pointer operand ('unsigned int' invalid)
    unsigned n_samps_out = (*sSSRCCtrl[instance].puiNOutSamples);   //Get number of samples returned
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings and 13 errors generated.
xmake[1]: *** [.build_i0o2xxxxxx/src/extensions/dsp_wrapper.c.pca.xml.decouple] Error 1
xmake: *** [analyze] Error 2```
ed-xmos commented 6 years ago

Hi @alexjaw, this github issue relates to an enhancement and details related to that, rather than a support channel. Can I ask that we move this support conversation back onto the forum? Of course anything that comes out of that can be added to this issue tracker. Ed, aka inifiniteimprobablility

alexjaw commented 6 years ago

No problem. I have made further progress and will update the forum thread when I have merged your demo with the latest usb app.