1 #ifndef _AUDIO_EFFECTS_H 2 #define _AUDIO_EFFECTS_H 3 4 /** AUDIO EFFECTS **/ 5 6 7 /* CONFIG GET/SET */ 8 #define CONFIG_CACHE 0 9 #define CONFIG_SET 1 10 #define CONFIG_GET 2 11 12 /* CONFIG HEADER */ 13 /* 14 * MODULE_ID, 15 * DEVICE, 16 * NUM_COMMANDS, 17 * COMMAND_ID_1, 18 * CONFIG_CACHE/SET/GET, 19 * OFFSET_1, 20 * LENGTH_1, 21 * VALUES_1, 22 * ..., 23 * ..., 24 * COMMAND_ID_2, 25 * CONFIG_CACHE/SET/GET, 26 * OFFSET_2, 27 * LENGTH_2, 28 * VALUES_2, 29 * ..., 30 * ..., 31 * COMMAND_ID_3, 32 * ... 33 */ 34 35 36 /* CONFIG PARAM IDs */ 37 #define VIRTUALIZER_MODULE 0x00001000 38 #define VIRTUALIZER_ENABLE 0x00001001 39 #define VIRTUALIZER_STRENGTH 0x00001002 40 #define VIRTUALIZER_OUT_TYPE 0x00001003 41 #define VIRTUALIZER_GAIN_ADJUST 0x00001004 42 #define VIRTUALIZER_ENABLE_PARAM_LEN 1 43 #define VIRTUALIZER_STRENGTH_PARAM_LEN 1 44 #define VIRTUALIZER_OUT_TYPE_PARAM_LEN 1 45 #define VIRTUALIZER_GAIN_ADJUST_PARAM_LEN 1 46 47 #define REVERB_MODULE 0x00002000 48 #define REVERB_ENABLE 0x00002001 49 #define REVERB_MODE 0x00002002 50 #define REVERB_PRESET 0x00002003 51 #define REVERB_WET_MIX 0x00002004 52 #define REVERB_GAIN_ADJUST 0x00002005 53 #define REVERB_ROOM_LEVEL 0x00002006 54 #define REVERB_ROOM_HF_LEVEL 0x00002007 55 #define REVERB_DECAY_TIME 0x00002008 56 #define REVERB_DECAY_HF_RATIO 0x00002009 57 #define REVERB_REFLECTIONS_LEVEL 0x0000200a 58 #define REVERB_REFLECTIONS_DELAY 0x0000200b 59 #define REVERB_LEVEL 0x0000200c 60 #define REVERB_DELAY 0x0000200d 61 #define REVERB_DIFFUSION 0x0000200e 62 #define REVERB_DENSITY 0x0000200f 63 #define REVERB_ENABLE_PARAM_LEN 1 64 #define REVERB_MODE_PARAM_LEN 1 65 #define REVERB_PRESET_PARAM_LEN 1 66 #define REVERB_WET_MIX_PARAM_LEN 1 67 #define REVERB_GAIN_ADJUST_PARAM_LEN 1 68 #define REVERB_ROOM_LEVEL_PARAM_LEN 1 69 #define REVERB_ROOM_HF_LEVEL_PARAM_LEN 1 70 #define REVERB_DECAY_TIME_PARAM_LEN 1 71 #define REVERB_DECAY_HF_RATIO_PARAM_LEN 1 72 #define REVERB_REFLECTIONS_LEVEL_PARAM_LEN 1 73 #define REVERB_REFLECTIONS_DELAY_PARAM_LEN 1 74 #define REVERB_LEVEL_PARAM_LEN 1 75 #define REVERB_DELAY_PARAM_LEN 1 76 #define REVERB_DIFFUSION_PARAM_LEN 1 77 #define REVERB_DENSITY_PARAM_LEN 1 78 79 #define BASS_BOOST_MODULE 0x00003000 80 #define BASS_BOOST_ENABLE 0x00003001 81 #define BASS_BOOST_MODE 0x00003002 82 #define BASS_BOOST_STRENGTH 0x00003003 83 #define BASS_BOOST_ENABLE_PARAM_LEN 1 84 #define BASS_BOOST_MODE_PARAM_LEN 1 85 #define BASS_BOOST_STRENGTH_PARAM_LEN 1 86 87 #define EQ_MODULE 0x00004000 88 #define EQ_ENABLE 0x00004001 89 #define EQ_CONFIG 0x00004002 90 #define EQ_NUM_BANDS 0x00004003 91 #define EQ_BAND_LEVELS 0x00004004 92 #define EQ_BAND_LEVEL_RANGE 0x00004005 93 #define EQ_BAND_FREQS 0x00004006 94 #define EQ_SINGLE_BAND_FREQ_RANGE 0x00004007 95 #define EQ_SINGLE_BAND_FREQ 0x00004008 96 #define EQ_BAND_INDEX 0x00004009 97 #define EQ_PRESET_ID 0x0000400a 98 #define EQ_NUM_PRESETS 0x0000400b 99 #define EQ_PRESET_NAME 0x0000400c 100 #define EQ_ENABLE_PARAM_LEN 1 101 #define EQ_CONFIG_PARAM_LEN 3 102 #define EQ_CONFIG_PER_BAND_PARAM_LEN 5 103 #define EQ_NUM_BANDS_PARAM_LEN 1 104 #define EQ_BAND_LEVELS_PARAM_LEN 13 105 #define EQ_BAND_LEVEL_RANGE_PARAM_LEN 2 106 #define EQ_BAND_FREQS_PARAM_LEN 13 107 #define EQ_SINGLE_BAND_FREQ_RANGE_PARAM_LEN 2 108 #define EQ_SINGLE_BAND_FREQ_PARAM_LEN 1 109 #define EQ_BAND_INDEX_PARAM_LEN 1 110 #define EQ_PRESET_ID_PARAM_LEN 1 111 #define EQ_NUM_PRESETS_PARAM_LEN 1 112 #define EQ_PRESET_NAME_PARAM_LEN 32 113 114 #define EQ_TYPE_NONE 0 115 #define EQ_BASS_BOOST 1 116 #define EQ_BASS_CUT 2 117 #define EQ_TREBLE_BOOST 3 118 #define EQ_TREBLE_CUT 4 119 #define EQ_BAND_BOOST 5 120 #define EQ_BAND_CUT 6 121 122 #define SOFT_VOLUME_MODULE 0x00006000 123 #define SOFT_VOLUME_ENABLE 0x00006001 124 #define SOFT_VOLUME_GAIN_2CH 0x00006002 125 #define SOFT_VOLUME_GAIN_MASTER 0x00006003 126 #define SOFT_VOLUME_ENABLE_PARAM_LEN 1 127 #define SOFT_VOLUME_GAIN_2CH_PARAM_LEN 2 128 #define SOFT_VOLUME_GAIN_MASTER_PARAM_LEN 1 129 130 #define SOFT_VOLUME2_MODULE 0x00007000 131 #define SOFT_VOLUME2_ENABLE 0x00007001 132 #define SOFT_VOLUME2_GAIN_2CH 0x00007002 133 #define SOFT_VOLUME2_GAIN_MASTER 0x00007003 134 #define SOFT_VOLUME2_ENABLE_PARAM_LEN SOFT_VOLUME_ENABLE_PARAM_LEN 135 #define SOFT_VOLUME2_GAIN_2CH_PARAM_LEN SOFT_VOLUME_GAIN_2CH_PARAM_LEN 136 #define SOFT_VOLUME2_GAIN_MASTER_PARAM_LEN \ 137 SOFT_VOLUME_GAIN_MASTER_PARAM_LEN 138 139 #define PBE_CONF_MODULE_ID 0x00010C2A 140 #define PBE_CONF_PARAM_ID 0x00010C49 141 142 #define PBE_MODULE 0x00008000 143 #define PBE_ENABLE 0x00008001 144 #define PBE_CONFIG 0x00008002 145 #define PBE_ENABLE_PARAM_LEN 1 146 #define PBE_CONFIG_PARAM_LEN 28 147 148 #define COMMAND_PAYLOAD_LEN 3 149 #define COMMAND_PAYLOAD_SZ (COMMAND_PAYLOAD_LEN * sizeof(uint32_t)) 150 #define MAX_INBAND_PARAM_SZ 4096 151 #define Q27_UNITY (1 << 27) 152 #define Q8_UNITY (1 << 8) 153 #define CUSTOM_OPENSL_PRESET 18 154 155 #define VIRTUALIZER_ENABLE_PARAM_SZ \ 156 (VIRTUALIZER_ENABLE_PARAM_LEN*sizeof(uint32_t)) 157 #define VIRTUALIZER_STRENGTH_PARAM_SZ \ 158 (VIRTUALIZER_STRENGTH_PARAM_LEN*sizeof(uint32_t)) 159 #define VIRTUALIZER_OUT_TYPE_PARAM_SZ \ 160 (VIRTUALIZER_OUT_TYPE_PARAM_LEN*sizeof(uint32_t)) 161 #define VIRTUALIZER_GAIN_ADJUST_PARAM_SZ \ 162 (VIRTUALIZER_GAIN_ADJUST_PARAM_LEN*sizeof(uint32_t)) 163 struct virtualizer_params { 164 uint32_t device; 165 uint32_t enable_flag; 166 uint32_t strength; 167 uint32_t out_type; 168 int32_t gain_adjust; 169 }; 170 171 #define NUM_OSL_REVERB_PRESETS_SUPPORTED 6 172 #define REVERB_ENABLE_PARAM_SZ \ 173 (REVERB_ENABLE_PARAM_LEN*sizeof(uint32_t)) 174 #define REVERB_MODE_PARAM_SZ \ 175 (REVERB_MODE_PARAM_LEN*sizeof(uint32_t)) 176 #define REVERB_PRESET_PARAM_SZ \ 177 (REVERB_PRESET_PARAM_LEN*sizeof(uint32_t)) 178 #define REVERB_WET_MIX_PARAM_SZ \ 179 (REVERB_WET_MIX_PARAM_LEN*sizeof(uint32_t)) 180 #define REVERB_GAIN_ADJUST_PARAM_SZ \ 181 (REVERB_GAIN_ADJUST_PARAM_LEN*sizeof(uint32_t)) 182 #define REVERB_ROOM_LEVEL_PARAM_SZ \ 183 (REVERB_ROOM_LEVEL_PARAM_LEN*sizeof(uint32_t)) 184 #define REVERB_ROOM_HF_LEVEL_PARAM_SZ \ 185 (REVERB_ROOM_HF_LEVEL_PARAM_LEN*sizeof(uint32_t)) 186 #define REVERB_DECAY_TIME_PARAM_SZ \ 187 (REVERB_DECAY_TIME_PARAM_LEN*sizeof(uint32_t)) 188 #define REVERB_DECAY_HF_RATIO_PARAM_SZ \ 189 (REVERB_DECAY_HF_RATIO_PARAM_LEN*sizeof(uint32_t)) 190 #define REVERB_REFLECTIONS_LEVEL_PARAM_SZ \ 191 (REVERB_REFLECTIONS_LEVEL_PARAM_LEN*sizeof(uint32_t)) 192 #define REVERB_REFLECTIONS_DELAY_PARAM_SZ \ 193 (REVERB_REFLECTIONS_DELAY_PARAM_LEN*sizeof(uint32_t)) 194 #define REVERB_LEVEL_PARAM_SZ \ 195 (REVERB_LEVEL_PARAM_LEN*sizeof(uint32_t)) 196 #define REVERB_DELAY_PARAM_SZ \ 197 (REVERB_DELAY_PARAM_LEN*sizeof(uint32_t)) 198 #define REVERB_DIFFUSION_PARAM_SZ \ 199 (REVERB_DIFFUSION_PARAM_LEN*sizeof(uint32_t)) 200 #define REVERB_DENSITY_PARAM_SZ \ 201 (REVERB_DENSITY_PARAM_LEN*sizeof(uint32_t)) 202 struct reverb_params { 203 uint32_t device; 204 uint32_t enable_flag; 205 uint32_t mode; 206 uint32_t preset; 207 uint32_t wet_mix; 208 int32_t gain_adjust; 209 int32_t room_level; 210 int32_t room_hf_level; 211 uint32_t decay_time; 212 uint32_t decay_hf_ratio; 213 int32_t reflections_level; 214 uint32_t reflections_delay; 215 int32_t level; 216 uint32_t delay; 217 uint32_t diffusion; 218 uint32_t density; 219 }; 220 221 #define BASS_BOOST_ENABLE_PARAM_SZ \ 222 (BASS_BOOST_ENABLE_PARAM_LEN*sizeof(uint32_t)) 223 #define BASS_BOOST_MODE_PARAM_SZ \ 224 (BASS_BOOST_MODE_PARAM_LEN*sizeof(uint32_t)) 225 #define BASS_BOOST_STRENGTH_PARAM_SZ \ 226 (BASS_BOOST_STRENGTH_PARAM_LEN*sizeof(uint32_t)) 227 struct bass_boost_params { 228 uint32_t device; 229 uint32_t enable_flag; 230 uint32_t mode; 231 uint32_t strength; 232 }; 233 234 235 #define MAX_EQ_BANDS 12 236 #define MAX_OSL_EQ_BANDS 5 237 #define EQ_ENABLE_PARAM_SZ \ 238 (EQ_ENABLE_PARAM_LEN*sizeof(uint32_t)) 239 #define EQ_CONFIG_PARAM_SZ \ 240 (EQ_CONFIG_PARAM_LEN*sizeof(uint32_t)) 241 #define EQ_CONFIG_PER_BAND_PARAM_SZ \ 242 (EQ_CONFIG_PER_BAND_PARAM_LEN*sizeof(uint32_t)) 243 #define EQ_CONFIG_PARAM_MAX_LEN (EQ_CONFIG_PARAM_LEN+\ 244 MAX_EQ_BANDS*EQ_CONFIG_PER_BAND_PARAM_LEN) 245 #define EQ_CONFIG_PARAM_MAX_SZ \ 246 (EQ_CONFIG_PARAM_MAX_LEN*sizeof(uint32_t)) 247 #define EQ_NUM_BANDS_PARAM_SZ \ 248 (EQ_NUM_BANDS_PARAM_LEN*sizeof(uint32_t)) 249 #define EQ_BAND_LEVELS_PARAM_SZ \ 250 (EQ_BAND_LEVELS_PARAM_LEN*sizeof(uint32_t)) 251 #define EQ_BAND_LEVEL_RANGE_PARAM_SZ \ 252 (EQ_BAND_LEVEL_RANGE_PARAM_LEN*sizeof(uint32_t)) 253 #define EQ_BAND_FREQS_PARAM_SZ \ 254 (EQ_BAND_FREQS_PARAM_LEN*sizeof(uint32_t)) 255 #define EQ_SINGLE_BAND_FREQ_RANGE_PARAM_SZ \ 256 (EQ_SINGLE_BAND_FREQ_RANGE_PARAM_LEN*sizeof(uint32_t)) 257 #define EQ_SINGLE_BAND_FREQ_PARAM_SZ \ 258 (EQ_SINGLE_BAND_FREQ_PARAM_LEN*sizeof(uint32_t)) 259 #define EQ_BAND_INDEX_PARAM_SZ \ 260 (EQ_BAND_INDEX_PARAM_LEN*sizeof(uint32_t)) 261 #define EQ_PRESET_ID_PARAM_SZ \ 262 (EQ_PRESET_ID_PARAM_LEN*sizeof(uint32_t)) 263 #define EQ_NUM_PRESETS_PARAM_SZ \ 264 (EQ_NUM_PRESETS_PARAM_LEN*sizeof(uint8_t)) 265 struct eq_config_t { 266 int32_t eq_pregain; 267 int32_t preset_id; 268 uint32_t num_bands; 269 }; 270 struct eq_per_band_config_t { 271 int32_t band_idx; 272 uint32_t filter_type; 273 uint32_t freq_millihertz; 274 int32_t gain_millibels; 275 uint32_t quality_factor; 276 }; 277 struct eq_per_band_freq_range_t { 278 uint32_t band_index; 279 uint32_t min_freq_millihertz; 280 uint32_t max_freq_millihertz; 281 }; 282 283 struct eq_params { 284 uint32_t device; 285 uint32_t enable_flag; 286 struct eq_config_t config; 287 struct eq_per_band_config_t per_band_cfg[MAX_EQ_BANDS]; 288 struct eq_per_band_freq_range_t per_band_freq_range[MAX_EQ_BANDS]; 289 uint32_t band_index; 290 uint32_t freq_millihertz; 291 }; 292 293 #define PBE_ENABLE_PARAM_SZ \ 294 (PBE_ENABLE_PARAM_LEN*sizeof(uint32_t)) 295 #define PBE_CONFIG_PARAM_SZ \ 296 (PBE_CONFIG_PARAM_LEN*sizeof(uint16_t)) 297 struct pbe_config_t { 298 int16_t real_bass_mix; 299 int16_t bass_color_control; 300 uint16_t main_chain_delay; 301 uint16_t xover_filter_order; 302 uint16_t bandpass_filter_order; 303 int16_t drc_delay; 304 uint16_t rms_tav; 305 int16_t exp_threshold; 306 uint16_t exp_slope; 307 int16_t comp_threshold; 308 uint16_t comp_slope; 309 uint16_t makeup_gain; 310 uint32_t comp_attack; 311 uint32_t comp_release; 312 uint32_t exp_attack; 313 uint32_t exp_release; 314 int16_t limiter_bass_threshold; 315 int16_t limiter_high_threshold; 316 int16_t limiter_bass_makeup_gain; 317 int16_t limiter_high_makeup_gain; 318 int16_t limiter_bass_gc; 319 int16_t limiter_high_gc; 320 int16_t limiter_delay; 321 uint16_t reserved; 322 /* place holder for filter coeffs to be followed */ 323 int32_t p1LowPassCoeffs[5*2]; 324 int32_t p1HighPassCoeffs[5*2]; 325 int32_t p1BandPassCoeffs[5*3]; 326 int32_t p1BassShelfCoeffs[5]; 327 int32_t p1TrebleShelfCoeffs[5]; 328 } __attribute__((packed)); 329 330 struct pbe_params { 331 uint32_t device; 332 uint32_t enable_flag; 333 uint32_t cfg_len; 334 struct pbe_config_t config; 335 }; 336 337 #define SOFT_VOLUME_ENABLE_PARAM_SZ \ 338 (SOFT_VOLUME_ENABLE_PARAM_LEN*sizeof(uint32_t)) 339 #define SOFT_VOLUME_GAIN_MASTER_PARAM_SZ \ 340 (SOFT_VOLUME_GAIN_MASTER_PARAM_LEN*sizeof(uint32_t)) 341 #define SOFT_VOLUME_GAIN_2CH_PARAM_SZ \ 342 (SOFT_VOLUME_GAIN_2CH_PARAM_LEN*sizeof(uint16_t)) 343 struct soft_volume_params { 344 uint32_t device; 345 uint32_t enable_flag; 346 uint32_t master_gain; 347 uint32_t left_gain; 348 uint32_t right_gain; 349 }; 350 351 struct msm_nt_eff_all_config { 352 struct bass_boost_params bass_boost; 353 struct pbe_params pbe; 354 struct virtualizer_params virtualizer; 355 struct reverb_params reverb; 356 struct eq_params equalizer; 357 struct soft_volume_params saplus_vol; 358 struct soft_volume_params topo_switch_vol; 359 }; 360 361 #endif /*_MSM_AUDIO_EFFECTS_H*/ 362