summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2012-01-17 17:34:58 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-01-17 17:34:58 -0800
commitf6fc420a79f98d93d953a60b1fc0a5b5f71a3fe2 (patch)
tree0afc84b502a6687ef52343489bf9308deaa27675 /include
parent9038c346d76d6f9e33be34b7760f39804553d993 (diff)
parentc6f331b3f48455c9a9cdf00fc82894badd0a7da6 (diff)
downloadhardware_libhardware_legacy-f6fc420a79f98d93d953a60b1fc0a5b5f71a3fe2.zip
hardware_libhardware_legacy-f6fc420a79f98d93d953a60b1fc0a5b5f71a3fe2.tar.gz
hardware_libhardware_legacy-f6fc420a79f98d93d953a60b1fc0a5b5f71a3fe2.tar.bz2
Merge "audio policy manager: stream volume per device"
Diffstat (limited to 'include')
-rw-r--r--include/hardware_legacy/AudioPolicyInterface.h17
-rw-r--r--include/hardware_legacy/AudioPolicyManagerBase.h18
2 files changed, 25 insertions, 10 deletions
diff --git a/include/hardware_legacy/AudioPolicyInterface.h b/include/hardware_legacy/AudioPolicyInterface.h
index 1ee0e20..a1c1fd5 100644
--- a/include/hardware_legacy/AudioPolicyInterface.h
+++ b/include/hardware_legacy/AudioPolicyInterface.h
@@ -128,10 +128,19 @@ public:
int indexMin,
int indexMax) = 0;
- // sets the new stream volume at a level corresponding to the supplied index
- virtual status_t setStreamVolumeIndex(AudioSystem::stream_type stream, int index) = 0;
- // retreive current volume index for the specified stream
- virtual status_t getStreamVolumeIndex(AudioSystem::stream_type stream, int *index) = 0;
+ // sets the new stream volume at a level corresponding to the supplied index for the
+ // supplied device. By convention, specifying AUDIO_DEVICE_OUT_DEFAULT means
+ // setting volume for all devices
+ virtual status_t setStreamVolumeIndex(AudioSystem::stream_type stream,
+ int index,
+ audio_devices_t device) = 0;
+
+ // retrieve current volume index for the specified stream and the
+ // specified device. By convention, specifying AUDIO_DEVICE_OUT_DEFAULT means
+ // querying the volume of the active device.
+ virtual status_t getStreamVolumeIndex(AudioSystem::stream_type stream,
+ int *index,
+ audio_devices_t device) = 0;
// return the strategy corresponding to a given stream type
virtual uint32_t getStrategyForStream(AudioSystem::stream_type stream) = 0;
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