ai noise button support

This commit is contained in:
Steven Dan
2026-03-25 19:10:20 +08:00
parent 0e4c0f22ae
commit e929c38fb6
2 changed files with 16 additions and 6 deletions

View File

@@ -267,6 +267,7 @@ unsigned g_windows_detect_done = 0;
extern unsigned g_host_os; // 1 -> Windows, 2 -> Others
extern unsigned g_mute_on_off_t0;
extern unsigned g_uac_vol;
extern void dnr_set_mode(unsigned char mode);
extern void device_reboot(void);
@@ -843,19 +844,21 @@ void button_task(chanend c_hidSendData, chanend cc_mic_level, chanend c_uac_vol)
}
}
push_button_aidenoise_onoff_state_old = button_aidenoise_onoff;
#if DNR_ENABLE == 1
if(mode_change)
if(flag_aidenoise_onoff)
{
led_on(&led_ctx, LED_ANC);
dnr_set_mode(1);
}
else
{
led_off(&led_ctx, LED_ANC);
dnr_set_mode(0);
}
//led_update_all(&led_ctx);
#endif
mode_change = 0;

View File

@@ -86,12 +86,19 @@ void Aizip_DNR_init(void)
debug_printf("AI_DNR_init status %d\n", sta);
}
float g_dnr_level = -200;
void dnr_set_mode(unsigned char mode)
{
if(mode == 0)
g_dnr_level = 0;
else
g_dnr_level = -200;
}
void start_dsp_processing(void)
{
float level = -200;
setNoisy_mix_factor(level);
setNoisy_mix_factor(g_dnr_level);
AI_DNR_Processing((int32_t *)&dsp_dnr_frame_buf[processing_buf_slot][0][0]);
}