summaryrefslogtreecommitdiffstats
path: root/libaudio
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2010-10-19 10:39:43 -0700
committerEric Laurent <elaurent@google.com>2010-10-21 08:43:49 -0700
commitb7e04753906052fc7d9d6305e258b9a8291847fb (patch)
treef99741629b3d6c09fec8d1e473af5f84f8628404 /libaudio
parent3bcf0734204aa6043ace1c16ab3879213586915c (diff)
downloaddevice_samsung_crespo-b7e04753906052fc7d9d6305e258b9a8291847fb.zip
device_samsung_crespo-b7e04753906052fc7d9d6305e258b9a8291847fb.tar.gz
device_samsung_crespo-b7e04753906052fc7d9d6305e258b9a8291847fb.tar.bz2
Several audio HAL fixes:
Anton Rogozin <ant.rogozin@samsung.com> - Move RIL clock sync to starting of ringtone mode as requested by modem team - BT noise reduction turning off support Change-Id: I95a8157ca0da7a4432fe0d5bc3a4adba94cdb19a
Diffstat (limited to 'libaudio')
-rwxr-xr-xlibaudio/AudioHardwareALSA.cpp86
-rwxr-xr-xlibaudio/AudioHardwareALSA.h4
2 files changed, 72 insertions, 18 deletions
diff --git a/libaudio/AudioHardwareALSA.cpp b/libaudio/AudioHardwareALSA.cpp
index 86a6f30..db2a767 100755
--- a/libaudio/AudioHardwareALSA.cpp
+++ b/libaudio/AudioHardwareALSA.cpp
@@ -210,7 +210,8 @@ AudioHardwareALSA::AudioHardwareALSA() :
mSecRilLibHandle(NULL),
mRilClient(0),
mVrModeEnabled(false),
- mActivatedCP(false)
+ mActivatedCP(false),
+ mBluetoothECOff(false)
{
snd_lib_error_set_handler(&ALSAErrorHandler);
mMixer = new ALSAMixer;
@@ -539,8 +540,11 @@ status_t AudioHardwareALSA::doRouting_l(uint32_t device, bool force)
case AudioSystem::ROUTE_BLUETOOTH_SCO:
case AudioSystem::ROUTE_BLUETOOTH_SCO_HEADSET:
case AudioSystem::ROUTE_BLUETOOTH_SCO_CARKIT:
- LOGI("### incall mode bluetooth route");
- setCallAudioPath(mRilClient, SOUND_AUDIO_PATH_BLUETOOTH);
+ LOGI("### incall mode bluetooth route %s NR", mBluetoothECOff ? "NO" : "");
+ if (mBluetoothECOff)
+ setCallAudioPath(mRilClient, SOUND_AUDIO_PATH_BLUETOOTH_NO_NR);
+ else
+ setCallAudioPath(mRilClient, SOUND_AUDIO_PATH_BLUETOOTH);
break;
case AudioSystem::ROUTE_HEADSET :
@@ -562,21 +566,6 @@ status_t AudioHardwareALSA::doRouting_l(uint32_t device, bool force)
ret = mOutput->setDevice(mode, device, PLAYBACK, force);
- if (mSecRilLibHandle && (connectRILDIfRequired() == OK) ) {
- if (AudioSystem::MODE_IN_CALL == mode) {
- if (!mActivatedCP) {
- setCallClockSync(mRilClient, SOUND_CLOCK_START);
- mActivatedCP = true;
- }
- }
-
- if (AudioSystem::MODE_NORMAL == mode) {
- if(mActivatedCP)
- mActivatedCP = false;
- }
- }
-
-
return ret;
}
@@ -665,6 +654,14 @@ status_t AudioHardwareALSA::setMode(int mode)
status_t status = AudioHardwareBase::setMode(mode);
LOGV("setMode() : new %d, old %d", mMode, prevMode);
if (status == NO_ERROR) {
+ if ( (mMode == AudioSystem::MODE_RINGTONE) || (mMode == AudioSystem::MODE_IN_CALL) )
+ {
+ if ( (!mActivatedCP) && (mSecRilLibHandle) && (connectRILDIfRequired() == OK) ) {
+ setCallClockSync(mRilClient, SOUND_CLOCK_START);
+ mActivatedCP = true;
+ }
+ }
+
// make sure that doAudioRouteOrMute() is called by doRouting()
// when entering or exiting in call mode even if the new device
// selected is the same as current one.
@@ -680,6 +677,11 @@ status_t AudioHardwareALSA::setMode(int mode)
mOutput->close();
}
}
+
+ if (mMode == AudioSystem::MODE_NORMAL) {
+ if(mActivatedCP)
+ mActivatedCP = false;
+ }
}
return status;
@@ -705,6 +707,54 @@ int AudioHardwareALSA::setVoiceRecordGain_l(bool enable)
return NO_ERROR;
}
+status_t AudioHardwareALSA::setParameters(const String8& keyValuePairs)
+{
+ AudioParameter param = AudioParameter(keyValuePairs);
+ String8 bt_nrec_key = String8("bt_headset_nrec");
+ String8 value;
+
+ LOGV("setParameters(%s)", keyValuePairs.string());
+
+ if (param.get(bt_nrec_key, value) == NO_ERROR) {
+ setBluetoothNrEcOnOff((value == "on") ? false : true);
+ }
+
+ return NO_ERROR;
+}
+
+void AudioHardwareALSA::setBluetoothNrEcOnOff(bool disable)
+{
+ LOGV("setBluetoothNrEcOnOff(%s)", disable ? "true" : "false");
+
+ if (disable != mBluetoothECOff)
+ {
+ mBluetoothECOff = disable;
+
+ if ( (mOutput) && (AudioSystem::MODE_IN_CALL == mMode) &&
+ (mSecRilLibHandle) && (connectRILDIfRequired() == OK)) {
+
+ uint32_t device = mOutput->device();
+
+ switch (device) {
+ case AudioSystem::ROUTE_BLUETOOTH_SCO:
+ case AudioSystem::ROUTE_BLUETOOTH_SCO_HEADSET:
+ case AudioSystem::ROUTE_BLUETOOTH_SCO_CARKIT:
+ LOGV("### incall mode bluetooth EC %s route", mBluetoothECOff ? "OFF" : "ON");
+ if (mBluetoothECOff)
+ setCallAudioPath(mRilClient, SOUND_AUDIO_PATH_BLUETOOTH_NO_NR);
+ else
+ setCallAudioPath(mRilClient, SOUND_AUDIO_PATH_BLUETOOTH);
+ break;
+
+ default :
+ LOGE("Bluetooth path is not activated!!");
+ break;
+ }
+ }
+ }
+}
+
+
// ----------------------------------------------------------------------------
ALSAStreamOps::ALSAStreamOps() :
diff --git a/libaudio/AudioHardwareALSA.h b/libaudio/AudioHardwareALSA.h
index eac7b7a..c3b6caa 100755
--- a/libaudio/AudioHardwareALSA.h
+++ b/libaudio/AudioHardwareALSA.h
@@ -350,6 +350,8 @@ namespace android
int setVoiceRecordGain(bool enable);
int setVoiceRecordGain_l(bool enable);
+ virtual status_t setParameters(const String8& keyValuePairs);
+
protected:
/**
* doRouting actually initiates the routing. A call to setRouting
@@ -375,6 +377,7 @@ namespace android
HRilClient mRilClient;
bool mVrModeEnabled;
bool mActivatedCP;
+ bool mBluetoothECOff;
HRilClient (*openClientRILD) (void);
int (*disconnectRILD) (HRilClient);
@@ -387,6 +390,7 @@ namespace android
void loadRILD(void);
status_t connectRILDIfRequired(void);
+ void setBluetoothNrEcOnOff(bool disable);
};