diff --git a/module_usb_audio/.cproject b/module_usb_audio/.cproject index 5b0ab598..5cbe48b9 100644 --- a/module_usb_audio/.cproject +++ b/module_usb_audio/.cproject @@ -1,323 +1,72 @@ - - - - - - - - - - - - - - - - - - xmake - -f .makefile - all - true - true - true - - - xmake - -f .makefile - clean - true - true - true - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/module_usb_audio/.project b/module_usb_audio/.project index cb42a172..80c9d6e8 100644 --- a/module_usb_audio/.project +++ b/module_usb_audio/.project @@ -1,76 +1,90 @@ - module_usb_audio - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - ?children? - ?name?=outputEntries\|?children?=?name?=entry\\\\|\\|\|| - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.buildArguments - CONFIG=Debug - - - org.eclipse.cdt.make.core.buildCommand - xmake - - - org.eclipse.cdt.make.core.cleanBuildTarget - clean - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - false - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.stopOnError - true - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - false - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - com.xmos.cdt.core.XdeProjectNature - + module_usb_audio + + + + + + com.xmos.cdt.core.LegacyProjectCheckerBuilder + + + + + com.xmos.cdt.core.ProjectInfoSyncBuilder + + + + + com.xmos.cdt.core.ModulePathBuilder + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + ?children? + ?name?=outputEntries\|?children?=?name?=entry\\\\|\\|\|| + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.buildArguments + CONFIG=Debug + + + org.eclipse.cdt.make.core.buildCommand + xmake + + + org.eclipse.cdt.make.core.cleanBuildTarget + clean + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + false + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + false + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + com.xmos.cdt.core.XdeProjectNature + - diff --git a/module_usb_audio/pcm_pdm_mic.xc b/module_usb_audio/pcm_pdm_mic.xc index 8575618c..fae744ea 100644 --- a/module_usb_audio/pcm_pdm_mic.xc +++ b/module_usb_audio/pcm_pdm_mic.xc @@ -27,6 +27,13 @@ typedef struct { } synchronised_audio; +static int dc_offset_removal(int sample, int &prex_x, int &prev_y){ + int r = prev_y- (prev_y>>5) + (sample - prex_x); + prex_x = sample; + prev_y = r; + return r; +} + void example(streaming chanend c_ds_output_0, streaming chanend c_ds_output_1, streaming chanend c_pcm_out) { @@ -35,6 +42,8 @@ void example(streaming chanend c_ds_output_0, streaming chanend c_ds_output_1, s synchronised_audio audio[2]; //double buffered memset(audio, sizeof(synchronised_audio), 2); + int prev_x[7] = {0}; + int prev_y[7] = {0}; unsafe { @@ -52,15 +61,17 @@ void example(streaming chanend c_ds_output_0, streaming chanend c_ds_output_1, s buffer = 1 - buffer; - //The data has already been bit reversed in the downsampler - // audio[buffer] is good to go - //xscope_int(0, audio[buffer].data[0][0].ch_a); - //xscope_int(1, audio[buffer].data[0][0].ch_b); + + int a = dc_offset_removal( audio[buffer].data[1][0].ch_a, prev_x[0], prev_y[0]); + int b = dc_offset_removal( audio[buffer].data[1][0].ch_b, prev_x[1], prev_y[1]); + + xscope_int(0,a); + xscope_int(1,b); + c_pcm_out :> unsigned req; - c_pcm_out <: audio[buffer].data[0][0].ch_a; - c_pcm_out <: audio[buffer].data[0][0].ch_b; - //printintln(audio[buffer].data[0][0].ch_b); + c_pcm_out <: (a>>14); + c_pcm_out <: (b>>14); } } }