diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/hardware_legacy/AudioPolicyInterface.h | 17 | ||||
| -rw-r--r-- | include/hardware_legacy/AudioPolicyManagerBase.h | 18 |
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 |
