summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Grossman <johngro@google.com>2011-08-22 13:25:06 -0700
committerJohn Grossman <johngro@google.com>2011-08-26 16:54:09 -0700
commit5be2265e30566bf2f5a44f5861595bf02cb9a4d7 (patch)
tree618204948c28d7191d90b579b96af87664a03266
parent953c1140659ae935e4718d4fd48662db178814f6 (diff)
downloadhardware_libhardware_legacy-5be2265e30566bf2f5a44f5861595bf02cb9a4d7.tar.gz
hardware_libhardware_legacy-5be2265e30566bf2f5a44f5861595bf02cb9a4d7.tar.bz2
hardware_libhardware_legacy-5be2265e30566bf2f5a44f5861595bf02cb9a4d7.zip
Add a bridge implementation of get_master_volume.
Add an implementation of the new get_master_volume method to bridge from the new C only audio HAL to the old C++ legacy audio HAL. Change-Id: Ib66bdcd3bee50949047e7ad51388e15491a71724
-rw-r--r--audio/AudioHardwareInterface.cpp5
-rw-r--r--audio/audio_hw_hal.cpp7
-rw-r--r--include/hardware_legacy/AudioHardwareBase.h1
-rw-r--r--include/hardware_legacy/AudioHardwareInterface.h8
4 files changed, 21 insertions, 0 deletions
diff --git a/audio/AudioHardwareInterface.cpp b/audio/AudioHardwareInterface.cpp
index 9cec267..4997a6a 100644
--- a/audio/AudioHardwareInterface.cpp
+++ b/audio/AudioHardwareInterface.cpp
@@ -125,6 +125,11 @@ size_t AudioHardwareBase::getInputBufferSize(uint32_t sampleRate, int format, in
return 320;
}
+status_t AudioHardwareBase::getMasterVolume(float *volume)
+{
+ return INVALID_OPERATION;
+}
+
status_t AudioHardwareBase::dumpState(int fd, const Vector<String16>& args)
{
const size_t SIZE = 256;
diff --git a/audio/audio_hw_hal.cpp b/audio/audio_hw_hal.cpp
index e6805c5..f249f88 100644
--- a/audio/audio_hw_hal.cpp
+++ b/audio/audio_hw_hal.cpp
@@ -346,6 +346,12 @@ static int adev_set_master_volume(struct audio_hw_device *dev, float volume)
return ladev->hwif->setMasterVolume(volume);
}
+static int adev_get_master_volume(struct audio_hw_device *dev, float* volume)
+{
+ struct legacy_audio_device *ladev = to_ladev(dev);
+ return ladev->hwif->getMasterVolume(volume);
+}
+
static int adev_set_mode(struct audio_hw_device *dev, int mode)
{
struct legacy_audio_device *ladev = to_ladev(dev);
@@ -553,6 +559,7 @@ static int legacy_adev_open(const hw_module_t* module, const char* name,
ladev->device.init_check = adev_init_check;
ladev->device.set_voice_volume = adev_set_voice_volume;
ladev->device.set_master_volume = adev_set_master_volume;
+ ladev->device.get_master_volume = adev_get_master_volume;
ladev->device.set_mode = adev_set_mode;
ladev->device.set_mic_mute = adev_set_mic_mute;
ladev->device.get_mic_mute = adev_get_mic_mute;
diff --git a/include/hardware_legacy/AudioHardwareBase.h b/include/hardware_legacy/AudioHardwareBase.h
index 3dec357..eac40dc 100644
--- a/include/hardware_legacy/AudioHardwareBase.h
+++ b/include/hardware_legacy/AudioHardwareBase.h
@@ -46,6 +46,7 @@ public:
virtual String8 getParameters(const String8& keys);
virtual size_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount);
+ virtual status_t getMasterVolume(float *volume);
/**This method dumps the state of the audio hardware */
virtual status_t dumpState(int fd, const Vector<String16>& args);
diff --git a/include/hardware_legacy/AudioHardwareInterface.h b/include/hardware_legacy/AudioHardwareInterface.h
index 847fe6b..425b0a5 100644
--- a/include/hardware_legacy/AudioHardwareInterface.h
+++ b/include/hardware_legacy/AudioHardwareInterface.h
@@ -210,6 +210,14 @@ public:
virtual status_t setMasterVolume(float volume) = 0;
/**
+ * Get the current master volume value for the HAL, if the HAL supports
+ * master volume control. AudioFlinger will query this value from the
+ * primary audio HAL when the service starts and use the value for setting
+ * the initial master volume across all HALs.
+ */
+ virtual status_t getMasterVolume(float *volume) = 0;
+
+ /**
* setMode is called when the audio mode changes. NORMAL mode is for
* standard audio playback, RINGTONE when a ringtone is playing, and IN_CALL
* when a call is in progress.