• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2015 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 #pragma once
18 
19 #include <system/audio.h>
20 #include <Volume.h>
21 #include <utils/Errors.h>
22 
23 namespace android {
24 
25 class IVolumeCurvesCollection
26 {
27 public:
28     virtual void clearCurrentVolumeIndex(audio_stream_type_t stream) = 0;
29     virtual void addCurrentVolumeIndex(audio_stream_type_t stream, audio_devices_t device,
30                                        int index) = 0;
31     virtual bool canBeMuted(audio_stream_type_t stream) = 0;
32     virtual int getVolumeIndexMin(audio_stream_type_t stream) const = 0;
33     virtual int getVolumeIndex(audio_stream_type_t stream, audio_devices_t device) = 0;
34     virtual int getVolumeIndexMax(audio_stream_type_t stream) const = 0;
35     virtual float volIndexToDb(audio_stream_type_t stream, device_category device,
36                                int indexInUi) const = 0;
37     virtual status_t initStreamVolume(audio_stream_type_t stream, int indexMin, int indexMax) = 0;
38 
initializeVolumeCurves(bool)39     virtual void initializeVolumeCurves(bool /*isSpeakerDrcEnabled*/) {}
40     virtual void switchVolumeCurve(audio_stream_type_t src, audio_stream_type_t dst) = 0;
restoreOriginVolumeCurve(audio_stream_type_t stream)41     virtual void restoreOriginVolumeCurve(audio_stream_type_t stream)
42     {
43         switchVolumeCurve(stream, stream);
44     }
45     virtual bool hasVolumeIndexForDevice(audio_stream_type_t stream,
46                                          audio_devices_t device) const = 0;
47 
48     virtual status_t dump(int fd) const = 0;
49 
50 protected:
~IVolumeCurvesCollection()51     virtual ~IVolumeCurvesCollection() {}
52 };
53 
54 }; // namespace android
55