summaryrefslogtreecommitdiffstats
path: root/include/hardware_legacy/AudioPolicyManagerBase.h
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2011-12-14 18:18:36 -0800
committerEric Laurent <elaurent@google.com>2012-01-17 16:00:01 -0800
commitc6f331b3f48455c9a9cdf00fc82894badd0a7da6 (patch)
treee5f93ad7a7e9ebb225b0a8b37bdb0021cde4270d /include/hardware_legacy/AudioPolicyManagerBase.h
parentd97809bca3b086fe85475f462b6fdba6775f5ae1 (diff)
downloadhardware_libhardware_legacy-c6f331b3f48455c9a9cdf00fc82894badd0a7da6.zip
hardware_libhardware_legacy-c6f331b3f48455c9a9cdf00fc82894badd0a7da6.tar.gz
hardware_libhardware_legacy-c6f331b3f48455c9a9cdf00fc82894badd0a7da6.tar.bz2
audio policy manager: stream volume per device
Improve volume management by keeping track of volume for each type of device independently. AudioPolicyManagerBase now keeps track of stream volumes for each device and apply volume according to current device selection. Methods to set and get stream volume now specify the device class. A value for "default" device is always present for each stream and is used if a device is selected and no specific volume was ever set for this device. Change-Id: I06d8f43aa151a09014f7e47e81304c73ff82e9f8
Diffstat (limited to 'include/hardware_legacy/AudioPolicyManagerBase.h')
-rw-r--r--include/hardware_legacy/AudioPolicyManagerBase.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/include/hardware_legacy/AudioPolicyManagerBase.h b/include/hardware_legacy/AudioPolicyManagerBase.h
index 3ab748d..24368e3 100644
--- a/include/hardware_legacy/AudioPolicyManagerBase.h
+++ b/include/hardware_legacy/AudioPolicyManagerBase.h
@@ -101,8 +101,12 @@ public:
virtual void initStreamVolume(AudioSystem::stream_type stream,
int indexMin,
int indexMax);
- virtual status_t setStreamVolumeIndex(AudioSystem::stream_type stream, int index);
- virtual status_t getStreamVolumeIndex(AudioSystem::stream_type stream, int *index);
+ virtual status_t setStreamVolumeIndex(AudioSystem::stream_type stream,
+ int index,
+ audio_devices_t device);
+ virtual status_t getStreamVolumeIndex(AudioSystem::stream_type stream,
+ int *index,
+ audio_devices_t device);
// return the strategy corresponding to a given stream type
virtual uint32_t getStrategyForStream(AudioSystem::stream_type stream);
@@ -219,14 +223,14 @@ protected:
class StreamDescriptor
{
public:
- StreamDescriptor()
- : mIndexMin(0), mIndexMax(1), mIndexCur(1), mCanBeMuted(true) {}
+ StreamDescriptor();
- void dump(char* buffer, size_t size);
+ int getVolumeIndex(audio_devices_t device);
+ void dump(int fd);
int mIndexMin; // min volume index
int mIndexMax; // max volume index
- int mIndexCur; // current volume index
+ KeyedVector<audio_devices_t, int> mIndexCur; // current volume index per device
bool mCanBeMuted; // true is the stream can be muted
const VolumeCurvePoint *mVolumeCurve[DEVICE_CATEGORY_CNT];
@@ -340,6 +344,8 @@ protected:
// returns the category the device belongs to with regard to volume curve management
static device_category getDeviceCategory(uint32_t device);
+ // extract one device relevant for volume control from multiple device selection
+ static audio_devices_t getDeviceForVolume(audio_devices_t device);
AudioPolicyClientInterface *mpClientInterface; // audio policy client interface
audio_io_handle_t mHardwareOutput; // hardware output handler