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
17package [email protected];
18
19import [email protected];
20import IEffect;
21
22interface 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
49    struct SpeakerAngle {
50        AudioChannelMask mask; // speaker channel mask (1 bit set).
51        // all angles are expressed in degrees and
52        // are relative to the listener.
53        int16_t azimuth; // 0 is the direction the listener faces
54                         // 180 is behind the listener
55                         // -90 is to their left
56        int16_t elevation; // 0 is the horizontal plane
57                           // +90 is above the listener, -90 is below
58    };
59    /**
60     * Retrieves virtual speaker angles for the given channel mask on the
61     * specified device.
62     */
63    getVirtualSpeakerAngles(AudioChannelMask mask, AudioDevice device)
64            generates (Result retval, vec<SpeakerAngle> speakerAngles);
65
66    /**
67     * Forces the virtualizer effect for the given output device.
68     */
69    forceVirtualizationMode(AudioDevice device) generates (Result retval);
70
71    /**
72     * Returns audio device reflecting the current virtualization mode,
73     * AUDIO_DEVICE_NONE when not virtualizing.
74     */
75    getVirtualizationMode() generates (Result retval, AudioDevice device);
76};
77