summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratinm <atinm.dev@gmail.com>2011-09-24 15:10:09 +0400
committerGerrit Code Review <gerrit@review.cyanogenmod.com>2011-09-24 15:10:09 +0400
commitdab0d6cf5c7537e841bf5ce115d8435f9c9c7d4f (patch)
tree077e4cbb5500d0179da91dc59771de7d8cc2ebbd
parent40e99e22e1a45d36b7fac9c4452aa1d74550b424 (diff)
parentea3d5e1f6f3edd3da51e403cb5bfdfaab9b5b8ee (diff)
downloaddevice_samsung_aries-common-dab0d6cf5c7537e841bf5ce115d8435f9c9c7d4f.zip
device_samsung_aries-common-dab0d6cf5c7537e841bf5ce115d8435f9c9c7d4f.tar.gz
device_samsung_aries-common-dab0d6cf5c7537e841bf5ce115d8435f9c9c7d4f.tar.bz2
Merge "Set proper FM volume on start" into gingerbread
-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