#ifndef __EFFECTS_ADJ__H #define __EFFECTS_ADJ__H #include "system/includes.h" #include "config/config_interface.h" #include "asm/crc16.h" #include "generic/log.h" #include "media/audio_eq.h" #include "media/audio_drc.h" #include "media/howling_api.h" #include "media/sw_drc.h" #include "media/DynamicEQ_api.h" #include "media/DynamicEQ_Detection_api.h" #include "media/reverb_api.h" #include "media/noisegate_api.h" #include "media/audio_gain_process.h" #include "media/voiceChanger_api.h" #include "media/audio_vbass.h" #include "media/multi_ch_mix.h" #include "media/audio_surround.h" #include "media/audio_ch_swap.h" #define GAIN_PROCESS_EN 0 struct effect_adj { u8 eq_type; uint8_t password_ok; struct __effect_mode_cfg *parm; struct __tool_callback *cb; }; typedef struct { int cmd; /// byass 0 -> no bypass REVERBN_PARM_SET parm; } REVERBN_PARM_TOOL_SET; //reverb_palte 模块: typedef struct _Plate_reverb_TOOL_SET_ { int is_bypass; // 1-> byass 0 -> no bypass Plate_reverb_parm parm; } Plate_reverb_TOOL_SET; //reverb_filter模块: typedef struct _EF_REVERB0__TOOL_SET_ { int is_bypass; // 1-> byass 0 -> no bypass EF_REVERB0_PARM parm; } EF_REVERB0_TOOL_SET; //echo模块: typedef struct _EF_ECHO_TOOL_SET_ { int is_bypass; // 1-> byass 0 -> no bypass ECHO_PARM_SET parm; } EF_ECHO_TOOL_SET; //移频模块 HowlingPitchShift: typedef struct _HowlingPs_PARM_TOOL_SET_ { int is_bypass; // 1-> byass 0 -> no bypass HOWLING_PITCHSHIFT_PARM parm; } HowlingPs_PARM_TOOL_SET; typedef struct _NotchHowlingParam_TOOL_SET { int is_bypass; // 1-> byass 0 -> no bypass NotchHowlingParam parm; } NotchHowlingParam_TOOL_SET; typedef struct _VoiceChangerParam_TOOL_SET { int is_bypass; // 1-> byass 0 -> no bypass VOICECHANGER_PARM parm; } VoiceChangerParam_TOOL_SET; typedef struct _NoiseGateParam_TOOL_SET { int is_bypass; // 1-> byass 0 -> no bypass noisegate_update_param parm; } NoiseGateParam_TOOL_SET; typedef struct _SurroundEffect_TOOL_SET { int is_bypass; // 1-> byass 0 -> no bypass surround_update_parm parm; } SurroundEffect_TOOL_SET; typedef struct _gain_process_TOOL_SET { int is_bypass; // 1-> byass 0 -> no bypass struct aud_gain_parm_update parm; } Gain_Process_TOOL_SET; typedef struct _ChannelSwap_TOOL_SET { int is_bypass; // 1-> byass 0 -> no bypass } ChannelSwap_TOOL_SET; typedef struct _dac_pga_TOOL_SET { u8 again_fl; u8 again_fr; u8 again_rl; u8 again_rr; u16 dgain_fl; u16 dgain_fr; u16 dgain_rl; u16 dgain_rr; } dac_pga_TOOL_SET; typedef struct _adc_pga_TOOL_SET { u32 gain; } adc_pga_TOOL_SET; struct advance_iir { int fc; int order; int type; }; // #低通 LowPass: typedef struct _LowPassParam_TOOL_SET { int is_bypass; // 1-> byass 0 -> no bypass struct advance_iir low_pass; } LowPassParam_TOOL_SET; // #高通 HighPass: typedef struct _HighPassParam_TOOL_SET { int is_bypass; // 1-> byass 0 -> no bypass struct advance_iir high_pass; } HighPassParam_TOOL_SET; //虚拟低音 typedef struct _VirtualBass_TOOL_SET { int is_bypass; // 1-> byass 0 -> no bypass VirtualBassUdateParam parm; } VirtualBass_TOOL_SET; typedef struct _Mix_TOOL_SET { float gain1; float gain2; float gain3; } Mix_TOOL_SET; struct _AUTOTUNE_TOOL_SET { int is_bypass; // 1-> byass 0 -> no bypass AUTOTUNE_PARM parm; }; //动态EQ DynamicEQ: typedef struct _DynamicEQParam_TOOL_SET { int is_bypass; // 1-> byass 0 -> no bypass DynamicEQEffectParam effect_param[4]; int nSection; //段数 int detect_mode; //检测模式 } DynamicEQParam_TOOL_SET; //实际发送这个结构体 #define OTHER_SECTION_MAX (5) struct eq_tool { float global_gain; int seg_num; //eq效果文件存储的段数 int enable_section; // struct eq_seg_info seg[OTHER_SECTION_MAX]; //eq系数存储地址 }; #if(CONFIG_CPU_BR25) #define mSECTION_MAX (10) #define MULTI_BAND_DRC 0 #else #define mSECTION_MAX (32) #define MULTI_BAND_DRC 1 #endif struct music_eq_tool { float global_gain; int seg_num; //eq效果文件存储的段数 int enable_section; // struct eq_seg_info seg[mSECTION_MAX]; //eq系数存储地址 }; #define mSECTION_MAX2 (10) struct music_eq2_tool { float global_gain; int seg_num; //eq效果文件存储的段数 int enable_section; // struct eq_seg_info seg[mSECTION_MAX2]; //eq系数存储地址 }; /* struct phone_parm_tool_set { */ // struct eq_tool eq_parm; // wdrc_struct_TOOL_SET drc_parm; /* }; */ struct nband_drc { CrossOverParam_TOOL_SET crossover; #if !MULTI_BAND_DRC wdrc_struct_TOOL_SET wdrc_parm[1];//[0]全带 #else wdrc_struct_TOOL_SET wdrc_parm[4];//[0]low [1]mid [2]high [3]多带之后附加的全带 #endif }; struct music_parm_tool_set { struct music_eq_tool eq_parm; struct nband_drc drc_parm; }; struct eff_parm { NoiseGateParam_TOOL_SET noise_gate_parm; HowlingPs_PARM_TOOL_SET howlingps_parm; NotchHowlingParam_TOOL_SET notchhowling_parm; VoiceChangerParam_TOOL_SET voicechanger_parm; Plate_reverb_TOOL_SET plate_reverb_parm; EF_ECHO_TOOL_SET echo_parm; struct eq_tool eq_parm[5]; wdrc_struct_TOOL_SET drc_parm[5]; #if GAIN_PROCESS_EN Gain_Process_TOOL_SET gain_parm;//增益 #endif Mix_TOOL_SET mix_gain; struct _AUTOTUNE_TOOL_SET autotune_parm; }; extern int eff_file_analyze(u32 mode_id, u16 group_id, void *data_buf, u32 buf_len); void get_eff_mode(u16 mode_id, u16 group_id, u8 *mode_index, u8 *drc_index);//获取混响模式的index int get_phone_mode(u16 group_id); int get_group_id(u16 mode_name, u8 tar); int get_eq_nsection(u16 module_name); void noisegate_update_parm(void *parm, int bypass); void plate_reverb_update_parm(void *parm, int bypass); void echo_updata_parm(void *parm, int bypass); void howling_pitch_shift_update_parm(void *parm, int bypass); void notchhowline_update_parm(void *parm, int bypass); void audio_dynamic_eq_detection_update_parm(u32 dynamic_eq_name, void *parm, int bypass); void audio_dynamic_eq_update_parm(u32 dynamic_eq_name, void *parm, void *parm2, int bypass); void mic_gain_update_parm(u16 gain_name, void *parm, int bypass); void set_mic_reverb_mode_by_id(u8 mode); void cp_eq_file_seg_to_custom_tab(); int get_module_name_and_index(u16 group_id, u16 *index, u8 tar); void dynamic_eq_printf(DynamicEQParam_TOOL_SET *dy_parm); void music_eq_printf(void *_parm); void music_eq2_printf(void *_parm); void wdrc_printf(void *_wdrc); void eq_printf(void *_parm); int get_index_by_group_id(u16 groud_id, u8 tar); void set_list_nsection(u8 tar, u8 index, u8 nsection); /* *效果文件切换 *path:效果文件路径 * */ void eff_file_switch(u8 *path); struct cmd_interface { u32 cmd; void (*eff_default_parm_init)(void);//音效参数默认初始化默认值 void (*eff_file_analyze_init)(void);//解析效果文件内相应的音效参数到目标地址 int (*cmd_deal)(EFF_ONLINE_PACKET *packet, u8 id, u8 sq);//在线调试处理函数 }; #define REGISTER_CMD_TARGET(cmd_eff) \ const struct cmd_interface cmd_eff sec(.eff_cmd) extern const struct cmd_interface cmd_interface_begin[]; extern const struct cmd_interface cmd_interface_end[]; #define list_for_each_cmd_interface(p) \ for (p = (struct cmd_interface *)cmd_interface_begin; p < (struct cmd_interface *)cmd_interface_end; p++) #define phone_eq_nsection OTHER_SECTION_MAX #define music_eq_nsection 10 #define music_eq2_nsection 10 #define mic_eq_nsection OTHER_SECTION_MAX #endif/*__EFFECTS_ADJ__H*/