bool usb_stream_new_sample_rate(uint32_t sample_rate) { audio_mixer_dacs_flush_direct(false); usb_stream_init(sample_rate, 2, 16, false); return true; }
void player_shutdown(void) { audio_mixer_dacs_flush_direct(false); if (usb_stream_context) { // Free the main structure free(usb_stream_context); usb_stream_context = NULL; } }
void buff_player_dacs_flush(bool force) { if (!buff_player_pcm_buf_fifo) return; // Wait until all the samples have been played if (!force) while (!buff_player_is_pcm_buf_fifo_empty()); // Clean the FIFO if (force) memset(buff_player_pcm_buf_fifo, 0, sizeof(*buff_player_pcm_buf_fifo)); audio_mixer_dacs_flush_direct(false); }
void audio_speaker_set_sample_freq(void) { uint32_t sample_freq=0; Usb_ack_setup_received_free(); while(!Is_usb_control_out_received()) { TASKS_SCHEDULE(); } Usb_reset_endpoint_fifo_access(EP_CONTROL); LSB0(sample_freq)=Usb_read_endpoint_data(EP_CONTROL, 8); LSB1(sample_freq)=Usb_read_endpoint_data(EP_CONTROL, 8); LSB2(sample_freq)=Usb_read_endpoint_data(EP_CONTROL, 8); Usb_ack_control_out_received_free(); Usb_ack_control_in_ready_send(); // send a ZLP while (!Is_usb_control_in_ready()) { TASKS_SCHEDULE(); } #if (defined BOARD) && (BOARD==EVK1105) && (defined DEFAULT_DACS) && (DEFAULT_DACS==AUDIO_MIXER_DAC_AIC23B) // Disable microphone callback interrupt in order for the flush to not be blocked. // TODO: audio_mixer_dacs_flush_direct flushes Rx and Tw part of the DAC. // Should we separate them? Here, we want to flash the output only. device_audio_disable_microphone(); #endif audio_mixer_dacs_flush_direct(false); usb_stream_init( sample_freq , 2 , 16 , false ); #if (defined BOARD) && (BOARD==EVK1105) && (defined DEFAULT_DACS) && (DEFAULT_DACS==AUDIO_MIXER_DAC_AIC23B) // Enable microphone call back interrupts. device_audio_enable_microphone(); #endif }