1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #define LOG_TAG "offload_effect_api" 18 //#define LOG_NDEBUG 0 19 20 #include <stdbool.h> 21 #include <cutils/log.h> 22 #include <tinyalsa/asoundlib.h> 23 #include <sound/audio_effects.h> 24 25 #include "effect_api.h" 26 27 #define ARRAY_SIZE(array) (sizeof array / sizeof array[0]) 28 29 #define OFFLOAD_PRESET_START_OFFSET_FOR_OPENSL 19 30 const int map_eq_opensl_preset_2_offload_preset[] = { 31 OFFLOAD_PRESET_START_OFFSET_FOR_OPENSL, /* Normal Preset */ 32 OFFLOAD_PRESET_START_OFFSET_FOR_OPENSL+1, /* Classical Preset */ 33 OFFLOAD_PRESET_START_OFFSET_FOR_OPENSL+2, /* Dance Preset */ 34 OFFLOAD_PRESET_START_OFFSET_FOR_OPENSL+3, /* Flat Preset */ 35 OFFLOAD_PRESET_START_OFFSET_FOR_OPENSL+4, /* Folk Preset */ 36 OFFLOAD_PRESET_START_OFFSET_FOR_OPENSL+5, /* Heavy Metal Preset */ 37 OFFLOAD_PRESET_START_OFFSET_FOR_OPENSL+6, /* Hip Hop Preset */ 38 OFFLOAD_PRESET_START_OFFSET_FOR_OPENSL+7, /* Jazz Preset */ 39 OFFLOAD_PRESET_START_OFFSET_FOR_OPENSL+8, /* Pop Preset */ 40 OFFLOAD_PRESET_START_OFFSET_FOR_OPENSL+9, /* Rock Preset */ 41 OFFLOAD_PRESET_START_OFFSET_FOR_OPENSL+10 /* FX Booster */ 42 }; 43 44 const int map_reverb_opensl_preset_2_offload_preset 45 [NUM_OSL_REVERB_PRESETS_SUPPORTED][2] = { 46 {1, 15}, 47 {2, 16}, 48 {3, 17}, 49 {4, 18}, 50 {5, 3}, 51 {6, 20} 52 }; 53 54 int offload_update_mixer_and_effects_ctl(int card, int device_id, 55 struct mixer *mixer, 56 struct mixer_ctl *ctl) 57 { 58 char mixer_string[128]; 59 60 snprintf(mixer_string, sizeof(mixer_string), 61 "%s %d", "Audio Effects Config", device_id); 62 ALOGV("%s: mixer_string: %s", __func__, mixer_string); 63 mixer = mixer_open(card); 64 if (!mixer) { 65 ALOGE("Failed to open mixer"); 66 ctl = NULL; 67 return -EINVAL; 68 } else { 69 ctl = mixer_get_ctl_by_name(mixer, mixer_string); 70 if (!ctl) { 71 ALOGE("mixer_get_ctl_by_name failed"); 72 mixer_close(mixer); 73 mixer = NULL; 74 return -EINVAL; 75 } 76 } 77 ALOGV("mixer: %p, ctl: %p", mixer, ctl); 78 return 0; 79 } 80 81 void offload_close_mixer(struct mixer *mixer) 82 { 83 mixer_close(mixer); 84 } 85 86 void offload_bassboost_set_device(struct bass_boost_params *bassboost, 87 uint32_t device) 88 { 89 ALOGV("%s", __func__); 90 bassboost->device = device; 91 } 92 93 void offload_bassboost_set_enable_flag(struct bass_boost_params *bassboost, 94 bool enable) 95 { 96 ALOGV("%s", __func__); 97 bassboost->enable_flag = enable; 98 } 99 100 int offload_bassboost_get_enable_flag(struct bass_boost_params *bassboost) 101 { 102 ALOGV("%s", __func__); 103 return bassboost->enable_flag; 104 } 105 106 void offload_bassboost_set_strength(struct bass_boost_params *bassboost, 107 int strength) 108 { 109 ALOGV("%s", __func__); 110 bassboost->strength = strength; 111 } 112 113 void offload_bassboost_set_mode(struct bass_boost_params *bassboost, 114 int mode) 115 { 116 ALOGV("%s", __func__); 117 bassboost->mode = mode; 118 } 119 120 int offload_bassboost_send_params(struct mixer_ctl *ctl, 121 struct bass_boost_params *bassboost, 122 unsigned param_send_flags) 123 { 124 int param_values[128] = {0}; 125 int *p_param_values = param_values; 126 127 ALOGV("%s", __func__); 128 *p_param_values++ = BASS_BOOST_MODULE; 129 *p_param_values++ = bassboost->device; 130 *p_param_values++ = 0; /* num of commands*/ 131 if (param_send_flags & OFFLOAD_SEND_BASSBOOST_ENABLE_FLAG) { 132 *p_param_values++ = BASS_BOOST_ENABLE; 133 *p_param_values++ = CONFIG_SET; 134 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 135 *p_param_values++ = BASS_BOOST_ENABLE_PARAM_LEN; 136 *p_param_values++ = bassboost->enable_flag; 137 param_values[2] += 1; 138 } 139 if (param_send_flags & OFFLOAD_SEND_BASSBOOST_STRENGTH) { 140 *p_param_values++ = BASS_BOOST_STRENGTH; 141 *p_param_values++ = CONFIG_SET; 142 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 143 *p_param_values++ = BASS_BOOST_STRENGTH_PARAM_LEN; 144 *p_param_values++ = bassboost->strength; 145 param_values[2] += 1; 146 } 147 if (param_send_flags & OFFLOAD_SEND_BASSBOOST_MODE) { 148 *p_param_values++ = BASS_BOOST_MODE; 149 *p_param_values++ = CONFIG_SET; 150 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 151 *p_param_values++ = BASS_BOOST_MODE_PARAM_LEN; 152 *p_param_values++ = bassboost->mode; 153 param_values[2] += 1; 154 } 155 156 if (param_values[2] && ctl) 157 mixer_ctl_set_array(ctl, param_values, ARRAY_SIZE(param_values)); 158 159 return 0; 160 } 161 162 void offload_virtualizer_set_device(struct virtualizer_params *virtualizer, 163 uint32_t device) 164 { 165 ALOGV("%s", __func__); 166 virtualizer->device = device; 167 } 168 169 void offload_virtualizer_set_enable_flag(struct virtualizer_params *virtualizer, 170 bool enable) 171 { 172 ALOGV("%s", __func__); 173 virtualizer->enable_flag = enable; 174 } 175 176 int offload_virtualizer_get_enable_flag(struct virtualizer_params *virtualizer) 177 { 178 ALOGV("%s", __func__); 179 return virtualizer->enable_flag; 180 } 181 182 void offload_virtualizer_set_strength(struct virtualizer_params *virtualizer, 183 int strength) 184 { 185 ALOGV("%s", __func__); 186 virtualizer->strength = strength; 187 } 188 189 void offload_virtualizer_set_out_type(struct virtualizer_params *virtualizer, 190 int out_type) 191 { 192 ALOGV("%s", __func__); 193 virtualizer->out_type = out_type; 194 } 195 196 void offload_virtualizer_set_gain_adjust(struct virtualizer_params *virtualizer, 197 int gain_adjust) 198 { 199 ALOGV("%s", __func__); 200 virtualizer->gain_adjust = gain_adjust; 201 } 202 203 int offload_virtualizer_send_params(struct mixer_ctl *ctl, 204 struct virtualizer_params *virtualizer, 205 unsigned param_send_flags) 206 { 207 int param_values[128] = {0}; 208 int *p_param_values = param_values; 209 210 ALOGV("%s", __func__); 211 *p_param_values++ = VIRTUALIZER_MODULE; 212 *p_param_values++ = virtualizer->device; 213 *p_param_values++ = 0; /* num of commands*/ 214 if (param_send_flags & OFFLOAD_SEND_VIRTUALIZER_ENABLE_FLAG) { 215 *p_param_values++ = VIRTUALIZER_ENABLE; 216 *p_param_values++ = CONFIG_SET; 217 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 218 *p_param_values++ = VIRTUALIZER_ENABLE_PARAM_LEN; 219 *p_param_values++ = virtualizer->enable_flag; 220 param_values[2] += 1; 221 } 222 if (param_send_flags & OFFLOAD_SEND_VIRTUALIZER_STRENGTH) { 223 *p_param_values++ = VIRTUALIZER_STRENGTH; 224 *p_param_values++ = CONFIG_SET; 225 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 226 *p_param_values++ = VIRTUALIZER_STRENGTH_PARAM_LEN; 227 *p_param_values++ = virtualizer->strength; 228 param_values[2] += 1; 229 } 230 if (param_send_flags & OFFLOAD_SEND_VIRTUALIZER_OUT_TYPE) { 231 *p_param_values++ = VIRTUALIZER_OUT_TYPE; 232 *p_param_values++ = CONFIG_SET; 233 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 234 *p_param_values++ = VIRTUALIZER_OUT_TYPE_PARAM_LEN; 235 *p_param_values++ = virtualizer->out_type; 236 param_values[2] += 1; 237 } 238 if (param_send_flags & OFFLOAD_SEND_VIRTUALIZER_GAIN_ADJUST) { 239 *p_param_values++ = VIRTUALIZER_GAIN_ADJUST; 240 *p_param_values++ = CONFIG_SET; 241 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 242 *p_param_values++ = VIRTUALIZER_GAIN_ADJUST_PARAM_LEN; 243 *p_param_values++ = virtualizer->gain_adjust; 244 param_values[2] += 1; 245 } 246 247 if (param_values[2] && ctl) 248 mixer_ctl_set_array(ctl, param_values, ARRAY_SIZE(param_values)); 249 250 return 0; 251 } 252 253 void offload_eq_set_device(struct eq_params *eq, uint32_t device) 254 { 255 ALOGV("%s", __func__); 256 eq->device = device; 257 } 258 259 void offload_eq_set_enable_flag(struct eq_params *eq, bool enable) 260 { 261 ALOGV("%s", __func__); 262 eq->enable_flag = enable; 263 } 264 265 int offload_eq_get_enable_flag(struct eq_params *eq) 266 { 267 ALOGV("%s", __func__); 268 return eq->enable_flag; 269 } 270 271 void offload_eq_set_preset(struct eq_params *eq, int preset) 272 { 273 ALOGV("%s", __func__); 274 eq->config.preset_id = preset; 275 eq->config.eq_pregain = Q27_UNITY; 276 } 277 278 void offload_eq_set_bands_level(struct eq_params *eq, int num_bands, 279 const uint16_t *band_freq_list, 280 int *band_gain_list) 281 { 282 int i; 283 ALOGV("%s", __func__); 284 eq->config.num_bands = num_bands; 285 for (i=0; i<num_bands; i++) { 286 eq->per_band_cfg[i].band_idx = i; 287 eq->per_band_cfg[i].filter_type = EQ_BAND_BOOST; 288 eq->per_band_cfg[i].freq_millihertz = band_freq_list[i] * 1000; 289 eq->per_band_cfg[i].gain_millibels = band_gain_list[i] * 100; 290 eq->per_band_cfg[i].quality_factor = Q8_UNITY; 291 } 292 } 293 294 int offload_eq_send_params(struct mixer_ctl *ctl, struct eq_params *eq, 295 unsigned param_send_flags) 296 { 297 int param_values[128] = {0}; 298 int *p_param_values = param_values; 299 uint32_t i; 300 301 ALOGV("%s", __func__); 302 if (eq->config.preset_id < -1 ) { 303 ALOGV("No Valid preset to set"); 304 return 0; 305 } 306 *p_param_values++ = EQ_MODULE; 307 *p_param_values++ = eq->device; 308 *p_param_values++ = 0; /* num of commands*/ 309 if (param_send_flags & OFFLOAD_SEND_EQ_ENABLE_FLAG) { 310 *p_param_values++ = EQ_ENABLE; 311 *p_param_values++ = CONFIG_SET; 312 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 313 *p_param_values++ = EQ_ENABLE_PARAM_LEN; 314 *p_param_values++ = eq->enable_flag; 315 param_values[2] += 1; 316 } 317 if (param_send_flags & OFFLOAD_SEND_EQ_PRESET) { 318 *p_param_values++ = EQ_CONFIG; 319 *p_param_values++ = CONFIG_SET; 320 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 321 *p_param_values++ = EQ_CONFIG_PARAM_LEN; 322 *p_param_values++ = eq->config.eq_pregain; 323 *p_param_values++ = 324 map_eq_opensl_preset_2_offload_preset[eq->config.preset_id]; 325 *p_param_values++ = 0; 326 param_values[2] += 1; 327 } 328 if (param_send_flags & OFFLOAD_SEND_EQ_BANDS_LEVEL) { 329 *p_param_values++ = EQ_CONFIG; 330 *p_param_values++ = CONFIG_SET; 331 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 332 *p_param_values++ = EQ_CONFIG_PARAM_LEN + 333 eq->config.num_bands * EQ_CONFIG_PER_BAND_PARAM_LEN; 334 *p_param_values++ = eq->config.eq_pregain; 335 *p_param_values++ = CUSTOM_OPENSL_PRESET; 336 *p_param_values++ = eq->config.num_bands; 337 for (i=0; i<eq->config.num_bands; i++) { 338 *p_param_values++ = eq->per_band_cfg[i].band_idx; 339 *p_param_values++ = eq->per_band_cfg[i].filter_type; 340 *p_param_values++ = eq->per_band_cfg[i].freq_millihertz; 341 *p_param_values++ = eq->per_band_cfg[i].gain_millibels; 342 *p_param_values++ = eq->per_band_cfg[i].quality_factor; 343 } 344 param_values[2] += 1; 345 } 346 347 if (param_values[2] && ctl) 348 mixer_ctl_set_array(ctl, param_values, ARRAY_SIZE(param_values)); 349 350 return 0; 351 } 352 353 void offload_reverb_set_device(struct reverb_params *reverb, uint32_t device) 354 { 355 ALOGV("%s", __func__); 356 reverb->device = device; 357 } 358 359 void offload_reverb_set_enable_flag(struct reverb_params *reverb, bool enable) 360 { 361 ALOGV("%s", __func__); 362 reverb->enable_flag = enable; 363 } 364 365 int offload_reverb_get_enable_flag(struct reverb_params *reverb) 366 { 367 ALOGV("%s", __func__); 368 return reverb->enable_flag; 369 } 370 371 void offload_reverb_set_mode(struct reverb_params *reverb, int mode) 372 { 373 ALOGV("%s", __func__); 374 reverb->mode = mode; 375 } 376 377 void offload_reverb_set_preset(struct reverb_params *reverb, int preset) 378 { 379 ALOGV("%s", __func__); 380 if (preset && (preset <= NUM_OSL_REVERB_PRESETS_SUPPORTED)) 381 reverb->preset = map_reverb_opensl_preset_2_offload_preset[preset-1][1]; 382 } 383 384 void offload_reverb_set_wet_mix(struct reverb_params *reverb, int wet_mix) 385 { 386 ALOGV("%s", __func__); 387 reverb->wet_mix = wet_mix; 388 } 389 390 void offload_reverb_set_gain_adjust(struct reverb_params *reverb, 391 int gain_adjust) 392 { 393 ALOGV("%s", __func__); 394 reverb->gain_adjust = gain_adjust; 395 } 396 397 void offload_reverb_set_room_level(struct reverb_params *reverb, int room_level) 398 { 399 ALOGV("%s", __func__); 400 reverb->room_level = room_level; 401 } 402 403 void offload_reverb_set_room_hf_level(struct reverb_params *reverb, 404 int room_hf_level) 405 { 406 ALOGV("%s", __func__); 407 reverb->room_hf_level = room_hf_level; 408 } 409 410 void offload_reverb_set_decay_time(struct reverb_params *reverb, int decay_time) 411 { 412 ALOGV("%s", __func__); 413 reverb->decay_time = decay_time; 414 } 415 416 void offload_reverb_set_decay_hf_ratio(struct reverb_params *reverb, 417 int decay_hf_ratio) 418 { 419 ALOGV("%s", __func__); 420 reverb->decay_hf_ratio = decay_hf_ratio; 421 } 422 423 void offload_reverb_set_reflections_level(struct reverb_params *reverb, 424 int reflections_level) 425 { 426 ALOGV("%s", __func__); 427 reverb->reflections_level = reflections_level; 428 } 429 430 void offload_reverb_set_reflections_delay(struct reverb_params *reverb, 431 int reflections_delay) 432 { 433 ALOGV("%s", __func__); 434 reverb->reflections_delay = reflections_delay; 435 } 436 437 void offload_reverb_set_reverb_level(struct reverb_params *reverb, 438 int reverb_level) 439 { 440 ALOGV("%s", __func__); 441 reverb->level = reverb_level; 442 } 443 444 void offload_reverb_set_delay(struct reverb_params *reverb, int delay) 445 { 446 ALOGV("%s", __func__); 447 reverb->delay = delay; 448 } 449 450 void offload_reverb_set_diffusion(struct reverb_params *reverb, int diffusion) 451 { 452 ALOGV("%s", __func__); 453 reverb->diffusion = diffusion; 454 } 455 456 void offload_reverb_set_density(struct reverb_params *reverb, int density) 457 { 458 ALOGV("%s", __func__); 459 reverb->density = density; 460 } 461 462 int offload_reverb_send_params(struct mixer_ctl *ctl, 463 struct reverb_params *reverb, 464 unsigned param_send_flags) 465 { 466 int param_values[128] = {0}; 467 int *p_param_values = param_values; 468 469 ALOGV("%s", __func__); 470 *p_param_values++ = REVERB_MODULE; 471 *p_param_values++ = reverb->device; 472 *p_param_values++ = 0; /* num of commands*/ 473 474 if (param_send_flags & OFFLOAD_SEND_REVERB_ENABLE_FLAG) { 475 *p_param_values++ = REVERB_ENABLE; 476 *p_param_values++ = CONFIG_SET; 477 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 478 *p_param_values++ = REVERB_ENABLE_PARAM_LEN; 479 *p_param_values++ = reverb->enable_flag; 480 param_values[2] += 1; 481 } 482 if (param_send_flags & OFFLOAD_SEND_REVERB_MODE) { 483 *p_param_values++ = REVERB_MODE; 484 *p_param_values++ = CONFIG_SET; 485 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 486 *p_param_values++ = REVERB_MODE_PARAM_LEN; 487 *p_param_values++ = reverb->mode; 488 param_values[2] += 1; 489 } 490 if (param_send_flags & OFFLOAD_SEND_REVERB_PRESET) { 491 *p_param_values++ = REVERB_PRESET; 492 *p_param_values++ = CONFIG_SET; 493 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 494 *p_param_values++ = REVERB_PRESET_PARAM_LEN; 495 *p_param_values++ = reverb->preset; 496 param_values[2] += 1; 497 } 498 if (param_send_flags & OFFLOAD_SEND_REVERB_WET_MIX) { 499 *p_param_values++ = REVERB_WET_MIX; 500 *p_param_values++ = CONFIG_SET; 501 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 502 *p_param_values++ = REVERB_WET_MIX_PARAM_LEN; 503 *p_param_values++ = reverb->wet_mix; 504 param_values[2] += 1; 505 } 506 if (param_send_flags & OFFLOAD_SEND_REVERB_GAIN_ADJUST) { 507 *p_param_values++ = REVERB_GAIN_ADJUST; 508 *p_param_values++ = CONFIG_SET; 509 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 510 *p_param_values++ = REVERB_GAIN_ADJUST_PARAM_LEN; 511 *p_param_values++ = reverb->gain_adjust; 512 param_values[2] += 1; 513 } 514 if (param_send_flags & OFFLOAD_SEND_REVERB_ROOM_LEVEL) { 515 *p_param_values++ = REVERB_ROOM_LEVEL; 516 *p_param_values++ = CONFIG_SET; 517 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 518 *p_param_values++ = REVERB_ROOM_LEVEL_PARAM_LEN; 519 *p_param_values++ = reverb->room_level; 520 param_values[2] += 1; 521 } 522 if (param_send_flags & OFFLOAD_SEND_REVERB_ROOM_HF_LEVEL) { 523 *p_param_values++ = REVERB_ROOM_HF_LEVEL; 524 *p_param_values++ = CONFIG_SET; 525 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 526 *p_param_values++ = REVERB_ROOM_HF_LEVEL_PARAM_LEN; 527 *p_param_values++ = reverb->room_hf_level; 528 param_values[2] += 1; 529 } 530 if (param_send_flags & OFFLOAD_SEND_REVERB_DECAY_TIME) { 531 *p_param_values++ = REVERB_DECAY_TIME; 532 *p_param_values++ = CONFIG_SET; 533 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 534 *p_param_values++ = REVERB_DECAY_TIME_PARAM_LEN; 535 *p_param_values++ = reverb->decay_time; 536 param_values[2] += 1; 537 } 538 if (param_send_flags & OFFLOAD_SEND_REVERB_DECAY_HF_RATIO) { 539 *p_param_values++ = REVERB_DECAY_HF_RATIO; 540 *p_param_values++ = CONFIG_SET; 541 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 542 *p_param_values++ = REVERB_DECAY_HF_RATIO_PARAM_LEN; 543 *p_param_values++ = reverb->decay_hf_ratio; 544 param_values[2] += 1; 545 } 546 if (param_send_flags & OFFLOAD_SEND_REVERB_REFLECTIONS_LEVEL) { 547 *p_param_values++ = REVERB_REFLECTIONS_LEVEL; 548 *p_param_values++ = CONFIG_SET; 549 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 550 *p_param_values++ = REVERB_REFLECTIONS_LEVEL_PARAM_LEN; 551 *p_param_values++ = reverb->reflections_level; 552 param_values[2] += 1; 553 } 554 if (param_send_flags & OFFLOAD_SEND_REVERB_REFLECTIONS_DELAY) { 555 *p_param_values++ = REVERB_REFLECTIONS_DELAY; 556 *p_param_values++ = CONFIG_SET; 557 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 558 *p_param_values++ = REVERB_REFLECTIONS_DELAY_PARAM_LEN; 559 *p_param_values++ = reverb->reflections_delay; 560 param_values[2] += 1; 561 } 562 if (param_send_flags & OFFLOAD_SEND_REVERB_LEVEL) { 563 *p_param_values++ = REVERB_LEVEL; 564 *p_param_values++ = CONFIG_SET; 565 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 566 *p_param_values++ = REVERB_LEVEL_PARAM_LEN; 567 *p_param_values++ = reverb->level; 568 param_values[2] += 1; 569 } 570 if (param_send_flags & OFFLOAD_SEND_REVERB_DELAY) { 571 *p_param_values++ = REVERB_DELAY; 572 *p_param_values++ = CONFIG_SET; 573 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 574 *p_param_values++ = REVERB_DELAY_PARAM_LEN; 575 *p_param_values++ = reverb->delay; 576 param_values[2] += 1; 577 } 578 if (param_send_flags & OFFLOAD_SEND_REVERB_DIFFUSION) { 579 *p_param_values++ = REVERB_DIFFUSION; 580 *p_param_values++ = CONFIG_SET; 581 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 582 *p_param_values++ = REVERB_DIFFUSION_PARAM_LEN; 583 *p_param_values++ = reverb->diffusion; 584 param_values[2] += 1; 585 } 586 if (param_send_flags & OFFLOAD_SEND_REVERB_DENSITY) { 587 *p_param_values++ = REVERB_DENSITY; 588 *p_param_values++ = CONFIG_SET; 589 *p_param_values++ = 0; /* start offset if param size if greater than 128 */ 590 *p_param_values++ = REVERB_DENSITY_PARAM_LEN; 591 *p_param_values++ = reverb->density; 592 param_values[2] += 1; 593 } 594 595 if (param_values[2] && ctl) 596 mixer_ctl_set_array(ctl, param_values, ARRAY_SIZE(param_values)); 597 598 return 0; 599 } 600