Home | History | Annotate | Download | only in audio_effects
      1 /*
      2  * Copyright (C) 2016 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 ANDROID_EFFECT_VIRTUALIZER_CORE_H_
     18 #define ANDROID_EFFECT_VIRTUALIZER_CORE_H_
     19 
     20 #include <system/audio_effect.h>
     21 
     22 #if __cplusplus
     23 extern "C" {
     24 #endif
     25 
     26 #ifndef OPENSL_ES_H_
     27 static const effect_uuid_t SL_IID_VIRTUALIZER_ = { 0x37cc2c00, 0xdddd, 0x11db, 0x8577,
     28         { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } };
     29 const effect_uuid_t * const SL_IID_VIRTUALIZER = &SL_IID_VIRTUALIZER_;
     30 #endif //OPENSL_ES_H_
     31 
     32 /* enumerated parameter settings for virtualizer effect */
     33 /* to keep in sync with frameworks/base/media/java/android/media/audiofx/Virtualizer.java */
     34 typedef enum
     35 {
     36     VIRTUALIZER_PARAM_STRENGTH_SUPPORTED,
     37     VIRTUALIZER_PARAM_STRENGTH,
     38     // used with EFFECT_CMD_GET_PARAM
     39     // format:
     40     //   parameters int32_t              VIRTUALIZER_PARAM_VIRTUAL_SPEAKER_ANGLES
     41     //              audio_channel_mask_t input channel mask
     42     //              audio_devices_t      audio output device
     43     //   output     int32_t*             an array of length 3 * the number of channels in the mask
     44     //                                       where entries are the succession of the channel mask
     45     //                                       of each speaker (i.e. a single bit is selected in the
     46     //                                       channel mask) followed by the azimuth and the
     47     //                                       elevation angles.
     48     //   status     int -EINVAL  if configuration is not supported or invalid or not forcing
     49     //                   0       if configuration is supported and the mode is forced
     50     // notes:
     51     // - all angles are expressed in degrees and are relative to the listener,
     52     // - for azimuth: 0 is the direction the listener faces, 180 is behind the listener, and
     53     //    -90 is to her/his left,
     54     // - for elevation: 0 is the horizontal plane, +90 is above the listener, -90 is below.
     55     VIRTUALIZER_PARAM_VIRTUAL_SPEAKER_ANGLES,
     56     // used with EFFECT_CMD_SET_PARAM
     57     // format:
     58     //   parameters  int32_t           VIRTUALIZER_PARAM_FORCE_VIRTUALIZATION_MODE
     59     //               audio_devices_t   audio output device
     60     //   status      int -EINVAL   if the device is not supported or invalid
     61     //                   0         if the device is supported and the mode is forced, or forcing
     62     //                               was disabled for the AUDIO_DEVICE_NONE audio device.
     63     VIRTUALIZER_PARAM_FORCE_VIRTUALIZATION_MODE,
     64     // used with EFFECT_CMD_GET_PARAM
     65     // format:
     66     //   parameters int32_t              VIRTUALIZER_PARAM_VIRTUALIZATION_MODE
     67     //   output     audio_device_t       audio device reflecting the current virtualization mode,
     68     //                                   AUDIO_DEVICE_NONE when not virtualizing
     69     //   status     int -EINVAL if an error occurred
     70     //                  0       if the output value is successfully retrieved
     71     VIRTUALIZER_PARAM_VIRTUALIZATION_MODE
     72 } t_virtualizer_params;
     73 
     74 #if __cplusplus
     75 }  // extern "C"
     76 #endif
     77 
     78 
     79 #endif /*ANDROID_EFFECT_VIRTUALIZER_CORE_H_*/
     80