Home | History | Annotate | Download | only in post_proc
      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_EFFECT_API_H_
     18 #define OFFLOAD_EFFECT_API_H_
     19 
     20 int offload_update_mixer_and_effects_ctl(int card, int device_id,
     21                                          struct mixer *mixer,
     22                                          struct mixer_ctl *ctl);
     23 void offload_close_mixer(struct mixer *mixer);
     24 
     25 #define OFFLOAD_SEND_BASSBOOST_ENABLE_FLAG      (1 << 0)
     26 #define OFFLOAD_SEND_BASSBOOST_STRENGTH         \
     27                                           (OFFLOAD_SEND_BASSBOOST_ENABLE_FLAG << 1)
     28 #define OFFLOAD_SEND_BASSBOOST_MODE             \
     29                                           (OFFLOAD_SEND_BASSBOOST_STRENGTH << 1)
     30 void offload_bassboost_set_device(struct bass_boost_params *bassboost,
     31                                   uint32_t device);
     32 void offload_bassboost_set_enable_flag(struct bass_boost_params *bassboost,
     33                                        bool enable);
     34 int offload_bassboost_get_enable_flag(struct bass_boost_params *bassboost);
     35 void offload_bassboost_set_strength(struct bass_boost_params *bassboost,
     36                                     int strength);
     37 void offload_bassboost_set_mode(struct bass_boost_params *bassboost,
     38                                 int mode);
     39 int offload_bassboost_send_params(struct mixer_ctl *ctl,
     40                                   struct bass_boost_params *bassboost,
     41                                   unsigned param_send_flags);
     42 
     43 #define OFFLOAD_SEND_VIRTUALIZER_ENABLE_FLAG    (1 << 0)
     44 #define OFFLOAD_SEND_VIRTUALIZER_STRENGTH       \
     45                                           (OFFLOAD_SEND_VIRTUALIZER_ENABLE_FLAG << 1)
     46 #define OFFLOAD_SEND_VIRTUALIZER_OUT_TYPE       \
     47                                           (OFFLOAD_SEND_VIRTUALIZER_STRENGTH << 1)
     48 #define OFFLOAD_SEND_VIRTUALIZER_GAIN_ADJUST    \
     49                                           (OFFLOAD_SEND_VIRTUALIZER_OUT_TYPE << 1)
     50 void offload_virtualizer_set_device(struct virtualizer_params *virtualizer,
     51                                     uint32_t device);
     52 void offload_virtualizer_set_enable_flag(struct virtualizer_params *virtualizer,
     53                                          bool enable);
     54 int offload_virtualizer_get_enable_flag(struct virtualizer_params *virtualizer);
     55 void offload_virtualizer_set_strength(struct virtualizer_params *virtualizer,
     56                                       int strength);
     57 void offload_virtualizer_set_out_type(struct virtualizer_params *virtualizer,
     58                                       int out_type);
     59 void offload_virtualizer_set_gain_adjust(struct virtualizer_params *virtualizer,
     60                                          int gain_adjust);
     61 int offload_virtualizer_send_params(struct mixer_ctl *ctl,
     62                                   struct virtualizer_params *virtualizer,
     63                                   unsigned param_send_flags);
     64 
     65 #define OFFLOAD_SEND_EQ_ENABLE_FLAG             (1 << 0)
     66 #define OFFLOAD_SEND_EQ_PRESET                  \
     67                                           (OFFLOAD_SEND_EQ_ENABLE_FLAG << 1)
     68 #define OFFLOAD_SEND_EQ_BANDS_LEVEL             \
     69                                           (OFFLOAD_SEND_EQ_PRESET << 1)
     70 void offload_eq_set_device(struct eq_params *eq, uint32_t device);
     71 void offload_eq_set_enable_flag(struct eq_params *eq, bool enable);
     72 int offload_eq_get_enable_flag(struct eq_params *eq);
     73 void offload_eq_set_preset(struct eq_params *eq, int preset);
     74 void offload_eq_set_bands_level(struct eq_params *eq, int num_bands,
     75                                 const uint16_t *band_freq_list,
     76                                 int *band_gain_list);
     77 int offload_eq_send_params(struct mixer_ctl *ctl, struct eq_params *eq,
     78                            unsigned param_send_flags);
     79 
     80 #define OFFLOAD_SEND_REVERB_ENABLE_FLAG         (1 << 0)
     81 #define OFFLOAD_SEND_REVERB_MODE                \
     82                                           (OFFLOAD_SEND_REVERB_ENABLE_FLAG << 1)
     83 #define OFFLOAD_SEND_REVERB_PRESET              \
     84                                           (OFFLOAD_SEND_REVERB_MODE << 1)
     85 #define OFFLOAD_SEND_REVERB_WET_MIX             \
     86                                           (OFFLOAD_SEND_REVERB_PRESET << 1)
     87 #define OFFLOAD_SEND_REVERB_GAIN_ADJUST	        \
     88                                           (OFFLOAD_SEND_REVERB_WET_MIX << 1)
     89 #define OFFLOAD_SEND_REVERB_ROOM_LEVEL	        \
     90                                           (OFFLOAD_SEND_REVERB_GAIN_ADJUST << 1)
     91 #define OFFLOAD_SEND_REVERB_ROOM_HF_LEVEL       \
     92                                           (OFFLOAD_SEND_REVERB_ROOM_LEVEL << 1)
     93 #define OFFLOAD_SEND_REVERB_DECAY_TIME          \
     94                                           (OFFLOAD_SEND_REVERB_ROOM_HF_LEVEL << 1)
     95 #define OFFLOAD_SEND_REVERB_DECAY_HF_RATIO      \
     96                                           (OFFLOAD_SEND_REVERB_DECAY_TIME << 1)
     97 #define OFFLOAD_SEND_REVERB_REFLECTIONS_LEVEL   \
     98                                           (OFFLOAD_SEND_REVERB_DECAY_HF_RATIO << 1)
     99 #define OFFLOAD_SEND_REVERB_REFLECTIONS_DELAY   \
    100                                           (OFFLOAD_SEND_REVERB_REFLECTIONS_LEVEL << 1)
    101 #define OFFLOAD_SEND_REVERB_LEVEL               \
    102                                           (OFFLOAD_SEND_REVERB_REFLECTIONS_DELAY << 1)
    103 #define OFFLOAD_SEND_REVERB_DELAY               \
    104                                           (OFFLOAD_SEND_REVERB_LEVEL << 1)
    105 #define OFFLOAD_SEND_REVERB_DIFFUSION           \
    106                                           (OFFLOAD_SEND_REVERB_DELAY << 1)
    107 #define OFFLOAD_SEND_REVERB_DENSITY             \
    108                                           (OFFLOAD_SEND_REVERB_DIFFUSION << 1)
    109 void offload_reverb_set_device(struct reverb_params *reverb, uint32_t device);
    110 void offload_reverb_set_enable_flag(struct reverb_params *reverb, bool enable);
    111 int offload_reverb_get_enable_flag(struct reverb_params *reverb);
    112 void offload_reverb_set_mode(struct reverb_params *reverb, int mode);
    113 void offload_reverb_set_preset(struct reverb_params *reverb, int preset);
    114 void offload_reverb_set_wet_mix(struct reverb_params *reverb, int wet_mix);
    115 void offload_reverb_set_gain_adjust(struct reverb_params *reverb,
    116                                     int gain_adjust);
    117 void offload_reverb_set_room_level(struct reverb_params *reverb,
    118                                    int room_level);
    119 void offload_reverb_set_room_hf_level(struct reverb_params *reverb,
    120                                       int room_hf_level);
    121 void offload_reverb_set_decay_time(struct reverb_params *reverb,
    122                                    int decay_time);
    123 void offload_reverb_set_decay_hf_ratio(struct reverb_params *reverb,
    124                                        int decay_hf_ratio);
    125 void offload_reverb_set_reflections_level(struct reverb_params *reverb,
    126                                           int reflections_level);
    127 void offload_reverb_set_reflections_delay(struct reverb_params *reverb,
    128                                           int reflections_delay);
    129 void offload_reverb_set_reverb_level(struct reverb_params *reverb,
    130                                      int reverb_level);
    131 void offload_reverb_set_delay(struct reverb_params *reverb, int delay);
    132 void offload_reverb_set_diffusion(struct reverb_params *reverb, int diffusion);
    133 void offload_reverb_set_density(struct reverb_params *reverb, int density);
    134 int offload_reverb_send_params(struct mixer_ctl *ctl,
    135                                struct reverb_params *reverb,
    136                                unsigned param_send_flags);
    137 
    138 #endif /*OFFLOAD_EFFECT_API_H_*/
    139