blob: cc11c469b4545341c498610711449ab866b67c99 [file] [log] [blame]
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -08001/*
Trinath Thammishetty765efd22018-08-20 13:23:24 +05302 * Copyright (c) 2013-2014, 2018, The Linux Foundation. All rights reserved.
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -08003 * Not a Contribution.
4 *
5 * Copyright (C) 2013 The Android Open Source Project
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20#ifndef OFFLOAD_REVERB_H_
21#define OFFLOAD_REVERB_H_
22
23#include "bundle.h"
24
25#define REVERB_DEFAULT_PRESET REVERB_PRESET_NONE
26
Trinath Thammishetty765efd22018-08-20 13:23:24 +053027#define REVERB_PARAM_LATENCY 0x80000000
28
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -080029extern const effect_descriptor_t aux_env_reverb_descriptor;
30extern const effect_descriptor_t ins_env_reverb_descriptor;
31extern const effect_descriptor_t aux_preset_reverb_descriptor;
32extern const effect_descriptor_t ins_preset_reverb_descriptor;
33
34typedef struct reverb_settings_s {
35 int16_t roomLevel;
36 int16_t roomHFLevel;
37 uint32_t decayTime;
38 int16_t decayHFRatio;
39 int16_t reflectionsLevel;
40 uint32_t reflectionsDelay;
41 int16_t reverbLevel;
42 uint32_t reverbDelay;
43 int16_t diffusion;
44 int16_t density;
Weiyin Jiang6211dd02015-11-10 16:25:07 +080045} __attribute__((packed)) reverb_settings_t;
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -080046
47typedef struct reverb_context_s {
48 effect_context_t common;
49
50 // Offload vars
51 struct mixer_ctl *ctl;
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -070052 int hw_acc_fd;
Dhananjay Kumar3fa6a002015-07-14 18:58:18 +053053 bool enabled_by_client;
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -080054 bool auxiliary;
55 bool preset;
56 uint16_t cur_preset;
57 uint16_t next_preset;
58 reverb_settings_t reverb_settings;
59 uint32_t device;
60 struct reverb_params offload_reverb;
61} reverb_context_t;
62
63
64void reverb_auxiliary_init(reverb_context_t *context);
65
66void reverb_preset_init(reverb_context_t *context);
67
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -070068void reverb_insert_init(reverb_context_t *context);
69
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -080070int reverb_get_parameter(effect_context_t *context, effect_param_t *p,
71 uint32_t *size);
72
73int reverb_set_parameter(effect_context_t *context, effect_param_t *p,
74 uint32_t size);
75
76int reverb_set_device(effect_context_t *context, uint32_t device);
77
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -070078int reverb_set_mode(effect_context_t *context, int32_t hw_acc_fd);
79
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -080080int reverb_reset(effect_context_t *context);
81
82int reverb_init(effect_context_t *context);
83
84int reverb_enable(effect_context_t *context);
85
86int reverb_disable(effect_context_t *context);
87
88int reverb_start(effect_context_t *context, output_context_t *output);
89
90int reverb_stop(effect_context_t *context, output_context_t *output);
91
92#endif /* OFFLOAD_REVERB_H_ */