Further improved mic integration

This commit is contained in:
Ross Owen
2017-01-12 20:23:21 +00:00
parent 433946d792
commit 7bb7042cd7

View File

@@ -42,6 +42,7 @@ void pdm_buffer(streaming chanend c_ds_output[2], chanend c_audio)
{ {
unsigned buffer; unsigned buffer;
unsigned samplerate; unsigned samplerate;
int output[NUM_PDM_MICS];
#ifdef MIC_PROCESSING_USE_INTERFACE #ifdef MIC_PROCESSING_USE_INTERFACE
i_mic_process.init(); i_mic_process.init();
@@ -138,7 +139,17 @@ void pdm_buffer(streaming chanend c_ds_output[2], chanend c_audio)
/* Audio IO core requests samples */ /* Audio IO core requests samples */
if(req) if(req)
unsafe{ unsafe{
slave
{
/* We store an additional buffer so we can reply immediately */
#pragma loop unroll
for(int i = 0; i < NUM_PDM_MICS; i++)
{
c_audio <: output[i];
}
}
/* Get a new frame of mic data */ /* Get a new frame of mic data */
mic_array_frame_time_domain * unsafe current = mic_array_get_next_time_domain_frame(c_ds_output, decimatorCount, buffer, mic_audio, dc); mic_array_frame_time_domain * unsafe current = mic_array_get_next_time_domain_frame(c_ds_output, decimatorCount, buffer, mic_audio, dc);
@@ -148,13 +159,11 @@ void pdm_buffer(streaming chanend c_ds_output[2], chanend c_audio)
#else #else
user_pdm_process(current); user_pdm_process(current);
#endif #endif
slave /* Buffer up next mic data */
{
#pragma loop unroll #pragma loop unroll
for(int i = 0; i < NUM_PDM_MICS; i++) for(int i = 0; i < NUM_PDM_MICS; i++)
{ {
c_audio <: current->data[i][0]; output[i] = current->data[i][0];
}
} }
} }
else else
@@ -179,6 +188,11 @@ void pdm_buffer(streaming chanend c_ds_output[2], chanend c_audio)
#else #else
user_pdm_process(current); user_pdm_process(current);
#endif #endif
#pragma loop unroll
for(int i = 0; i < NUM_PDM_MICS; i++)
{
output[i] = current->data[i][0];
}
} }
break; break;
} /* select */ } /* select */