1/*
2 * Copyright (C) 2018 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 android.hardware.audio.effect@5.0;
18
19import android.hardware.audio.common@5.0;
20import IEffect;
21
22interface IEnvironmentalReverbEffect extends IEffect {
23    /**
24     * Sets whether the effect should be bypassed.
25     */
26    setBypass(bool bypass) generates (Result retval);
27
28    /**
29     * Gets whether the effect should be bypassed.
30     */
31    getBypass() generates (Result retval, bool bypass);
32
33    enum ParamRange : int16_t {
34        ROOM_LEVEL_MIN = -6000,
35        ROOM_LEVEL_MAX = 0,
36        ROOM_HF_LEVEL_MIN = -4000,
37        ROOM_HF_LEVEL_MAX = 0,
38        DECAY_TIME_MIN = 100,
39        DECAY_TIME_MAX = 20000,
40        DECAY_HF_RATIO_MIN = 100,
41        DECAY_HF_RATIO_MAX = 1000,
42        REFLECTIONS_LEVEL_MIN = -6000,
43        REFLECTIONS_LEVEL_MAX = 0,
44        REFLECTIONS_DELAY_MIN = 0,
45        REFLECTIONS_DELAY_MAX = 65,
46        REVERB_LEVEL_MIN = -6000,
47        REVERB_LEVEL_MAX = 0,
48        REVERB_DELAY_MIN = 0,
49        REVERB_DELAY_MAX = 65,
50        DIFFUSION_MIN = 0,
51        DIFFUSION_MAX = 1000,
52        DENSITY_MIN = 0,
53        DENSITY_MAX = 1000
54    };
55
56    /**
57     * Sets the room level.
58     */
59    setRoomLevel(int16_t roomLevel) generates (Result retval);
60
61    /**
62     * Gets the room level.
63     */
64    getRoomLevel() generates (Result retval, int16_t roomLevel);
65
66    /**
67     * Sets the room high frequencies level.
68     */
69    setRoomHfLevel(int16_t roomHfLevel) generates (Result retval);
70
71    /**
72     * Gets the room high frequencies level.
73     */
74    getRoomHfLevel() generates (Result retval, int16_t roomHfLevel);
75
76    /**
77     * Sets the room decay time.
78     */
79    setDecayTime(uint32_t decayTime) generates (Result retval);
80
81    /**
82     * Gets the room decay time.
83     */
84    getDecayTime() generates (Result retval, uint32_t decayTime);
85
86    /**
87     * Sets the ratio of high frequencies decay.
88     */
89    setDecayHfRatio(int16_t decayHfRatio) generates (Result retval);
90
91    /**
92     * Gets the ratio of high frequencies decay.
93     */
94    getDecayHfRatio() generates (Result retval, int16_t decayHfRatio);
95
96    /**
97     * Sets the level of reflections in the room.
98     */
99    setReflectionsLevel(int16_t reflectionsLevel) generates (Result retval);
100
101    /**
102     * Gets the level of reflections in the room.
103     */
104    getReflectionsLevel() generates (Result retval, int16_t reflectionsLevel);
105
106    /**
107     * Sets the reflections delay in the room.
108     */
109    setReflectionsDelay(uint32_t reflectionsDelay) generates (Result retval);
110
111    /**
112     * Gets the reflections delay in the room.
113     */
114    getReflectionsDelay() generates (Result retval, uint32_t reflectionsDelay);
115
116    /**
117     * Sets the reverb level of the room.
118     */
119    setReverbLevel(int16_t reverbLevel) generates (Result retval);
120
121    /**
122     * Gets the reverb level of the room.
123     */
124    getReverbLevel() generates (Result retval, int16_t reverbLevel);
125
126    /**
127     * Sets the reverb delay of the room.
128     */
129    setReverbDelay(uint32_t reverDelay) generates (Result retval);
130
131    /**
132     * Gets the reverb delay of the room.
133     */
134    getReverbDelay() generates (Result retval, uint32_t reverbDelay);
135
136    /**
137     * Sets room diffusion.
138     */
139    setDiffusion(int16_t diffusion) generates (Result retval);
140
141    /**
142     * Gets room diffusion.
143     */
144    getDiffusion() generates (Result retval, int16_t diffusion);
145
146    /**
147     * Sets room wall density.
148     */
149    setDensity(int16_t density) generates (Result retval);
150
151    /**
152     * Gets room wall density.
153     */
154    getDensity() generates (Result retval, int16_t density);
155
156    struct AllProperties {
157        int16_t  roomLevel;         // in millibels,    range -6000 to 0
158        int16_t  roomHfLevel;       // in millibels,    range -4000 to 0
159        uint32_t decayTime;         // in milliseconds, range 100 to 20000
160        int16_t  decayHfRatio;      // in permilles,    range 100 to 1000
161        int16_t  reflectionsLevel;  // in millibels,    range -6000 to 0
162        uint32_t reflectionsDelay;  // in milliseconds, range 0 to 65
163        int16_t  reverbLevel;       // in millibels,    range -6000 to 0
164        uint32_t reverbDelay;       // in milliseconds, range 0 to 65
165        int16_t  diffusion;         // in permilles,    range 0 to 1000
166        int16_t  density;           // in permilles,    range 0 to 1000
167    };
168
169    /**
170     * Sets all properties at once.
171     */
172    setAllProperties(AllProperties properties) generates (Result retval);
173
174    /**
175     * Gets all properties at once.
176     */
177    getAllProperties() generates (Result retval, AllProperties properties);
178};
179