Mikhail Naganov | 159260c | 2020-07-23 18:08:26 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2020 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 | package android.hardware.audio.effect@7.0; |
| 18 | |
| 19 | import android.hardware.audio.common@7.0; |
| 20 | import IEffect; |
| 21 | |
| 22 | interface IVirtualizerEffect extends IEffect { |
| 23 | /** |
| 24 | * Returns whether setting virtualization strength is supported. |
| 25 | */ |
| 26 | isStrengthSupported() generates (bool strengthSupported); |
| 27 | |
| 28 | enum StrengthRange : uint16_t { |
| 29 | MIN = 0, |
| 30 | MAX = 1000 |
| 31 | }; |
| 32 | |
| 33 | /** |
| 34 | * Sets virtualization strength. |
| 35 | * |
| 36 | * @param strength strength of the effect. The valid range for strength |
| 37 | * strength is [0, 1000], where 0 per mille designates the |
| 38 | * mildest effect and 1000 per mille designates the |
| 39 | * strongest. |
| 40 | * @return retval operation completion status. |
| 41 | */ |
| 42 | setStrength(uint16_t strength) generates (Result retval); |
| 43 | |
| 44 | /** |
| 45 | * Gets virtualization strength. |
| 46 | */ |
| 47 | getStrength() generates (Result retval, uint16_t strength); |
| 48 | |
Mikhail Naganov | 9036eda | 2020-12-10 18:47:51 -0800 | [diff] [blame] | 49 | struct SpeakerAngles { |
Mikhail Naganov | 159260c | 2020-07-23 18:08:26 +0000 | [diff] [blame] | 50 | /** Speaker channel mask */ |
Mikhail Naganov | 9036eda | 2020-12-10 18:47:51 -0800 | [diff] [blame] | 51 | AudioChannelMask mask; |
| 52 | /** |
| 53 | * Horizontal speaker position angles for each channel ordered from LSb |
| 54 | * to MSb in the channel mask. The number of values is the number of |
| 55 | * channels in the channel mask. |
| 56 | * |
| 57 | * All angles are expressed in degrees and are relative to the listener. |
| 58 | * - 0 is the direction the listener faces; |
| 59 | * - 180 is behind the listener; |
| 60 | * - -90 is to their left. |
| 61 | */ |
| 62 | vec<int16_t> azimuth; |
| 63 | /** |
| 64 | * Vertical speaker position angles for each channel ordered from LSb |
| 65 | * to MSb in the channel mask. The number of values is the number of |
| 66 | * channels in the channel mask. |
| 67 | * |
| 68 | * All angles are expressed in degrees and are relative to the listener. |
| 69 | * - 0 is the horizontal plane of the listener; |
| 70 | * - +90 is above the listener; |
| 71 | * - -90 is below the listener. |
| 72 | */ |
| 73 | vec<int16_t> elevation; |
Mikhail Naganov | 159260c | 2020-07-23 18:08:26 +0000 | [diff] [blame] | 74 | }; |
| 75 | /** |
| 76 | * Retrieves virtual speaker angles for the given channel mask on the |
| 77 | * specified device. |
| 78 | */ |
Mikhail Naganov | 9036eda | 2020-12-10 18:47:51 -0800 | [diff] [blame] | 79 | getVirtualSpeakerAngles(AudioChannelMask mask, DeviceAddress device) |
| 80 | generates (Result retval, SpeakerAngles speakerAngles); |
Mikhail Naganov | 159260c | 2020-07-23 18:08:26 +0000 | [diff] [blame] | 81 | |
| 82 | /** |
| 83 | * Forces the virtualizer effect for the given output device. |
| 84 | */ |
Mikhail Naganov | 7dd87f4 | 2020-08-04 23:37:05 +0000 | [diff] [blame] | 85 | forceVirtualizationMode(DeviceAddress device) generates (Result retval); |
Mikhail Naganov | 159260c | 2020-07-23 18:08:26 +0000 | [diff] [blame] | 86 | |
| 87 | /** |
| 88 | * Returns audio device reflecting the current virtualization mode, |
Mikhail Naganov | 7dd87f4 | 2020-08-04 23:37:05 +0000 | [diff] [blame] | 89 | * Device type can be empty when not virtualizing. |
Mikhail Naganov | 159260c | 2020-07-23 18:08:26 +0000 | [diff] [blame] | 90 | */ |
Mikhail Naganov | 7dd87f4 | 2020-08-04 23:37:05 +0000 | [diff] [blame] | 91 | getVirtualizationMode() generates (Result retval, DeviceAddress device); |
Mikhail Naganov | 159260c | 2020-07-23 18:08:26 +0000 | [diff] [blame] | 92 | }; |