enable dnr for lp
This commit is contained in:
@@ -69,74 +69,8 @@ void unmute_dac(void);
|
||||
void unmute_spdif_led(void);
|
||||
void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudioToUsb[])
|
||||
{
|
||||
static unsigned mute_count = 0;
|
||||
static unsigned unmute_count = 0;
|
||||
static unsigned mute_threshold = 200000; // 静音阈值
|
||||
static unsigned unmute_threshold = 1000; // 取消静音阈值,可根据实际调整
|
||||
static unsigned unmute_delay = 1000;
|
||||
static unsigned old_samfreq = 0;
|
||||
unsigned samfreq;
|
||||
GET_SHARED_GLOBAL(samfreq, g_samfreq);
|
||||
if (samfreq <= 192000)
|
||||
{
|
||||
if (samfreq != old_samfreq)
|
||||
{
|
||||
old_samfreq = samfreq;
|
||||
mute_count = 0;
|
||||
unmute_count = 0;
|
||||
mute_threshold = samfreq / 2;
|
||||
unmute_threshold = samfreq / 50;
|
||||
unmute_delay = samfreq / 200;
|
||||
amp_muted = 1;
|
||||
debug_printf("samFreq %d and mute\n", samfreq);
|
||||
#if !OPT && !COAX
|
||||
mute_dac();
|
||||
#else
|
||||
mute_dac();
|
||||
#endif
|
||||
}
|
||||
|
||||
if (is_silence(sampsFromUsbToAudio, 2))
|
||||
{
|
||||
mute_count++;
|
||||
if ((mute_count > unmute_delay) && (unmute_count != 0))
|
||||
{
|
||||
unmute_count = 0;
|
||||
debug_printf("mute_count %d\n", mute_count);
|
||||
}
|
||||
if (mute_count >= mute_threshold && !amp_muted) {
|
||||
//mute_amp();
|
||||
amp_muted = 1;
|
||||
#if !OPT && !COAX
|
||||
// sampsFromUsbToAudio[0] = 0;
|
||||
// sampsFromUsbToAudio[1] = 0;
|
||||
// mute_dac();
|
||||
#else
|
||||
//mute_dac();
|
||||
#endif
|
||||
//debug_printf("AMP Muted\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unmute_count++;
|
||||
if (unmute_count > unmute_delay)
|
||||
{
|
||||
mute_count = 0;
|
||||
debug_printf("unmute_count %d\n", unmute_count);
|
||||
}
|
||||
if (unmute_count >= unmute_threshold) {
|
||||
//unmute_amp();
|
||||
amp_muted = 0;
|
||||
#if !OPT && !COAX
|
||||
unmute_dac();
|
||||
#else
|
||||
unmute_dac();
|
||||
unmute_spdif_led();
|
||||
#endif
|
||||
//debug_printf("AMP Unmuted\n");
|
||||
}
|
||||
}
|
||||
|
||||
#if EQ_EN
|
||||
|
||||
unsigned eq_enable;
|
||||
@@ -154,11 +88,5 @@ void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudi
|
||||
sampsFromUsbToAudio[1] = read_from_ring_buffer(3);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
mute_count = 0;
|
||||
unmute_count = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -106,80 +106,14 @@ inline unsigned is_silence(const unsigned samps[], int len)
|
||||
|
||||
void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudioToUsb[])
|
||||
{
|
||||
#if 0
|
||||
unsigned dnr_enable = 0;
|
||||
unsigned adc_loop = 0;
|
||||
unsigned l_3d_fps = 0;
|
||||
static int amp_muted = 0;
|
||||
unsafe
|
||||
{
|
||||
GET_SHARED_GLOBAL(dnr_enable, g_dnr_enable);
|
||||
GET_SHARED_GLOBAL(l_3d_fps, g_3d_fps);
|
||||
// GET_SHARED_GLOBAL(fps_enable, g_fps_enable);
|
||||
// GET_SHARED_GLOBAL(three_d_enable, g_3d_enable);
|
||||
GET_SHARED_GLOBAL(adc_loop, g_adc_loop);
|
||||
|
||||
|
||||
if (l_3d_fps == 2)
|
||||
{
|
||||
static unsigned mute_count = 0;
|
||||
static unsigned unmute_count = 0;
|
||||
static unsigned mute_threshold = 48000; // 静音阈值
|
||||
static unsigned unmute_threshold = 4800; // 取消静音阈值,可根据实际调整
|
||||
static unsigned unmute_delay = 1000;
|
||||
|
||||
if (is_silence(sampsFromUsbToAudio, 2))
|
||||
{
|
||||
mute_count++;
|
||||
if (mute_count > unmute_delay)
|
||||
{
|
||||
unmute_count = 0;
|
||||
}
|
||||
if (mute_count >= mute_threshold) {
|
||||
amp_muted = 1;
|
||||
#if 0
|
||||
sampsFromUsbToAudio[0] = 0;
|
||||
sampsFromUsbToAudio[1] = 0;
|
||||
sampsFromUsbToAudio[2] = 0;
|
||||
sampsFromUsbToAudio[3] = 0;
|
||||
sampsFromUsbToAudio[4] = 0;
|
||||
sampsFromUsbToAudio[5] = 0;
|
||||
sampsFromUsbToAudio[6] = 0;
|
||||
sampsFromUsbToAudio[7] = 0;
|
||||
#endif
|
||||
// debug_printf("AMP Muted\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unmute_count++;
|
||||
if (unmute_count > unmute_delay)
|
||||
{
|
||||
mute_count = 0;
|
||||
}
|
||||
if (unmute_count >= unmute_threshold && amp_muted) {
|
||||
amp_muted = 0;
|
||||
unmute_dac();
|
||||
}
|
||||
}
|
||||
|
||||
buffer_exchange((chanend) uc_br_data, sampsFromUsbToAudio, sampsFromAudioToUsb, NUM_USB_CHAN_OUT);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (sampsFromUsbToAudio[2] != 0)
|
||||
{
|
||||
sampsFromUsbToAudio[0] += sampsFromUsbToAudio[2];
|
||||
sampsFromUsbToAudio[1] += sampsFromUsbToAudio[2];
|
||||
}
|
||||
|
||||
if (l_3d_fps == 1)
|
||||
{
|
||||
buffer_exchange((chanend) uc_br_data, sampsFromUsbToAudio, sampsFromAudioToUsb, 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (dnr_enable)
|
||||
{
|
||||
@@ -192,50 +126,11 @@ void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudi
|
||||
|
||||
if (adc_loop)
|
||||
{
|
||||
amp_muted = 0;
|
||||
unmute_dac();
|
||||
sampsFromUsbToAudio[0] = (sampsFromAudioToUsb[1]) + (sampsFromUsbToAudio[0]);
|
||||
sampsFromUsbToAudio[1] = (sampsFromAudioToUsb[1]) + (sampsFromUsbToAudio[1]);
|
||||
}
|
||||
else if (l_3d_fps != 2)
|
||||
{
|
||||
}
|
||||
|
||||
static unsigned mute_count = 0;
|
||||
static unsigned unmute_count = 0;
|
||||
static unsigned mute_threshold = 2800; // 静音阈值
|
||||
static unsigned unmute_threshold = 4800; // 取消静音阈值,可根据实际调整
|
||||
static unsigned unmute_delay = 1000;
|
||||
|
||||
if (is_silence(sampsFromUsbToAudio, 2))
|
||||
{
|
||||
mute_count++;
|
||||
if (mute_count > unmute_delay)
|
||||
{
|
||||
unmute_count = 0;
|
||||
}
|
||||
if (mute_count >= mute_threshold) {
|
||||
amp_muted = 1;
|
||||
//sampsFromUsbToAudio[0] = 0;
|
||||
//sampsFromUsbToAudio[1] = 0;
|
||||
// debug_printf("AMP Muted\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unmute_count++;
|
||||
if (unmute_count > unmute_delay)
|
||||
{
|
||||
mute_count = 0;
|
||||
}
|
||||
if (unmute_count >= unmute_threshold && amp_muted) {
|
||||
amp_muted = 0;
|
||||
unmute_dac();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user