blob: 1a5ca0de5e124d3a41d59e483bb5bce8cd184d6a [file] [log] [blame]
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -08001/*
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -07002 * Copyright (c) 2013-2014, 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
27extern const effect_descriptor_t aux_env_reverb_descriptor;
28extern const effect_descriptor_t ins_env_reverb_descriptor;
29extern const effect_descriptor_t aux_preset_reverb_descriptor;
30extern const effect_descriptor_t ins_preset_reverb_descriptor;
31
32typedef struct reverb_settings_s {
33 int16_t roomLevel;
34 int16_t roomHFLevel;
35 uint32_t decayTime;
36 int16_t decayHFRatio;
37 int16_t reflectionsLevel;
38 uint32_t reflectionsDelay;
39 int16_t reverbLevel;
40 uint32_t reverbDelay;
41 int16_t diffusion;
42 int16_t density;
43} reverb_settings_t;
44
45typedef struct reverb_context_s {
46 effect_context_t common;
47
48 // Offload vars
49 struct mixer_ctl *ctl;
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -070050 int hw_acc_fd;
Dhananjay Kumar3fa6a002015-07-14 18:58:18 +053051 bool enabled_by_client;
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -080052 bool auxiliary;
53 bool preset;
54 uint16_t cur_preset;
55 uint16_t next_preset;
56 reverb_settings_t reverb_settings;
57 uint32_t device;
58 struct reverb_params offload_reverb;
59} reverb_context_t;
60
61
62void reverb_auxiliary_init(reverb_context_t *context);
63
64void reverb_preset_init(reverb_context_t *context);
65
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -070066void reverb_insert_init(reverb_context_t *context);
67
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -080068int reverb_get_parameter(effect_context_t *context, effect_param_t *p,
69 uint32_t *size);
70
71int reverb_set_parameter(effect_context_t *context, effect_param_t *p,
72 uint32_t size);
73
74int reverb_set_device(effect_context_t *context, uint32_t device);
75
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -070076int reverb_set_mode(effect_context_t *context, int32_t hw_acc_fd);
77
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -080078int reverb_reset(effect_context_t *context);
79
80int reverb_init(effect_context_t *context);
81
82int reverb_enable(effect_context_t *context);
83
84int reverb_disable(effect_context_t *context);
85
86int reverb_start(effect_context_t *context, output_context_t *output);
87
88int reverb_stop(effect_context_t *context, output_context_t *output);
89
90#endif /* OFFLOAD_REVERB_H_ */