Subhash Chandra Bose Naripeddy | 3eedc00 | 2013-11-12 20:45:15 -0800 | [diff] [blame] | 1 | /* |
Trinath Thammishetty | 765efd2 | 2018-08-20 13:23:24 +0530 | [diff] [blame] | 2 | * Copyright (c) 2013-2014, 2018, The Linux Foundation. All rights reserved. |
Subhash Chandra Bose Naripeddy | 3eedc00 | 2013-11-12 20:45:15 -0800 | [diff] [blame] | 3 | * 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 Thammishetty | 765efd2 | 2018-08-20 13:23:24 +0530 | [diff] [blame] | 27 | #define REVERB_PARAM_LATENCY 0x80000000 |
| 28 | |
Subhash Chandra Bose Naripeddy | 3eedc00 | 2013-11-12 20:45:15 -0800 | [diff] [blame] | 29 | extern const effect_descriptor_t aux_env_reverb_descriptor; |
| 30 | extern const effect_descriptor_t ins_env_reverb_descriptor; |
| 31 | extern const effect_descriptor_t aux_preset_reverb_descriptor; |
| 32 | extern const effect_descriptor_t ins_preset_reverb_descriptor; |
| 33 | |
| 34 | typedef 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 Jiang | 6211dd0 | 2015-11-10 16:25:07 +0800 | [diff] [blame] | 45 | } __attribute__((packed)) reverb_settings_t; |
Subhash Chandra Bose Naripeddy | 3eedc00 | 2013-11-12 20:45:15 -0800 | [diff] [blame] | 46 | |
| 47 | typedef struct reverb_context_s { |
| 48 | effect_context_t common; |
| 49 | |
| 50 | // Offload vars |
| 51 | struct mixer_ctl *ctl; |
Subhash Chandra Bose Naripeddy | e40a7cd | 2014-06-03 19:42:41 -0700 | [diff] [blame] | 52 | int hw_acc_fd; |
Dhananjay Kumar | 3fa6a00 | 2015-07-14 18:58:18 +0530 | [diff] [blame] | 53 | bool enabled_by_client; |
Subhash Chandra Bose Naripeddy | 3eedc00 | 2013-11-12 20:45:15 -0800 | [diff] [blame] | 54 | 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 | |
| 64 | void reverb_auxiliary_init(reverb_context_t *context); |
| 65 | |
| 66 | void reverb_preset_init(reverb_context_t *context); |
| 67 | |
Subhash Chandra Bose Naripeddy | e40a7cd | 2014-06-03 19:42:41 -0700 | [diff] [blame] | 68 | void reverb_insert_init(reverb_context_t *context); |
| 69 | |
Subhash Chandra Bose Naripeddy | 3eedc00 | 2013-11-12 20:45:15 -0800 | [diff] [blame] | 70 | int reverb_get_parameter(effect_context_t *context, effect_param_t *p, |
| 71 | uint32_t *size); |
| 72 | |
| 73 | int reverb_set_parameter(effect_context_t *context, effect_param_t *p, |
| 74 | uint32_t size); |
| 75 | |
| 76 | int reverb_set_device(effect_context_t *context, uint32_t device); |
| 77 | |
Subhash Chandra Bose Naripeddy | e40a7cd | 2014-06-03 19:42:41 -0700 | [diff] [blame] | 78 | int reverb_set_mode(effect_context_t *context, int32_t hw_acc_fd); |
| 79 | |
Subhash Chandra Bose Naripeddy | 3eedc00 | 2013-11-12 20:45:15 -0800 | [diff] [blame] | 80 | int reverb_reset(effect_context_t *context); |
| 81 | |
| 82 | int reverb_init(effect_context_t *context); |
| 83 | |
| 84 | int reverb_enable(effect_context_t *context); |
| 85 | |
| 86 | int reverb_disable(effect_context_t *context); |
| 87 | |
| 88 | int reverb_start(effect_context_t *context, output_context_t *output); |
| 89 | |
| 90 | int reverb_stop(effect_context_t *context, output_context_t *output); |
| 91 | |
| 92 | #endif /* OFFLOAD_REVERB_H_ */ |