/*================================================================ Copyright (c) 2022, Quectel Wireless Solutions Co., Ltd. All rights reserved. Quectel Wireless Solutions Proprietary and Confidential. =================================================================*/ /** ****************************************************************************** * @file ql_audio.h * @author august.yang * @version V1.0.0 * @date 2022/04/09 * @brief Audio interface header file creation ****************************************************************************** */ #ifndef _QL_AUDIO_H_ #define _QL_AUDIO_H_ #include "acm_audio_track.h" #include "acm_audio_record.h" #include "quec_audio.h" typedef enum { QL_AUDIOHAL_DTMF_0 = 0, QL_AUDIOHAL_DTMF_1, QL_AUDIOHAL_DTMF_2, QL_AUDIOHAL_DTMF_3, QL_AUDIOHAL_DTMF_4, QL_AUDIOHAL_DTMF_5, QL_AUDIOHAL_DTMF_6, QL_AUDIOHAL_DTMF_7, QL_AUDIOHAL_DTMF_8, QL_AUDIOHAL_DTMF_9, QL_AUDIOHAL_DTMF_A, QL_AUDIOHAL_DTMF_B, QL_AUDIOHAL_DTMF_C, QL_AUDIOHAL_DTMF_D, QL_AUDIOHAL_DTMF_S, //* key QL_AUDIOHAL_DTMF_P, //# key QL_AUDIOHAL_COMFORT_425, QL_AUDIOHAL_COMFORT_950, QL_AUDIOHAL_COMFORT_1400, QL_AUDIOHAL_COMFORT_1800, } QL_AUDIOHAL_TONE_TYPE; typedef enum { QL_AUDIOHAL_SPK_MUTE = 0, QL_AUDIOHAL_SPK_VOL_1, QL_AUDIOHAL_SPK_VOL_2, QL_AUDIOHAL_SPK_VOL_3, QL_AUDIOHAL_SPK_VOL_4, QL_AUDIOHAL_SPK_VOL_5, QL_AUDIOHAL_SPK_VOL_6, QL_AUDIOHAL_SPK_VOL_7, QL_AUDIOHAL_SPK_VOL_8, QL_AUDIOHAL_SPK_VOL_9, QL_AUDIOHAL_SPK_VOL_10, QL_AUDIOHAL_SPK_VOL_11, // 11 QL_AUDIOHAL_SPK_VOL_QTY // 12 } QL_AUDIOHAL_SPK_LEVEL; typedef enum { PCM_FS_32, PCM_FS_64, PCM_FS_128, PCM_FS_256, PCM_FS_512, PCM_FS_1024, PCM_FS_2048, PCM_FS_MAX, }ql_pcm_bclk; typedef enum { PCM_CODEC_SAMPLE_8000 = 8000, PCM_CODEC_SAMPLE_16000 = 16000, PCM_CODEC_SAMPLE_32000 = 32000, PCM_CODEC_SAMPLE_48000 = 48000, }ql_pcm_codec_sample; typedef void *QL_PCM_HANDLE ; typedef struct { unsigned int channels; unsigned int samplerate; unsigned int periodcnt; // 20ms buffersize/per period, value:2~8 audio_track_callback play_cb; audio_record_callback record_cb; } QL_PCM_CONFIG; audio_track_handle ql_audio_track_open(unsigned int rate, unsigned int channels, int64_t option, audio_track_callback event_cb); int ql_audio_track_write(audio_track_handle handle, uint8_t* data, unsigned int size); int ql_audio_track_close(audio_track_handle handle,int force); int ql_audio_track_ctrl(audio_track_handle handle, acm_audio_track_control_t ctrl_type, int ctrl_value); audio_record_handle ql_audio_record_open(unsigned int rate, unsigned int channels, int64_t option, audio_record_callback event_cb); int ql_audio_record_read(audio_record_handle handle, uint8_t*data, unsigned int* count); int ql_audio_record_close(audio_record_handle handle,int force); int ql_audio_record_ctrl(audio_record_handle handle, acm_audio_record_control_t ctrl_type, int ctrl_value); int ql_wav_play(const char* file_name, struct audio_track_config* track_config, audio_track_handle* handle); int ql_wav_play_stop(audio_track_handle handle,char force); int ql_get_audio_state(void); void ql_codec_choose(codec_choose_state codec_choose, quec_codecpcm_config* pcm_config); void ql_set_audio_path_receiver(void); void ql_set_volume(QL_AUDIOHAL_SPK_LEVEL vol); int ql_play_mp3(char *file_name,Mp3PlaybackHandle* handle,Mp3PlayConfigInfo* mp3_configInfo); int ql_play_mp3_stream_buffer(Mp3PlaybackHandle handle,unsigned char *mp3_buff, int mp3_size); int ql_stop_mp3_play(Mp3PlaybackHandle handle,int drain); int ql_mp3_get_pcm_handle(Mp3PlaybackHandle handle, unsigned int* pcm_handle); int ql_get_volume(void); void ql_bind_speakerpa_cb(cb_on_speakerpa cb); int ql_set_dtmf_detect(DTMFDetectionHandler_t cb, int onoff); int ql_aud_dtmf_play(QL_AUDIOHAL_TONE_TYPE dtmf, int onoff); void ql_set_dtmf_volume(int vo); int ql_aud_tone_play(int f1, int f2, int onoff); void ql_set_audio_path_speaker(void); void ql_set_audio_path_earphone(void); void ql_set_txdspgain(signed char gain); signed char ql_get_txdspgain(void); void ql_set_txcodecgain(short gain); short ql_get_txcodecgain(void); int ql_set_dsp_gain_table(unsigned int profile_id, signed short *gain); int ql_set_txcodec_gain_table(unsigned int profile_id, unsigned int PGA_Stage1, unsigned int PGA_Stage2, unsigned int diggain); int ql_set_rxcodec_gain_table(unsigned int profile_id, signed int level, unsigned int data1, unsigned int data2, unsigned int data3, unsigned int data4, unsigned int data5); int ql_set_eqcoeff_table(unsigned int profile_id, signed int tx_rx, unsigned int rate, signed short * data); int ql_set_mediave_coeff_table(ACMCP_MediaVEarametersT *AudioMediaVETable); int ql_play_amr(char *file_name,AmrPlaybackHandle* handle,AmrPlaybackConfigInfo* amr_configInfo); int ql_play_amr_stream_buffer(AmrPlaybackHandle handle,unsigned char *amr_buff, int amr_size); int ql_stop_amr_play(AmrPlaybackHandle handle,int drain); int ql_amr_get_pcm_handle(AmrPlaybackHandle handle, unsigned int* track_handle); int ql_record_amr(char *file_name,AmrEncodeHandle* handle,AmrEncConfigInfo* amr_configInfo); int ql_record_amr_stop(AmrEncodeHandle handle); void ql_set_dtmf_volume2(int vo); void ql_audio_pipeline_config(unsigned int rate, unsigned int channel); int ql_audio_track_pipeline_read(unsigned char * buf, unsigned int * size); void ql_set_audio_ouput_type(char mode); char ql_get_audio_ouput_type(void); #endif