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 android.hardware.audio.effect@2.0;
18
19import android.hardware.audio.common@2.0;
20import IEffect;
21
22interface IEqualizerEffect extends IEffect {
23    /**
24     * Gets the number of frequency bands that the equalizer supports.
25     */
26    getNumBands() generates (Result retval, uint16_t numBands);
27
28    /**
29     * Returns the minimum and maximum band levels supported.
30     */
31    getLevelRange()
32            generates (Result retval, int16_t minLevel, int16_t maxLevel);
33
34    /**
35     * Sets the gain for the given equalizer band.
36     */
37    setBandLevel(uint16_t band, int16_t level) generates (Result retval);
38
39    /**
40     * Gets the gain for the given equalizer band.
41     */
42    getBandLevel(uint16_t band) generates (Result retval, int16_t level);
43
44    /**
45     * Gets the center frequency of the given band, in milliHertz.
46     */
47    getBandCenterFrequency(uint16_t band)
48            generates (Result retval, uint32_t centerFreqmHz);
49
50    /**
51     * Gets the frequency range of the given frequency band, in milliHertz.
52     */
53    getBandFrequencyRange(uint16_t band)
54            generates (Result retval, uint32_t minFreqmHz, uint32_t maxFreqmHz);
55
56    /**
57     * Gets the band that has the most effect on the given frequency
58     * in milliHertz.
59     */
60    getBandForFrequency(uint32_t freqmHz)
61            generates (Result retval, uint16_t band);
62
63    /**
64     * Gets the names of all presets the equalizer supports.
65     */
66    getPresetNames() generates (Result retval, vec<string> names);
67
68    /**
69     * Sets the current preset using the index of the preset in the names
70     * vector returned via 'getPresetNames'.
71     */
72    setCurrentPreset(uint16_t preset) generates (Result retval);
73
74    /**
75     * Gets the current preset.
76     */
77    getCurrentPreset() generates (Result retval, uint16_t preset);
78
79    struct AllProperties {
80        uint16_t curPreset;
81        vec<int16_t> bandLevels;
82    };
83
84    /**
85     * Sets all properties at once.
86     */
87    setAllProperties(AllProperties properties) generates (Result retval);
88
89    /**
90     * Gets all properties at once.
91     */
92    getAllProperties() generates (Result retval, AllProperties properties);
93};
94