Home | History | Annotate | Download | only in src
      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 <StreamDescriptor.h>
     20 #include <utils/KeyedVector.h>
     21 #include <system/audio.h>
     22 #include <utils/Errors.h>
     23 #include <utils/RefBase.h>
     24 
     25 namespace android {
     26 
     27 class StreamDescriptor;
     28 
     29 class Gains
     30 {
     31 public :
     32     static float volIndexToAmpl(Volume::device_category deviceCategory,
     33                                 const StreamDescriptor& streamDesc,
     34                                 int indexInUi);
     35 
     36     static float volIndexToDb(Volume::device_category deviceCategory,
     37                               const StreamDescriptor& streamDesc,
     38                               int indexInUi);
     39 
     40     // default volume curve
     41     static const VolumeCurvePoint sDefaultVolumeCurve[Volume::VOLCNT];
     42     // default volume curve for media strategy
     43     static const VolumeCurvePoint sDefaultMediaVolumeCurve[Volume::VOLCNT];
     44     // volume curve for non-media audio on ext media outputs (HDMI, Line, etc)
     45     static const VolumeCurvePoint sExtMediaSystemVolumeCurve[Volume::VOLCNT];
     46     // volume curve for media strategy on speakers
     47     static const VolumeCurvePoint sSpeakerMediaVolumeCurve[Volume::VOLCNT];
     48     static const VolumeCurvePoint sSpeakerMediaVolumeCurveDrc[Volume::VOLCNT];
     49     // volume curve for sonification strategy on speakers
     50     static const VolumeCurvePoint sSpeakerSonificationVolumeCurve[Volume::VOLCNT];
     51     static const VolumeCurvePoint sSpeakerSonificationVolumeCurveDrc[Volume::VOLCNT];
     52     static const VolumeCurvePoint sDefaultSystemVolumeCurve[Volume::VOLCNT];
     53     static const VolumeCurvePoint sDefaultSystemVolumeCurveDrc[Volume::VOLCNT];
     54     static const VolumeCurvePoint sHeadsetSystemVolumeCurve[Volume::VOLCNT];
     55     static const VolumeCurvePoint sDefaultVoiceVolumeCurve[Volume::VOLCNT];
     56     static const VolumeCurvePoint sSpeakerVoiceVolumeCurve[Volume::VOLCNT];
     57     static const VolumeCurvePoint sLinearVolumeCurve[Volume::VOLCNT];
     58     static const VolumeCurvePoint sSilentVolumeCurve[Volume::VOLCNT];
     59     static const VolumeCurvePoint sFullScaleVolumeCurve[Volume::VOLCNT];
     60     // default volume curves per stream and device category. See initializeVolumeCurves()
     61     static const VolumeCurvePoint *sVolumeProfiles[AUDIO_STREAM_CNT][Volume::DEVICE_CATEGORY_CNT];
     62 };
     63 
     64 }; // namespace android
     65