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