From cd057ad2774903c62f5c11bc71c4e7357aee71b8 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Mon, 12 Sep 2011 11:38:12 -0700 Subject: Issue 5256795: Phone ringtone volume is too low Modified the volume curve for ringtones and notifications in audio policy manager. The first volume step now corresponds to -30dB instead of -50dB thus making ringtone much more audible for low volume settings. Also made a generic implementation of volume curves according to audio policy strategies. Change-Id: Ieb7916ba2e53c2a10a47efec82814cabed21c48b --- include/hardware_legacy/AudioPolicyManagerBase.h | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/hardware_legacy/AudioPolicyManagerBase.h b/include/hardware_legacy/AudioPolicyManagerBase.h index 21cf872..2cc8d87 100644 --- a/include/hardware_legacy/AudioPolicyManagerBase.h +++ b/include/hardware_legacy/AudioPolicyManagerBase.h @@ -133,6 +133,21 @@ protected: NUM_STRATEGIES }; + // 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. + // we use 100 steps to avoid rounding errors when computing the volume in volIndexToAmpl() + + enum { VOLMIN = 0, VOLKNEE1 = 1, VOLKNEE2 = 2, VOLMAX = 3, VOLCNT = 4}; + + class VolumeCurvePoint + { + public: + int mIndex; + float mDBAttenuation; + }; + + static const VolumeCurvePoint sVolumeProfiles[NUM_STRATEGIES][VOLCNT]; + // descriptor for audio outputs. Used to maintain current configuration of each opened audio output // and keep track of the usage of this output by each audio stream type. class AudioOutputDescriptor @@ -196,14 +211,7 @@ protected: 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 }; + VolumeCurvePoint mVolumeCurve[VOLCNT]; }; // stream descriptor used for volume control -- cgit v1.2.3