Send fixed number of samples when no output stream (not correct for asynch)
This commit is contained in:
@@ -63,19 +63,21 @@ void AudioHub(server i2s_frame_callback_if i2s,
|
||||
for (int i = 0; i < n_chans; i++) out_samps[i] = samples_out[i];
|
||||
break;
|
||||
|
||||
//Exchange samples with mics & host
|
||||
case i2s.restart_check() -> i2s_restart_t restart:
|
||||
restart = I2S_NO_RESTART; // Keep on looping
|
||||
timer tmr; int t0, t1; tmr :> t0;
|
||||
for (int i = 0; i < NUM_USB_CHAN_OUT; i++) c_audio :> samples_out[i];
|
||||
for (int i = 0; i < NUM_USB_CHAN_IN; i++) c_audio <: raw_mics[i];
|
||||
//tmr :> t1; debug_printf("%d\n", t1 - t0);
|
||||
//delay_microseconds(15); //Test backpressure tolerance
|
||||
|
||||
//Grab mics
|
||||
current = mic_array_get_next_time_domain_frame(c_ds_output, decimatorCount, buffer, mic_audio_frame, dc);
|
||||
unsafe {
|
||||
raw_mics[0] = current->data[0][0];
|
||||
raw_mics[1] = current->data[1][0];
|
||||
}
|
||||
//tmr :> t1; debug_printf("%d\n", t1 - t0);
|
||||
delay_microseconds(15); //Test backpressure tolerance
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,6 +292,8 @@ void XUA_Buffer_lite(chanend c_ep0_out, chanend c_ep0_in, chanend c_aud_out, cha
|
||||
case XUD_SetData_Select(c_aud_in, ep_aud_in, result):
|
||||
timer tmr; int t0, t1; tmr :> t0;
|
||||
|
||||
if (output_interface_num == 0) num_samples_to_send_to_host = (DEFAULT_FREQ / SOF_FREQ_HZ) * NUM_USB_CHAN_IN;
|
||||
|
||||
fifo_ret_t ret = fifo_block_pop_short_pairs(device_to_host_fifo_ptr, (short *)buffer_aud_in, num_samples_received_from_host);
|
||||
if (ret != FIFO_SUCCESS) debug_printf("d2h empty\n");
|
||||
|
||||
@@ -314,11 +316,11 @@ void XUA_Buffer_lite(chanend c_ep0_out, chanend c_ep0_in, chanend c_aud_out, cha
|
||||
c_audio_hub :> samples_in[i];
|
||||
}
|
||||
fifo_ret_t ret = fifo_block_pop(host_to_device_fifo_ptr, samples_out, NUM_USB_CHAN_OUT);
|
||||
//if (ret != FIFO_SUCCESS) debug_printf("empty\n");
|
||||
if (ret != FIFO_SUCCESS && output_interface_num) debug_printf("h2s empty\n");
|
||||
for (int i = 0; i < NUM_USB_CHAN_OUT; i++) c_audio_hub <: samples_out[i];
|
||||
tmr :> t1; debug_printf("a%d\n", t1 - t0);
|
||||
ret = fifo_block_push(device_to_host_fifo_ptr, samples_in, NUM_USB_CHAN_IN);
|
||||
|
||||
if (ret != FIFO_SUCCESS && input_interface_num) debug_printf("d2h full\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user