1d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie/*
2d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie * Copyright (C) 2015 The Android Open Source Project
3d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie *
4d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie * Licensed under the Apache License, Version 2.0 (the "License");
5d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie * you may not use this file except in compliance with the License.
6d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie * You may obtain a copy of the License at
7d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie *
8d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie *      http://www.apache.org/licenses/LICENSE-2.0
9d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie *
10d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie * Unless required by applicable law or agreed to in writing, software
11d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie * distributed under the License is distributed on an "AS IS" BASIS,
12d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie * See the License for the specific language governing permissions and
14d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie * limitations under the License.
15d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie */
16d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie
17d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie#pragma once
18d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie
19d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie#include <system/audio.h>
20d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie#include <Volume.h>
21d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie#include <utils/Errors.h>
22d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie
23d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffienamespace android {
24d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie
25d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffieclass IVolumeCurvesCollection
26d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie{
27d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffiepublic:
28d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie    virtual void clearCurrentVolumeIndex(audio_stream_type_t stream) = 0;
29d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie    virtual void addCurrentVolumeIndex(audio_stream_type_t stream, audio_devices_t device,
30d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie                                       int index) = 0;
31d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie    virtual bool canBeMuted(audio_stream_type_t stream) = 0;
32d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie    virtual int getVolumeIndexMin(audio_stream_type_t stream) const = 0;
33d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie    virtual int getVolumeIndex(audio_stream_type_t stream, audio_devices_t device) = 0;
34d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie    virtual int getVolumeIndexMax(audio_stream_type_t stream) const = 0;
35d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie    virtual float volIndexToDb(audio_stream_type_t stream, device_category device,
36d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie                               int indexInUi) const = 0;
37d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie    virtual status_t initStreamVolume(audio_stream_type_t stream, int indexMin, int indexMax) = 0;
38d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie
39d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie    virtual void initializeVolumeCurves(bool /*isSpeakerDrcEnabled*/) {}
40d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie    virtual void switchVolumeCurve(audio_stream_type_t src, audio_stream_type_t dst) = 0;
41d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie    virtual void restoreOriginVolumeCurve(audio_stream_type_t stream)
42d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie    {
43d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie        switchVolumeCurve(stream, stream);
44d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie    }
451fd372e40ef40643fa9d036a0c9db043475b1b02Eric Laurent    virtual bool hasVolumeIndexForDevice(audio_stream_type_t stream,
461fd372e40ef40643fa9d036a0c9db043475b1b02Eric Laurent                                         audio_devices_t device) const = 0;
47d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie
48d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie    virtual status_t dump(int fd) const = 0;
49d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie
50d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffieprotected:
51d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie    virtual ~IVolumeCurvesCollection() {}
52d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie};
53d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie
54d1ab2bd4f1ea166a7e9e81cfd7f3e5dd47135d4dFrançois Gaffie}; // namespace android
55