summaryrefslogtreecommitdiffstats
path: root/libaudio
diff options
context:
space:
mode:
authorPawit Pornkitprasan <p.pawit@gmail.com>2011-09-18 07:52:00 +0700
committerPawit Pornkitprasan <p.pawit@gmail.com>2011-09-18 07:52:00 +0700
commitea3d5e1f6f3edd3da51e403cb5bfdfaab9b5b8ee (patch)
tree0f71a8b17e89e9e09b7083215d78c640fea8c3e0 /libaudio
parent53bda4538aef48b39d56bc7ff1b8f6007333bbd8 (diff)
downloaddevice_samsung_aries-common-ea3d5e1f6f3edd3da51e403cb5bfdfaab9b5b8ee.zip
device_samsung_aries-common-ea3d5e1f6f3edd3da51e403cb5bfdfaab9b5b8ee.tar.gz
device_samsung_aries-common-ea3d5e1f6f3edd3da51e403cb5bfdfaab9b5b8ee.tar.bz2
Set proper FM volume on start
Change-Id: I144433443cbf5c65693cbe584e987977c9f4d24b
Diffstat (limited to 'libaudio')
-rw-r--r--libaudio/AudioHardware.cpp4
-rw-r--r--libaudio/AudioHardware.h1
2 files changed, 5 insertions, 0 deletions
diff --git a/libaudio/AudioHardware.cpp b/libaudio/AudioHardware.cpp
index c958e36..3e28448 100644
--- a/libaudio/AudioHardware.cpp
+++ b/libaudio/AudioHardware.cpp
@@ -98,6 +98,7 @@ AudioHardware::AudioHardware() :
mActivatedCP(false),
#ifdef HAVE_FM_RADIO
mFmFd(-1),
+ mFmVolume(1),
mFmResumeAfterCall(false),
#endif
mDriverOp(DRV_NONE)
@@ -636,6 +637,7 @@ status_t AudioHardware::setMasterVolume(float volume)
#ifdef HAVE_FM_RADIO
status_t AudioHardware::setFmVolume(float v)
{
+ mFmVolume = v;
if (mFmFd > 0) {
__u8 fmVolume = (AudioSystem::logToLinear(v) + 5) / 7;
LOGD("%s %f %d", __func__, v, (int) fmVolume);
@@ -808,6 +810,8 @@ void AudioHardware::enableFMRadio() {
if (mFmFd < 0) {
mFmFd = open("/dev/radio0", O_RDWR);
+ // In case setFmVolume was called before FM was enabled, we save the volume and call it here.
+ setFmVolume(mFmVolume);
}
}
}
diff --git a/libaudio/AudioHardware.h b/libaudio/AudioHardware.h
index 2a1f6c7..8a781bf 100644
--- a/libaudio/AudioHardware.h
+++ b/libaudio/AudioHardware.h
@@ -184,6 +184,7 @@ private:
#ifdef HAVE_FM_RADIO
int mFmFd;
+ float mFmVolume;
bool mFmResumeAfterCall;
#endif