diff options
| author | Jean-Michel Trivi <jmtrivi@google.com> | 2011-01-24 16:05:03 -0800 |
|---|---|---|
| committer | Jean-Michel Trivi <jmtrivi@google.com> | 2011-01-25 09:35:39 -0800 |
| commit | f2faac71fd54ef16807b94d19e46d7ad99b001a7 (patch) | |
| tree | 2f95df5fffce520ee4f8c93c51328cc6af010ea1 /include/hardware_legacy/AudioPolicyManagerBase.h | |
| parent | 61f357948648ff45d35ec79725db4e1b12c268dc (diff) | |
| download | hardware_libhardware_legacy-f2faac71fd54ef16807b94d19e46d7ad99b001a7.tar.gz hardware_libhardware_legacy-f2faac71fd54ef16807b94d19e46d7ad99b001a7.tar.bz2 hardware_libhardware_legacy-f2faac71fd54ef16807b94d19e46d7ad99b001a7.zip | |
Bug 3376700 Update APM header for volume initialization and computation
Change-Id: I7cb31c9ecd3c347bfa72cad5a331500a20fdcfbe
Diffstat (limited to 'include/hardware_legacy/AudioPolicyManagerBase.h')
| -rw-r--r-- | include/hardware_legacy/AudioPolicyManagerBase.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/hardware_legacy/AudioPolicyManagerBase.h b/include/hardware_legacy/AudioPolicyManagerBase.h index ca2c1e6..1a4a5f8 100644 --- a/include/hardware_legacy/AudioPolicyManagerBase.h +++ b/include/hardware_legacy/AudioPolicyManagerBase.h @@ -41,6 +41,8 @@ namespace android { #define NUM_TEST_OUTPUTS 5 +#define NUM_VOL_CURVE_KNEES 2 + // ---------------------------------------------------------------------------- // AudioPolicyManagerBase implements audio policy manager behavior common to all platforms. // Each platform must implement an AudioPolicyManager class derived from AudioPolicyManagerBase @@ -185,6 +187,15 @@ protected: int mIndexMax; // max volume index int mIndexCur; // current volume index bool mCanBeMuted; // true is the stream can be muted + + // 4 points to define the volume attenuation curve, each characterized by the volume + // index (from 0 to 100) at which they apply, and the attenuation in dB at that index. + int mVolIndex[NUM_VOL_CURVE_KNEES+2]; // minimum index, index at knees, and max index + float mVolDbAtt[NUM_VOL_CURVE_KNEES+2]; // largest attenuation, attenuation at knees, + // and attenuation at max vol (usually 0dB) + // indices in mVolIndex and mVolDbAtt respectively for points at lowest volume, knee 1, + // knee 2 and highest volume. + enum { VOLMIN = 0, VOLKNEE1 = 1, VOLKNEE2 = 2, VOLMAX = 3 }; }; // stream descriptor used for volume control @@ -221,6 +232,7 @@ protected: virtual uint32_t getDeviceForInputSource(int inputSource); // return io handle of active input or 0 if no input is active audio_io_handle_t getActiveInput(); + virtual void initializeVolumeCurves(); // compute the actual volume for a given stream according to the requested index and a particular // device virtual float computeVolume(int stream, int index, audio_io_handle_t output, uint32_t device); @@ -332,6 +344,10 @@ protected: uint32_t mTestChannels; uint32_t mTestLatencyMs; #endif //AUDIO_POLICY_TEST + +private: + static float volIndexToAmpl(uint32_t device, const StreamDescriptor& streamDesc, + int indexInUi); }; }; |
