Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- commit cfeb0b4881c40ab60c70cbb32c7138d51df9dc7b
- Author: Shashi Kumar <[email protected]>
- Date: Sat Nov 27 21:01:24 2010 +0530
- libaudio: Add support to disable MBADRC parameter.
- -While playing audio bass effect (boost of low frequencies) is observed.
- -By enabling MBADRC parameters bass effect is observed.
- -Added MBADRC flag to enable/disable and changes in HAL to disable MBADRC parameters.
- Change-Id: I5ba78868c43310a4d8269d65a3584ac36094ac13
- CRs-Fixed: 265600
- diff --git a/libaudio/AudioHardware.cpp b/libaudio/AudioHardware.cpp
- index dbe9fd0..1ac0725 100644
- --- a/libaudio/AudioHardware.cpp
- +++ b/libaudio/AudioHardware.cpp
- @@ -57,6 +57,7 @@ static struct adrc_filter adrc_cfg[3];
- static struct mbadrc_filter mbadrc_cfg[3];
- eqalizer eqalizer[3];
- static uint16_t adrc_flag[3];
- +static uint16_t mbadrc_flag[3];
- static uint16_t eq_flag[3];
- static uint16_t rx_iir_flag[3];
- static bool audpp_filter_inited = false;
- @@ -447,8 +448,7 @@ int check_and_set_audpp_parameters(char *buf, int size)
- goto token_err;
- for (i = 0; i < 48; i++) {
- - j = (i >= 40)? i : ((i % 2)? (i - 1) : (i + 1));
- - iir_cfg[device_id].iir_params[j] = (uint16_t)strtol(p, &ps, 16);
- + iir_cfg[device_id].iir_params[i] = (uint16_t)strtol(p, &ps, 16);
- if (!(p = strtok(NULL, seps)))
- goto token_err;
- }
- @@ -626,7 +626,12 @@ int check_and_set_audpp_parameters(char *buf, int size)
- if (!(p = strtok(NULL, seps)))
- goto token_err;
- mbadrc_cfg[device_id].ext_buf.buff[i] = (uint16_t)strtol(p, &ps, 16);
- - }
- + }
- + if (!(p = strtok(NULL, seps)))
- + goto token_err;
- +
- + mbadrc_flag[device_id] = (uint16_t)strtol(p, &ps, 16);
- + LOGV("MBADRC flag = %02x.", mbadrc_flag[device_id]);
- }else if ((buf[0] == 'E') || (buf[0] == 'F') || (buf[0] == 'G')){
- //Pre-Processing Features TX_IIR,NS,AGC
- switch (buf[1]) {
- @@ -885,24 +890,30 @@ static int msm72xx_enable_postproc(bool state)
- if(mbadrc_filter_exists[device_id] && state)
- {
- - if(post_proc_feature_mask & MBADRC_ENABLE)
- - {
- - post_proc_feature_mask &= ~ADRC_ENABLE;
- + LOGV("MBADRC Enabled");
- + post_proc_feature_mask &= ADRC_DISABLE;
- + if ((mbadrc_flag[device_id] == 0) && (post_proc_feature_mask & MBADRC_ENABLE))
- + {
- + LOGV("MBADRC Disable");
- + post_proc_feature_mask &= MBADRC_DISABLE;
- + }
- + else if(post_proc_feature_mask & MBADRC_ENABLE)
- + {
- LOGV("MBADRC Enabled %d", post_proc_feature_mask);
- if (ioctl(fd, AUDIO_SET_MBADRC, &mbadrc_cfg[device_id]) < 0)
- {
- LOGE("set mbadrc filter error");
- }
- - }
- + }
- }
- else if (adrc_filter_exists[device_id] && state)
- {
- - post_proc_feature_mask &= ~MBADRC_ENABLE;
- + post_proc_feature_mask &= MBADRC_DISABLE;
- LOGV("ADRC Enabled %d", post_proc_feature_mask);
- if (adrc_flag[device_id] == 0 && (post_proc_feature_mask & ADRC_ENABLE))
- - post_proc_feature_mask &= ~ADRC_ENABLE;
- + post_proc_feature_mask &= ADRC_DISABLE;
- else if(post_proc_feature_mask & ADRC_ENABLE)
- {
- LOGI("ADRC Filter ADRC FLAG = %02x.", adrc_flag[device_id]);
- @@ -920,9 +931,14 @@ static int msm72xx_enable_postproc(bool state)
- }
- }
- }
- + else
- + {
- + LOGV("MBADRC and ADRC Disabled");
- + post_proc_feature_mask &= (MBADRC_DISABLE | ADRC_DISABLE);
- + }
- if (eq_flag[device_id] == 0 && (post_proc_feature_mask & EQ_ENABLE))
- - post_proc_feature_mask &= ~EQ_ENABLE;
- + post_proc_feature_mask &= EQ_DISABLE;
- else if ((post_proc_feature_mask & EQ_ENABLE) && state)
- {
- LOGI("Setting EQ Filter");
- @@ -932,7 +948,7 @@ static int msm72xx_enable_postproc(bool state)
- }
- if (rx_iir_flag[device_id] == 0 && (post_proc_feature_mask & RX_IIR_ENABLE))
- - post_proc_feature_mask &= ~RX_IIR_ENABLE;
- + post_proc_feature_mask &= RX_IIR_DISABLE;
- else if ((post_proc_feature_mask & RX_IIR_ENABLE)&& state)
- {
- LOGI("IIR Filter FLAG = %02x.", rx_iir_flag[device_id]);
- diff --git a/libaudio/AudioHardware.h b/libaudio/AudioHardware.h
- index b7ee9a0..354e08d 100644
- --- a/libaudio/AudioHardware.h
- +++ b/libaudio/AudioHardware.h
- @@ -49,13 +49,13 @@ namespace android {
- #define EQ_MAX_BAND_NUM 12
- #define ADRC_ENABLE 0x0001
- -#define ADRC_DISABLE 0x0000
- +#define ADRC_DISABLE 0xFFFE
- #define EQ_ENABLE 0x0002
- -#define EQ_DISABLE 0x0000
- +#define EQ_DISABLE 0xFFFD
- #define RX_IIR_ENABLE 0x0004
- -#define RX_IIR_DISABLE 0x0000
- +#define RX_IIR_DISABLE 0xFFFB
- #define MBADRC_ENABLE 0x0010
- -#define MBADRC_DISABLE 0x0000
- +#define MBADRC_DISABLE 0xFFEF
- #define AGC_ENABLE 0x0001
- #define NS_ENABLE 0x0002
Add Comment
Please, Sign In to add comment