summaryrefslogtreecommitdiffstats
path: root/include/hardware_legacy/AudioPolicyManagerBase.h
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2011-10-18 14:03:28 -0700
committerEric Laurent <elaurent@google.com>2011-10-18 18:29:26 -0700
commite43c5c4ca4477a6b384711552c3e990609039d93 (patch)
tree7fbfac1c95edb2a67066bad28173c9c056da350c /include/hardware_legacy/AudioPolicyManagerBase.h
parent3a9b39837b4c13a6221d5d60ec0b7452ec4edf8a (diff)
downloadhardware_libhardware_legacy-e43c5c4ca4477a6b384711552c3e990609039d93.zip
hardware_libhardware_legacy-e43c5c4ca4477a6b384711552c3e990609039d93.tar.gz
hardware_libhardware_legacy-e43c5c4ca4477a6b384711552c3e990609039d93.tar.bz2
Fix issue 5440852: Youtube volume is too small ...
When no DRC is applied by the platform when playing over the device speaker, faint audio signals are not boosted and barely audible until the media volume is raised to about one fourth of the range. Compensate this by applying a different volume curve for music stream when the speaker is selected. Change-Id: I03f316fb28150eda50b05dfa12310701e2674648
Diffstat (limited to 'include/hardware_legacy/AudioPolicyManagerBase.h')
-rw-r--r--include/hardware_legacy/AudioPolicyManagerBase.h27
1 files changed, 24 insertions, 3 deletions
diff --git a/include/hardware_legacy/AudioPolicyManagerBase.h b/include/hardware_legacy/AudioPolicyManagerBase.h
index 2cc8d87..d864b0a 100644
--- a/include/hardware_legacy/AudioPolicyManagerBase.h
+++ b/include/hardware_legacy/AudioPolicyManagerBase.h
@@ -146,7 +146,24 @@ protected:
float mDBAttenuation;
};
- static const VolumeCurvePoint sVolumeProfiles[NUM_STRATEGIES][VOLCNT];
+ // device categories used for volume curve management.
+ enum device_category {
+ DEVICE_CATEGORY_HEADSET,
+ DEVICE_CATEGORY_SPEAKER,
+ DEVICE_CATEGORY_EARPIECE,
+ DEVICE_CATEGORY_CNT
+ };
+
+ // default volume curve
+ static const VolumeCurvePoint sDefaultVolumeCurve[AudioPolicyManagerBase::VOLCNT];
+ // default volume curve for media strategy
+ static const VolumeCurvePoint sDefaultMediaVolumeCurve[AudioPolicyManagerBase::VOLCNT];
+ // volume curve for media strategy on speakers
+ static const VolumeCurvePoint sSpeakerMediaVolumeCurve[AudioPolicyManagerBase::VOLCNT];
+ // volume curve for sonification strategy on speakers
+ static const VolumeCurvePoint sSpeakerSonificationVolumeCurve[AudioPolicyManagerBase::VOLCNT];
+ // default volume curves per strategy and device category. See initializeVolumeCurves()
+ static const VolumeCurvePoint *sVolumeProfiles[NUM_STRATEGIES][DEVICE_CATEGORY_CNT];
// 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.
@@ -211,7 +228,7 @@ protected:
int mIndexCur; // current volume index
bool mCanBeMuted; // true is the stream can be muted
- VolumeCurvePoint mVolumeCurve[VOLCNT];
+ const VolumeCurvePoint *mVolumeCurve[DEVICE_CATEGORY_CNT];
};
// stream descriptor used for volume control
@@ -249,7 +266,8 @@ 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();
+ // initialize volume curves for each strategy and device category
+ 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);
@@ -319,6 +337,9 @@ protected:
status_t setEffectEnabled(EffectDescriptor *pDesc, bool enabled);
+ // returns the category the device belongs to with regard to volume curve management
+ static device_category getDeviceCategory(uint32_t device);
+
AudioPolicyClientInterface *mpClientInterface; // audio policy client interface
audio_io_handle_t mHardwareOutput; // hardware output handler
audio_io_handle_t mA2dpOutput; // A2DP output handler