358 lines
11 KiB
C
358 lines
11 KiB
C
#ifndef __MIC_EFFECT_H__
|
||
#define __MIC_EFFECT_H__
|
||
|
||
|
||
|
||
#include "system/includes.h"
|
||
#include "audio_mic/effect_reg.h"
|
||
#include "audio_mic/effect_parm.h"
|
||
#include "app_config.h"
|
||
#include "application/audio_pemafrow.h"
|
||
/* enum { */
|
||
// MIC_EQ_MODE_SHOUT_WHEAT = 0x0,
|
||
// MIC_EQ_MODE_LOW_SOUND,
|
||
// MIC_EQ_MODE_HIGH_SOUND,
|
||
/* }; */
|
||
|
||
void switch_mic_effect_mode(void);
|
||
// void set_mic_reverb_mode(void);
|
||
void switch_mic_agc(void);
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief (mic数据流)混响打开接口
|
||
@param
|
||
@return true - 成功, false - 失败.
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
bool mic_effect_start(void);
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief (mic数据流)混响关闭接口
|
||
@param
|
||
@return
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
void mic_effect_stop(void);
|
||
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief (mic数据流)混响暂停接口(数据置0)
|
||
@param mark :1 暂停 0:恢复
|
||
@return
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
void mic_effect_pause(u8 mark);
|
||
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief (mic数据流)混响暂停输出到DAC(数据流后级不写入DAC)
|
||
@param mark :1 暂停 0:恢复
|
||
@return
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
void mic_effect_dac_pause(u8 mark);
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief (mic数据流)混响状态获取接口
|
||
@param
|
||
@return true - 运行, false - 未启动
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
u8 mic_effect_get_status(void);
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 数字音量调节接口
|
||
@param vol 待设置的音量值[0,31]
|
||
@return
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
void mic_effect_set_dvol(u8 vol);
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 获取数字音量接口
|
||
@param
|
||
@return 当前数字数字音量等级
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
u8 mic_effect_get_dvol(void);
|
||
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 获取默认mic增益
|
||
@param
|
||
@return 默认mic增益值
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
u8 mic_effect_get_micgain(void);
|
||
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 设置reverb 湿声增益
|
||
@param 待设增益值[0,300]
|
||
@return
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
void mic_effect_set_reverb_wet(int wet);
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 获取当前reverb混响湿声增益值
|
||
@param
|
||
@return 当前增益值[0,300]
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
int mic_effect_get_reverb_wet(void);
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 设置reverb 干声增益
|
||
@param 待设增益值[0,200]
|
||
@return
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
void mic_effect_set_reverb_dry(int wet);
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 获取当前reverb混响干声增益值
|
||
@param
|
||
@return 当前增益值[0,200]
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
int mic_effect_get_reverb_dry(void);
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 设置echo 回声延时
|
||
@param delay 回声延时[0,max_ms]
|
||
@return
|
||
@note 默认max_ms = 200
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
void mic_effect_set_echo_delay(u32 delay);
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 获取当前 echo 回声延时值
|
||
@param
|
||
@return 当前回声延时delay值
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
u32 mic_effect_get_echo_delay(void);
|
||
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 设置echo 回声衰减系数
|
||
@param decay 衰减系数值%[0,90]
|
||
@return
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
void mic_effect_set_echo_decay(u32 decay);
|
||
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 获取echo 回声衰减系数
|
||
@param
|
||
@return 当前衰减系数值
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
u32 mic_effect_get_echo_decay(void);
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 设置echo 回声wetgain参数
|
||
@param wetgain 湿声增益系数%[0,200]
|
||
@return
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
void mic_effect_set_echo_wetgain(u32 wetgain);
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 获取echo 回声wetgain参数
|
||
@param wetgain 湿声增益系数%[0,200]
|
||
@return
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
u32 mic_effect_get_echo_wetgain(void);
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 设置echo 回声drygain参数
|
||
@param drygain 干声增益系数%[0,100]
|
||
@return
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
void mic_effect_set_echo_drygain(u32 drygain);
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 获取echo 回声drygain参数
|
||
@param drygain 干声增益系数%[0,100]
|
||
@return
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
u32 mic_effect_get_echo_drygain(void);
|
||
|
||
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief mic数据流参数更新
|
||
@param parm 新参数,
|
||
@return
|
||
@note 暂未使用
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
void mic_effect_set_mic_parm(struct __mic_stream_parm *parm);
|
||
|
||
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 设置变声模式
|
||
@param shiftv: 变声模式
|
||
sr :数据采样率
|
||
effect:变调比例[40,230]
|
||
formant_shift:共振峰偏移比例 [40,230]
|
||
@return
|
||
@note
|
||
模式配置说明:
|
||
1.EFFECT_PITCH_SHIFT 移频,变调不变速,shiftv调节有效,formant_shift调节无效
|
||
2.EFFECT_VOICECHANGE_KIN0 变声,可以调节不同的 shiftv 跟 formant_shift ,调出更多的声音效果
|
||
3.EFFECT_VOICECHANGE_KIN1 变声,同EFFECT_VOICECHANGE_KIN0类似的,但是2者由于运算的不同,会有区别。
|
||
4.EFFECT_ROBORT 机器音效果,类似 喜马拉雅那样的
|
||
5.EFFECT_AUTOTUNE 电音效果
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
// void set_pitch_para(u32 shiftv, u32 sr, u8 effect, u32 formant_shift);
|
||
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 设置音效模式
|
||
@param mode 模式索引
|
||
@return
|
||
@note 模式与工具调试出的效果文件对应
|
||
模式在effect_reg_echo.c和effect_reg_reverb.c中定义
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
void mic_effect_change_mode(u16 mode);
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 获取音效模式
|
||
@param
|
||
@return 模式索引
|
||
@note 未使用效果文件时无效
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
u16 mic_effect_get_cur_mode(void);
|
||
|
||
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 能量检测运行过程,是否触发闪避
|
||
@param
|
||
@return
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
void mic_dodge_ctr(void);
|
||
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 能量检测运行过程,是否触发闪避
|
||
@param
|
||
@return
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
u8 mic_dodge_get_status(void);
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief mic eq信息获取接口
|
||
@param index:获取第几段eq
|
||
@return 返回struct eq_seg_info结构体
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
// struct eq_seg_info *mic_eq_get_info(u16 index);
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief mic eq设置接口
|
||
@param 详见struct eq_seg_info结构体
|
||
@return
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
|
||
// int mic_eq_set_info(struct eq_seg_info *info);
|
||
//
|
||
//
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 变声音调重置为原声音调
|
||
@param NULL
|
||
@return
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
void mic_pitchv_reset_parm(void);
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 变声音调递增
|
||
@param NULL
|
||
@return
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
void mic_pitchv_up(void);
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 变声音调递减
|
||
@param NULL
|
||
@return
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
void mic_pitchv_down(void);
|
||
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 变声音效循环切换
|
||
@param NULL
|
||
@return
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
void mic_voicechange_loop(void);
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 变声音效指定模式切换
|
||
@param eff_mode 模式索引
|
||
@return
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
void mic_voicechange_switch(u8 eff_mode);
|
||
|
||
|
||
/*----------------------------------------------------------------------------*/
|
||
/**@brief 混响mic数据到USB mic 开关
|
||
@param mark : true 开 false 关
|
||
@return
|
||
@note
|
||
*/
|
||
/*----------------------------------------------------------------------------*/
|
||
void mic_effect_to_usbmic_onoff(u8 mark);
|
||
|
||
|
||
|
||
|
||
#endif// __MIC_EFFECT_H__
|