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 #ifndef OFFLOAD_REVERB_H_
18 #define OFFLOAD_REVERB_H_
19 
20 #include "bundle.h"
21 
22 #define REVERB_DEFAULT_PRESET REVERB_PRESET_NONE
23 
24 extern const effect_descriptor_t aux_env_reverb_descriptor;
25 extern const effect_descriptor_t ins_env_reverb_descriptor;
26 extern const effect_descriptor_t aux_preset_reverb_descriptor;
27 extern const effect_descriptor_t ins_preset_reverb_descriptor;
28 
29 typedef struct reverb_settings_s {
30     int16_t     roomLevel;
31     int16_t     roomHFLevel;
32     uint32_t    decayTime;
33     int16_t     decayHFRatio;
34     int16_t     reflectionsLevel;
35     uint32_t    reflectionsDelay;
36     int16_t     reverbLevel;
37     uint32_t    reverbDelay;
38     int16_t     diffusion;
39     int16_t     density;
40 } reverb_settings_t;
41 
42 typedef struct reverb_context_s {
43     effect_context_t common;
44 
45     // Offload vars
46     struct mixer_ctl *ctl;
47     bool auxiliary;
48     bool preset;
49     uint16_t cur_preset;
50     uint16_t next_preset;
51     reverb_settings_t reverb_settings;
52     uint32_t device;
53     struct reverb_params offload_reverb;
54 } reverb_context_t;
55 
56 
57 void reverb_auxiliary_init(reverb_context_t *context);
58 
59 void reverb_preset_init(reverb_context_t *context);
60 
61 void reverb_insert_init(reverb_context_t *context);
62 
63 int reverb_get_parameter(effect_context_t *context, effect_param_t *p,
64                             uint32_t *size);
65 
66 int reverb_set_parameter(effect_context_t *context, effect_param_t *p,
67                             uint32_t size);
68 
69 int reverb_set_device(effect_context_t *context,  uint32_t device);
70 
71 int reverb_reset(effect_context_t *context);
72 
73 int reverb_init(effect_context_t *context);
74 
75 int reverb_enable(effect_context_t *context);
76 
77 int reverb_disable(effect_context_t *context);
78 
79 int reverb_start(effect_context_t *context, output_context_t *output);
80 
81 int reverb_stop(effect_context_t *context, output_context_t *output);
82 
83 #endif /* OFFLOAD_REVERB_H_ */
84