1 /* 2 * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. 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_EFFECT_BASS_BOOST_H_ 21 #define OFFLOAD_EFFECT_BASS_BOOST_H_ 22 23 #include "bundle.h" 24 25 enum { 26 BASS_INVALID = -1, 27 BASS_BOOST = 0, // index of bassboost 28 BASS_PBE, // index of PBE 29 BASS_COUNT // totol number of bass type 30 }; 31 32 extern const effect_descriptor_t bassboost_descriptor; 33 34 typedef struct bassboost_context_s { 35 effect_context_t common; 36 37 int strength; 38 39 // Offload vars 40 struct mixer_ctl *ctl; 41 bool temp_disabled; 42 uint32_t device; 43 struct bass_boost_params offload_bass; 44 } bassboost_context_t; 45 46 typedef struct pbe_context_s { 47 effect_context_t common; 48 49 // Offload vars 50 struct mixer_ctl *ctl; 51 int hw_acc_fd; 52 bool temp_disabled; 53 uint32_t device; 54 struct pbe_params offload_pbe; 55 } pbe_context_t; 56 57 typedef struct bass_context_s { 58 effect_context_t common; 59 bassboost_context_t bassboost_ctxt; 60 pbe_context_t pbe_ctxt; 61 int active_index; 62 } bass_context_t; 63 64 int bass_get_parameter(effect_context_t *context, effect_param_t *p, 65 uint32_t *size); 66 67 int bass_set_parameter(effect_context_t *context, effect_param_t *p, 68 uint32_t size); 69 70 int bass_set_device(effect_context_t *context, uint32_t device); 71 72 int bass_set_mode(effect_context_t *context, int32_t hw_acc_fd); 73 74 int bass_reset(effect_context_t *context); 75 76 int bass_init(effect_context_t *context); 77 78 int bass_enable(effect_context_t *context); 79 80 int bass_disable(effect_context_t *context); 81 82 int bass_start(effect_context_t *context, output_context_t *output); 83 84 int bass_stop(effect_context_t *context, output_context_t *output); 85 86 87 int bassboost_get_strength(bassboost_context_t *context); 88 89 int bassboost_set_strength(bassboost_context_t *context, uint32_t strength); 90 91 int bassboost_set_device(effect_context_t *context, uint32_t device); 92 93 int bassboost_reset(effect_context_t *context); 94 95 int bassboost_init(effect_context_t *context); 96 97 int bassboost_enable(effect_context_t *context); 98 99 int bassboost_disable(effect_context_t *context); 100 101 int bassboost_start(effect_context_t *context, output_context_t *output); 102 103 int bassboost_stop(effect_context_t *context, output_context_t *output); 104 105 int pbe_set_device(effect_context_t *context, uint32_t device); 106 107 int pbe_set_mode(effect_context_t *context, int32_t hw_acc_fd); 108 109 int pbe_reset(effect_context_t *context); 110 111 int pbe_init(effect_context_t *context); 112 113 int pbe_enable(effect_context_t *context); 114 115 int pbe_disable(effect_context_t *context); 116 117 int pbe_start(effect_context_t *context, output_context_t *output); 118 119 int pbe_stop(effect_context_t *context, output_context_t *output); 120 121 #endif /* OFFLOAD_EFFECT_BASS_BOOST_H_ */ 122