working msm8960 audio.primary and audio_policy HALs
These HALs build on JB and work on mako
Change-Id: I89bff4f1269d47a33d8e2a53a0b65d69aaf53240
Signed-off-by: Iliyan Malchev <malchev@google.com>
diff --git a/alsa_sound/ALSAControl.cpp b/alsa_sound/ALSAControl.cpp
index c788e5a..59d550e 100644
--- a/alsa_sound/ALSAControl.cpp
+++ b/alsa_sound/ALSAControl.cpp
@@ -24,10 +24,10 @@
#include <unistd.h>
#include <dlfcn.h>
-#define LOG_TAG "ALSAControl"
+#define LOG_TAG "alsa.msm8960"
//#define LOG_NDEBUG 0
-#define LOG_NDDEBUG 0
#include <utils/Log.h>
+
#include <utils/String8.h>
#include <cutils/properties.h>
@@ -41,9 +41,9 @@
ALSAControl::ALSAControl(const char *device)
{
- LOGD("ALSAControl: ctor device %s", device);
+ ALOGD("ALSAControl: ctor device %s", device);
mHandle = mixer_open(device);
- LOGV("ALSAControl: ctor mixer %p", mHandle);
+ ALOGV("ALSAControl: ctor mixer %p", mHandle);
}
ALSAControl::~ALSAControl()
@@ -56,7 +56,7 @@
struct mixer_ctl *ctl;
if (!mHandle) {
- LOGE("Control not initialized");
+ ALOGE("Control not initialized");
return NO_INIT;
}
@@ -72,16 +72,16 @@
{
struct mixer_ctl *ctl;
int ret = 0;
- LOGD("set:: name %s value %d index %d", name, value, index);
+ ALOGD("set:: name %s value %d index %d", name, value, index);
if (!mHandle) {
- LOGE("Control not initialized");
+ ALOGE("Control not initialized");
return NO_INIT;
}
// ToDo: Do we need to send index here? Right now it works with 0
ctl = mixer_get_control(mHandle, name, 0);
if(ctl == NULL) {
- LOGE("Could not get the mixer control");
+ ALOGE("Could not get the mixer control");
return BAD_VALUE;
}
ret = mixer_ctl_set(ctl, value);
@@ -92,16 +92,16 @@
{
struct mixer_ctl *ctl;
int ret = 0;
- LOGD("set:: name %s value %s", name, value);
+ ALOGD("set:: name %s value %s", name, value);
if (!mHandle) {
- LOGE("Control not initialized");
+ ALOGE("Control not initialized");
return NO_INIT;
}
ctl = mixer_get_control(mHandle, name, 0);
if(ctl == NULL) {
- LOGE("Could not get the mixer control");
+ ALOGE("Could not get the mixer control");
return BAD_VALUE;
}
ret = mixer_ctl_select(ctl, value);
@@ -112,16 +112,16 @@
{
struct mixer_ctl *ctl;
int ret = 0;
- LOGD("setext:: name %s count %d", name, count);
+ ALOGD("setext:: name %s count %d", name, count);
if (!mHandle) {
- LOGE("Control not initialized");
+ ALOGE("Control not initialized");
return NO_INIT;
}
// ToDo: Do we need to send index here? Right now it works with 0
ctl = mixer_get_control(mHandle, name, 0);
if(ctl == NULL) {
- LOGE("Could not get the mixer control");
+ ALOGE("Could not get the mixer control");
return BAD_VALUE;
}
ret = mixer_ctl_set_value(ctl, count, setValues);
diff --git a/alsa_sound/ALSAMixer.cpp b/alsa_sound/ALSAMixer.cpp
index 8e33a6b..2c1abcb 100644
--- a/alsa_sound/ALSAMixer.cpp
+++ b/alsa_sound/ALSAMixer.cpp
@@ -25,6 +25,7 @@
#define LOG_TAG "AudioHardwareALSA"
#include <utils/Log.h>
+
#include <utils/String8.h>
#include <cutils/properties.h>
@@ -100,16 +101,16 @@
int err;
if ((err = snd_mixer_open(mixer, 0)) < 0) {
- LOGE("Unable to open mixer: %s", snd_strerror(err));
+ ALOGE("Unable to open mixer: %s", snd_strerror(err));
return err;
}
if ((err = snd_mixer_attach(*mixer, name)) < 0) {
- LOGW("Unable to attach mixer to device %s: %s",
+ ALOGW("Unable to attach mixer to device %s: %s",
name, snd_strerror(err));
if ((err = snd_mixer_attach(*mixer, "hw:00")) < 0) {
- LOGE("Unable to attach mixer to device default: %s",
+ ALOGE("Unable to attach mixer to device default: %s",
snd_strerror(err));
snd_mixer_close (*mixer);
@@ -119,7 +120,7 @@
}
if ((err = snd_mixer_selem_register(*mixer, NULL, NULL)) < 0) {
- LOGE("Unable to register mixer elements: %s", snd_strerror(err));
+ ALOGE("Unable to register mixer elements: %s", snd_strerror(err));
snd_mixer_close (*mixer);
*mixer = NULL;
return err;
@@ -127,7 +128,7 @@
// Get the mixer controls from the kernel
if ((err = snd_mixer_load(*mixer)) < 0) {
- LOGE("Unable to load mixer elements: %s", snd_strerror(err));
+ ALOGE("Unable to load mixer elements: %s", snd_strerror(err));
snd_mixer_close (*mixer);
*mixer = NULL;
return err;
@@ -204,7 +205,7 @@
}
}
- LOGV("Mixer: master '%s' %s.", info->name, info->elem ? "found" : "not found");
+ ALOGV("Mixer: master '%s' %s.", info->name, info->elem ? "found" : "not found");
for (int j = 0; mixerProp[j][i].device; j++) {
@@ -240,10 +241,10 @@
break;
}
}
- LOGV("Mixer: route '%s' %s.", info->name, info->elem ? "found" : "not found");
+ ALOGV("Mixer: route '%s' %s.", info->name, info->elem ? "found" : "not found");
}
}
- LOGV("mixer initialized.");
+ ALOGV("mixer initialized.");
}
ALSAMixer::~ALSAMixer()
@@ -261,7 +262,7 @@
}
}
}
- LOGV("mixer destroyed.");
+ ALOGV("mixer destroyed.");
}
status_t ALSAMixer::setMasterVolume(float volume)
@@ -360,7 +361,7 @@
int err = snd_mixer_selem_set_capture_switch_all (info->elem, static_cast<int>(!state));
if (err < 0) {
- LOGE("Unable to %s capture mixer switch %s",
+ ALOGE("Unable to %s capture mixer switch %s",
state ? "enable" : "disable", info->name);
return INVALID_OPERATION;
}
@@ -401,7 +402,7 @@
int err = snd_mixer_selem_set_playback_switch_all (info->elem, static_cast<int>(!state));
if (err < 0) {
- LOGE("Unable to %s playback mixer switch %s",
+ ALOGE("Unable to %s playback mixer switch %s",
state ? "enable" : "disable", info->name);
return INVALID_OPERATION;
}
diff --git a/alsa_sound/ALSAStreamOps.cpp b/alsa_sound/ALSAStreamOps.cpp
index bbb556c..c37ced7 100644
--- a/alsa_sound/ALSAStreamOps.cpp
+++ b/alsa_sound/ALSAStreamOps.cpp
@@ -24,9 +24,8 @@
#include <unistd.h>
#include <dlfcn.h>
-#define LOG_TAG "ALSAStreamOps"
+#define LOG_TAG "audio.primary.msm8960"
//#define LOG_NDEBUG 0
-#define LOG_NDDEBUG 0
#include <utils/Log.h>
#include <utils/String8.h>
@@ -56,7 +55,7 @@
if((mParent->mVoipStreamCount)) {
mParent->mVoipStreamCount--;
if(mParent->mVoipStreamCount > 0) {
- LOGD("ALSAStreamOps::close() Ignore");
+ ALOGD("ALSAStreamOps::close() Ignore");
return ;
}
}
@@ -165,7 +164,7 @@
break;
default:
- LOGE("Unknown PCM format %i. Forcing default", *format);
+ ALOGE("Unknown PCM format %i. Forcing default", *format);
break;
}
@@ -194,7 +193,7 @@
int device;
if (param.getInt(key, device) == NO_ERROR) {
// Ignore routing if device is 0.
- LOGD("setParameters(): keyRouting with device %d", device);
+ ALOGD("setParameters(): keyRouting with device %d", device);
mDevices = device;
if(device) {
mParent->doRouting(device);
@@ -205,7 +204,7 @@
else {
key = String8(AudioParameter::keyHandleFm);
if (param.getInt(key, device) == NO_ERROR) {
- LOGD("setParameters(): handleFm with device %d", device);
+ ALOGD("setParameters(): handleFm with device %d", device);
mDevices = device;
if(device) {
mParent->handleFm(device);
@@ -228,6 +227,7 @@
param.addInt(key, (int)mDevices);
}
else {
+#if 0
key = String8(AudioParameter::keyVoipCheck);
if (param.get(key, value) == NO_ERROR) {
if((!strncmp(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL, strlen(SND_USE_CASE_VERB_IP_VOICECALL))) ||
@@ -236,8 +236,9 @@
else
param.addInt(key, false);
}
+#endif
}
- LOGV("getParameters() %s", param.toString().string());
+ ALOGV("getParameters() %s", param.toString().string());
return param.toString();
}
@@ -251,7 +252,7 @@
//
size_t ALSAStreamOps::bufferSize() const
{
- LOGV("bufferSize() returns %d", mHandle->bufferSize);
+ ALOGV("bufferSize() returns %d", mHandle->bufferSize);
return mHandle->bufferSize;
}
@@ -285,7 +286,7 @@
break;
}
- LOGD("ALSAFormat:0x%x,audioSystemFormat:0x%x",ALSAFormat,audioSystemFormat);
+ ALOGD("ALSAFormat:0x%x,audioSystemFormat:0x%x",ALSAFormat,audioSystemFormat);
return audioSystemFormat;
}
@@ -331,7 +332,7 @@
void ALSAStreamOps::close()
{
- LOGD("close");
+ ALOGD("close");
if((!strncmp(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL, strlen(SND_USE_CASE_VERB_IP_VOICECALL))) ||
(!strncmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_VOIP, strlen(SND_USE_CASE_MOD_PLAY_VOIP)))) {
mParent->mVoipMicMute = false;
@@ -353,7 +354,7 @@
//
status_t ALSAStreamOps::open(int mode)
{
- LOGD("open");
+ ALOGD("open");
return mParent->mALSADevice->open(mHandle);
}
diff --git a/alsa_sound/Android.mk b/alsa_sound/Android.mk
index 7e971c6..cdc2694 100644
--- a/alsa_sound/Android.mk
+++ b/alsa_sound/Android.mk
@@ -23,6 +23,7 @@
LOCAL_STATIC_LIBRARIES := \
libmedia_helper \
libaudiohw_legacy \
+ libaudiopolicy_legacy \
LOCAL_SHARED_LIBRARIES := \
libcutils \
@@ -31,23 +32,18 @@
libhardware \
libc \
libpower \
- libalsa-intf \
- libcsd-client \
- libsurround_proc
+ libalsa-intf
LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/audio-alsa
LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/audcal
LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/audio-acdb-util
LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/libalsa-intf
-LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/audio-qmi/csd-client
LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/surround_sound/
LOCAL_C_INCLUDES += hardware/libhardware/include
LOCAL_C_INCLUDES += hardware/libhardware_legacy/include
LOCAL_C_INCLUDES += frameworks/base/include
LOCAL_C_INCLUDES += system/core/include
-LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
-LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
LOCAL_MODULE := audio.primary.msm8960
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
@@ -55,6 +51,7 @@
include $(BUILD_SHARED_LIBRARY)
+ifeq (1,1) # use default audio policy manager
# This is the ALSA audio policy manager
include $(CLEAR_VARS)
@@ -66,8 +63,8 @@
endif
LOCAL_SRC_FILES := \
- AudioPolicyManagerALSA.cpp \
- audio_policy_hal.cpp
+ audio_policy_hal.cpp \
+ AudioPolicyManagerALSA.cpp
LOCAL_MODULE := audio_policy.msm8960
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
@@ -75,6 +72,7 @@
LOCAL_STATIC_LIBRARIES := \
libmedia_helper \
+ libaudiohw_legacy \
libaudiopolicy_legacy
LOCAL_SHARED_LIBRARIES := \
@@ -85,7 +83,7 @@
LOCAL_C_INCLUDES += hardware/libhardware_legacy/audio
include $(BUILD_SHARED_LIBRARY)
-
+endif
# This is the ALSA module which behaves closely like the original
@@ -101,10 +99,7 @@
LOCAL_CFLAGS += -DALSA_DEFAULT_SAMPLE_RATE=$(ALSA_DEFAULT_SAMPLE_RATE)
endif
-LOCAL_C_INCLUDES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
-LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/libalsa-intf
-LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/audio-qmi/csd-client
LOCAL_SRC_FILES:= \
alsa_default.cpp \
@@ -113,11 +108,11 @@
LOCAL_SHARED_LIBRARIES := \
libcutils \
liblog \
- libalsa-intf \
- libcsd-client
+ libalsa-intf
LOCAL_MODULE:= alsa.msm8960
LOCAL_MODULE_TAGS := optional
include $(BUILD_SHARED_LIBRARY)
+
endif
diff --git a/alsa_sound/AudioHardwareALSA.cpp b/alsa_sound/AudioHardwareALSA.cpp
index 0179d1b..97ff206 100644
--- a/alsa_sound/AudioHardwareALSA.cpp
+++ b/alsa_sound/AudioHardwareALSA.cpp
@@ -25,9 +25,8 @@
#include <dlfcn.h>
#include <math.h>
-#define LOG_TAG "AudioHardwareALSA"
+#define LOG_TAG "audio.primary.msm8960"
//#define LOG_NDEBUG 0
-#define LOG_NDDEBUG 0
#include <utils/Log.h>
#include <utils/String8.h>
#include <sys/prctl.h>
@@ -42,7 +41,6 @@
#include "AudioUsbALSA.h"
extern "C" {
-#include "csd_client.h"
}
extern "C"
@@ -75,7 +73,7 @@
int err = hw_get_module(ALSA_HARDWARE_MODULE_ID,
(hw_module_t const**)&module);
int codec_rev = 2;
- LOGD("hw_get_module(ALSA_HARDWARE_MODULE_ID) returned err %d", err);
+ ALOGD("hw_get_module(ALSA_HARDWARE_MODULE_ID) returned err %d", err);
if (err == 0) {
hw_device_t* device;
err = module->methods->open(module, ALSA_HARDWARE_NAME, &device);
@@ -94,10 +92,10 @@
musbRecordingState = 0;
if((fp = fopen("/proc/asound/cards","r")) == NULL) {
- LOGE("Cannot open /proc/asound/cards file to get sound card info");
+ ALOGE("Cannot open /proc/asound/cards file to get sound card info");
} else {
while((fgets(soundCardInfo, sizeof(soundCardInfo), fp) != NULL)) {
- LOGV("SoundCardInfo %s", soundCardInfo);
+ ALOGV("SoundCardInfo %s", soundCardInfo);
if (strstr(soundCardInfo, "msm8960-tabla1x-snd-card")) {
codec_rev = 1;
break;
@@ -113,41 +111,41 @@
}
if (codec_rev == 1) {
- LOGV("Detected tabla 1.x sound card");
+ ALOGV("Detected tabla 1.x sound card");
snd_use_case_mgr_open(&mUcMgr, "snd_soc_msm");
} else if (codec_rev == 3) {
- LOGV("Detected sitar 1.x sound card");
+ ALOGV("Detected sitar 1.x sound card");
snd_use_case_mgr_open(&mUcMgr, "snd_soc_msm_Sitar");
} else {
property_get("ro.board.platform", platform, "");
property_get("ro.baseband", baseband, "");
if (!strcmp("msm8960", platform) && !strcmp("mdm", baseband)) {
- LOGV("Detected Fusion tabla 2.x");
+ ALOGV("Detected Fusion tabla 2.x");
mFusion3Platform = true;
snd_use_case_mgr_open(&mUcMgr, "snd_soc_msm_2x_Fusion3");
} else {
- LOGV("Detected tabla 2.x sound card");
+ ALOGV("Detected tabla 2.x sound card");
snd_use_case_mgr_open(&mUcMgr, "snd_soc_msm_2x");
}
}
if (mUcMgr < 0) {
- LOGE("Failed to open ucm instance: %d", errno);
+ ALOGE("Failed to open ucm instance: %d", errno);
} else {
- LOGI("ucm instance opened: %u", (unsigned)mUcMgr);
+ ALOGI("ucm instance opened: %u", (unsigned)mUcMgr);
}
} else {
- LOGE("ALSA Module could not be opened!!!");
+ ALOGE("ALSA Module could not be opened!!!");
}
} else {
- LOGE("ALSA Module not found!!!");
+ ALOGE("ALSA Module not found!!!");
}
}
AudioHardwareALSA::~AudioHardwareALSA()
{
if (mUcMgr != NULL) {
- LOGD("closing ucm instance: %u", (unsigned)mUcMgr);
+ ALOGD("closing ucm instance: %u", (unsigned)mUcMgr);
snd_use_case_mgr_close(mUcMgr);
}
if (mALSADevice) {
@@ -171,17 +169,17 @@
status_t AudioHardwareALSA::setVoiceVolume(float v)
{
- LOGD("setVoiceVolume(%f)\n", v);
+ ALOGD("setVoiceVolume(%f)\n", v);
if (v < 0.0) {
- LOGW("setVoiceVolume(%f) under 0.0, assuming 0.0\n", v);
+ ALOGW("setVoiceVolume(%f) under 0.0, assuming 0.0\n", v);
v = 0.0;
} else if (v > 1.0) {
- LOGW("setVoiceVolume(%f) over 1.0, assuming 1.0\n", v);
+ ALOGW("setVoiceVolume(%f) over 1.0, assuming 1.0\n", v);
v = 1.0;
}
int newMode = mode();
- LOGD("setVoiceVolume newMode %d",newMode);
+ ALOGD("setVoiceVolume newMode %d",newMode);
int vol = lrint(v * 100.0);
// Voice volume levels from android are mapped to driver volume levels as follows.
@@ -211,16 +209,16 @@
int vol;
if (value < 0.0) {
- LOGW("setFmVolume(%f) under 0.0, assuming 0.0\n", value);
+ ALOGW("setFmVolume(%f) under 0.0, assuming 0.0\n", value);
value = 0.0;
} else if (value > 1.0) {
- LOGW("setFmVolume(%f) over 1.0, assuming 1.0\n", value);
+ ALOGW("setFmVolume(%f) over 1.0, assuming 1.0\n", value);
value = 1.0;
}
vol = lrint((value * 0x2000) + 0.5);
- LOGD("setFmVolume(%f)\n", value);
- LOGD("Setting FM volume to %d (available range is 0 to 0x2000)\n", vol);
+ ALOGD("setFmVolume(%f)\n", value);
+ ALOGD("Setting FM volume to %d (available range is 0 to 0x2000)\n", vol);
mALSADevice->setFmVolume(vol);
@@ -259,7 +257,7 @@
int device;
int btRate;
int state;
- LOGD("setParameters() %s", keyValuePairs.string());
+ ALOGD("setParameters() %s", keyValuePairs.string());
key = String8(TTY_MODE_KEY);
if (param.get(key, value) == NO_ERROR) {
@@ -273,7 +271,7 @@
} else {
mDevSettingsFlag |= TTY_OFF;
}
- LOGI("Changed TTY Mode=%s", value.string());
+ ALOGI("Changed TTY Mode=%s", value.string());
mALSADevice->setFlags(mDevSettingsFlag);
if(mMode != AudioSystem::MODE_IN_CALL){
return NO_ERROR;
@@ -286,15 +284,15 @@
if (value == "quadmic") {
mDevSettingsFlag |= QMIC_FLAG;
mDevSettingsFlag &= (~DMIC_FLAG);
- LOGV("Fluence quadMic feature Enabled");
+ ALOGV("Fluence quadMic feature Enabled");
} else if (value == "dualmic") {
mDevSettingsFlag |= DMIC_FLAG;
mDevSettingsFlag &= (~QMIC_FLAG);
- LOGV("Fluence dualmic feature Enabled");
+ ALOGV("Fluence dualmic feature Enabled");
} else if (value == "none") {
mDevSettingsFlag &= (~DMIC_FLAG);
mDevSettingsFlag &= (~QMIC_FLAG);
- LOGV("Fluence feature Disabled");
+ ALOGV("Fluence feature Disabled");
}
mALSADevice->setFlags(mDevSettingsFlag);
doRouting(0);
@@ -304,11 +302,9 @@
key = String8(INCALLMUSIC_KEY);
if (param.get(key, value) == NO_ERROR) {
if (value == "true") {
- LOGV("Enabling Incall Music setting in the setparameter\n");
- csd_client_start_playback();
+ ALOGV("Enabling Incall Music setting in the setparameter\n");
} else {
- LOGV("Disabling Incall Music setting in the setparameter\n");
- csd_client_stop_playback();
+ ALOGV("Disabling Incall Music setting in the setparameter\n");
}
}
}
@@ -316,10 +312,10 @@
key = String8(ANC_KEY);
if (param.get(key, value) == NO_ERROR) {
if (value == "true") {
- LOGV("Enabling ANC setting in the setparameter\n");
+ ALOGV("Enabling ANC setting in the setparameter\n");
mDevSettingsFlag |= ANC_FLAG;
} else {
- LOGV("Disabling ANC setting in the setparameter\n");
+ ALOGV("Disabling ANC setting in the setparameter\n");
mDevSettingsFlag &= (~ANC_FLAG);
}
mALSADevice->setFlags(mDevSettingsFlag);
@@ -456,41 +452,41 @@
param.addInt(String8("isVGS"), true);
}
- LOGV("AudioHardwareALSA::getParameters() %s", param.toString().string());
+ ALOGV("AudioHardwareALSA::getParameters() %s", param.toString().string());
return param.toString();
}
void AudioHardwareALSA::closeUSBPlayback()
{
- LOGV("closeUSBPlayback, musbPlaybackState: %d", musbPlaybackState);
+ ALOGV("closeUSBPlayback, musbPlaybackState: %d", musbPlaybackState);
musbPlaybackState = 0;
mAudioUsbALSA->exitPlaybackThread(SIGNAL_EVENT_KILLTHREAD);
}
void AudioHardwareALSA::closeUSBRecording()
{
- LOGV("closeUSBRecording");
+ ALOGV("closeUSBRecording");
musbRecordingState = 0;
mAudioUsbALSA->exitRecordingThread(SIGNAL_EVENT_KILLTHREAD);
}
void AudioHardwareALSA::closeUsbPlaybackIfNothingActive(){
- LOGV("closeUsbPlaybackIfNothingActive, musbPlaybackState: %d", musbPlaybackState);
+ ALOGV("closeUsbPlaybackIfNothingActive, musbPlaybackState: %d", musbPlaybackState);
if(!musbPlaybackState && mAudioUsbALSA != NULL) {
mAudioUsbALSA->exitPlaybackThread(SIGNAL_EVENT_TIMEOUT);
}
}
void AudioHardwareALSA::closeUsbRecordingIfNothingActive(){
- LOGV("closeUsbRecordingIfNothingActive, musbRecordingState: %d", musbRecordingState);
+ ALOGV("closeUsbRecordingIfNothingActive, musbRecordingState: %d", musbRecordingState);
if(!musbRecordingState && mAudioUsbALSA != NULL) {
- LOGD("Closing USB Recording Session as no stream is active");
+ ALOGD("Closing USB Recording Session as no stream is active");
mAudioUsbALSA->setkillUsbRecordingThread(true);
}
}
void AudioHardwareALSA::startUsbPlaybackIfNotStarted(){
- LOGV("Starting the USB playback %d kill %d", musbPlaybackState,
+ ALOGV("Starting the USB playback %d kill %d", musbPlaybackState,
mAudioUsbALSA->getkillUsbPlaybackThread());
if((!musbPlaybackState) || (mAudioUsbALSA->getkillUsbPlaybackThread() == true)) {
mAudioUsbALSA->startPlayback();
@@ -498,7 +494,7 @@
}
void AudioHardwareALSA::startUsbRecordingIfNotStarted(){
- LOGV("Starting the recording musbRecordingState: %d killUsbRecordingThread %d",
+ ALOGV("Starting the recording musbRecordingState: %d killUsbRecordingThread %d",
musbRecordingState, mAudioUsbALSA->getkillUsbRecordingThread());
if((!musbRecordingState) || (mAudioUsbALSA->getkillUsbRecordingThread() == true)) {
mAudioUsbALSA->startRecording();
@@ -520,12 +516,12 @@
(device == AudioSystem::DEVICE_OUT_DIRECTOUTPUT) ||
(device == AudioSystem::DEVICE_IN_FM_RX_A2DP)) {
#endif
- LOGV("Ignoring routing for FM/INCALL/VOIP recording");
+ ALOGV("Ignoring routing for FM/INCALL/VOIP recording");
return;
}
if (device == 0)
device = mCurDevice;
- LOGV("doRouting: device %d newMode %d mCSCallActive %d mVolteCallActive %d"
+ ALOGV("doRouting: device %d newMode %d mCSCallActive %d mVolteCallActive %d"
"mIsFmActive %d", device, newMode, mCSCallActive, mVolteCallActive,
mIsFmActive);
@@ -544,14 +540,14 @@
ALSAHandleList::iterator it = mDeviceList.end();
it--;
mALSADevice->route(&(*it), (uint32_t)device, newMode);
- LOGE("USB UNPLUGGED, setting musbPlaybackState to 0");
+ ALOGE("USB UNPLUGGED, setting musbPlaybackState to 0");
musbPlaybackState = 0;
musbRecordingState = 0;
closeUSBRecording();
closeUSBPlayback();
} else if((device & AudioSystem::DEVICE_OUT_ANLG_DOCK_HEADSET)||
(device & AudioSystem::DEVICE_OUT_DGTL_DOCK_HEADSET)){
- LOGE("Routing everything to prox now");
+ ALOGE("Routing everything to prox now");
ALSAHandleList::iterator it = mDeviceList.end();
it--;
mALSADevice->route(&(*it), AudioSystem::DEVICE_OUT_PROXY,
@@ -559,13 +555,13 @@
for(it = mDeviceList.begin(); it != mDeviceList.end(); ++it) {
if((!strcmp(it->useCase, SND_USE_CASE_VERB_HIFI_LOW_POWER)) ||
(!strcmp(it->useCase, SND_USE_CASE_MOD_PLAY_LPA))) {
- LOGD("doRouting: LPA device switch to proxy");
+ ALOGD("doRouting: LPA device switch to proxy");
startUsbPlaybackIfNotStarted();
musbPlaybackState |= USBPLAYBACKBIT_LPA;
break;
} else if((!strcmp(it->useCase, SND_USE_CASE_VERB_VOICECALL)) ||
(!strcmp(it->useCase, SND_USE_CASE_MOD_PLAY_VOICE))) {
- LOGD("doRouting: VOICE device switch to proxy");
+ ALOGD("doRouting: VOICE device switch to proxy");
startUsbRecordingIfNotStarted();
startUsbPlaybackIfNotStarted();
musbPlaybackState |= USBPLAYBACKBIT_VOICECALL;
@@ -573,7 +569,7 @@
break;
}else if((!strcmp(it->useCase, SND_USE_CASE_VERB_DIGITAL_RADIO)) ||
(!strcmp(it->useCase, SND_USE_CASE_MOD_PLAY_FM))) {
- LOGD("doRouting: FM device switch to proxy");
+ ALOGD("doRouting: FM device switch to proxy");
startUsbPlaybackIfNotStarted();
musbPlaybackState |= USBPLAYBACKBIT_FM;
break;
@@ -647,7 +643,7 @@
status_t *status)
{
Mutex::Autolock autoLock(mLock);
- LOGD("openOutputStream: devices 0x%x channels %d sampleRate %d",
+ ALOGD("openOutputStream: devices 0x%x channels %d sampleRate %d",
devices, *channels, *sampleRate);
status_t err = BAD_VALUE;
@@ -656,7 +652,7 @@
if (devices & (devices - 1)) {
if (status) *status = err;
- LOGE("openOutputStream called with bad devices");
+ ALOGE("openOutputStream called with bad devices");
return out;
}
# if 0
@@ -667,7 +663,7 @@
it != mDeviceList.end(); ++it) {
if((!strcmp(it->useCase, SND_USE_CASE_VERB_IP_VOICECALL)) ||
(!strcmp(it->useCase, SND_USE_CASE_MOD_PLAY_VOIP))) {
- LOGD("openOutput: it->rxHandle %d it->handle %d",it->rxHandle,it->handle);
+ ALOGD("openOutput: it->rxHandle %d it->handle %d",it->rxHandle,it->handle);
voipstream_active = true;
break;
}
@@ -684,7 +680,7 @@
bufferSize = VOIP_BUFFER_SIZE_16K;
}
else {
- LOGE("unsupported samplerate %d for voip",*sampleRate);
+ ALOGE("unsupported samplerate %d for voip",*sampleRate);
if (status) *status = err;
return out;
}
@@ -713,18 +709,18 @@
mDeviceList.push_back(alsa_handle);
it = mDeviceList.end();
it--;
- LOGV("openoutput: mALSADevice->route useCase %s mCurDevice %d mVoipStreamCount %d mode %d", it->useCase,mCurDevice,mVoipStreamCount, mode());
+ ALOGV("openoutput: mALSADevice->route useCase %s mCurDevice %d mVoipStreamCount %d mode %d", it->useCase,mCurDevice,mVoipStreamCount, mode());
if((mCurDevice & AudioSystem::DEVICE_OUT_ANLG_DOCK_HEADSET)||
(mCurDevice & AudioSystem::DEVICE_OUT_DGTL_DOCK_HEADSET)||
(mCurDevice & AudioSystem::DEVICE_OUT_PROXY)){
- LOGD("Routing to proxy for normal voip call in openOutputStream");
+ ALOGD("Routing to proxy for normal voip call in openOutputStream");
mCurDevice |= AudioSystem::DEVICE_OUT_PROXY;
alsa_handle.devices = AudioSystem::DEVICE_OUT_PROXY;
mALSADevice->route(&(*it), mCurDevice, AudioSystem::MODE_IN_COMMUNICATION);
- LOGD("enabling VOIP in openoutputstream, musbPlaybackState: %d", musbPlaybackState);
+ ALOGD("enabling VOIP in openoutputstream, musbPlaybackState: %d", musbPlaybackState);
startUsbPlaybackIfNotStarted();
musbPlaybackState |= USBPLAYBACKBIT_VOIPCALL;
- LOGD("Starting recording in openoutputstream, musbRecordingState: %d", musbRecordingState);
+ ALOGD("Starting recording in openoutputstream, musbRecordingState: %d", musbRecordingState);
startUsbRecordingIfNotStarted();
musbRecordingState |= USBRECBIT_VOIPCALL;
} else{
@@ -737,7 +733,7 @@
}
err = mALSADevice->startVoipCall(&(*it));
if (err) {
- LOGE("Device open failed");
+ ALOGE("Device open failed");
return NULL;
}
}
@@ -745,7 +741,7 @@
err = out->set(format, channels, sampleRate, devices);
if(err == NO_ERROR) {
mVoipStreamCount++; //increment VoipstreamCount only if success
- LOGD("openoutput mVoipStreamCount %d",mVoipStreamCount);
+ ALOGD("openoutput mVoipStreamCount %d",mVoipStreamCount);
}
if (status) *status = err;
return out;
@@ -781,11 +777,11 @@
mDeviceList.push_back(alsa_handle);
ALSAHandleList::iterator it = mDeviceList.end();
it--;
- LOGD("useCase %s", it->useCase);
+ ALOGD("useCase %s", it->useCase);
#if 0
if((devices & AudioSystem::DEVICE_OUT_ANLG_DOCK_HEADSET)||
(devices & AudioSystem::DEVICE_OUT_DGTL_DOCK_HEADSET)){
- LOGE("Routing to proxy for normal playback in openOutputStream");
+ ALOGE("Routing to proxy for normal playback in openOutputStream");
devices |= AudioSystem::DEVICE_OUT_PROXY;
}
#endif
@@ -797,7 +793,7 @@
}
err = mALSADevice->open(&(*it));
if (err) {
- LOGE("Device open failed");
+ ALOGE("Device open failed");
} else {
out = new AudioStreamOutALSA(this, &(*it));
err = out->set(format, channels, sampleRate, devices);
@@ -823,7 +819,7 @@
uint32_t channels)
{
Mutex::Autolock autoLock(mLock);
- LOGD("openOutputSession = %d" ,sessionId);
+ ALOGD("openOutputSession = %d" ,sessionId);
AudioStreamOutALSA *out = 0;
status_t err = BAD_VALUE;
@@ -864,15 +860,15 @@
mDeviceList.push_back(alsa_handle);
ALSAHandleList::iterator it = mDeviceList.end();
it--;
- LOGD("useCase %s", it->useCase);
+ ALOGD("useCase %s", it->useCase);
# if 0
if((devices & AudioSystem::DEVICE_OUT_ANLG_DOCK_HEADSET)||
(devices & AudioSystem::DEVICE_OUT_DGTL_DOCK_HEADSET)){
- LOGE("Routing to proxy for LPA in openOutputSession");
+ ALOGE("Routing to proxy for LPA in openOutputSession");
devices |= AudioSystem::DEVICE_OUT_PROXY;
mALSADevice->route(&(*it), devices, mode());
devices = AudioSystem::DEVICE_OUT_ANLG_DOCK_HEADSET;
- LOGD("Starting USBPlayback for LPA");
+ ALOGD("Starting USBPlayback for LPA");
startUsbPlaybackIfNotStarted();
musbPlaybackState |= USBPLAYBACKBIT_LPA;
} else
@@ -924,7 +920,7 @@
AudioStreamInALSA *in = 0;
ALSAHandleList::iterator it;
- LOGD("openInputStream: devices 0x%x channels %d sampleRate %d", devices, *channels, *sampleRate);
+ ALOGD("openInputStream: devices 0x%x channels %d sampleRate %d", devices, *channels, *sampleRate);
if (devices & (devices - 1)) {
if (status) *status = err;
return in;
@@ -937,7 +933,7 @@
it != mDeviceList.end(); ++it) {
if((!strcmp(it->useCase, SND_USE_CASE_VERB_IP_VOICECALL)) ||
(!strcmp(it->useCase, SND_USE_CASE_MOD_PLAY_VOIP))) {
- LOGD("openInput: it->rxHandle %d it->handle %d",it->rxHandle,it->handle);
+ ALOGD("openInput: it->rxHandle %d it->handle %d",it->rxHandle,it->handle);
voipstream_active = true;
break;
}
@@ -954,7 +950,7 @@
bufferSize = VOIP_BUFFER_SIZE_16K;
}
else {
- LOGE("unsupported samplerate %d for voip",*sampleRate);
+ ALOGE("unsupported samplerate %d for voip",*sampleRate);
if (status) *status = err;
return in;
}
@@ -982,16 +978,16 @@
mDeviceList.push_back(alsa_handle);
it = mDeviceList.end();
it--;
- LOGE("mCurrDevice: %d", mCurDevice);
+ ALOGE("mCurrDevice: %d", mCurDevice);
#if 0
if((mCurDevice == AudioSystem::DEVICE_OUT_ANLG_DOCK_HEADSET)||
(mCurDevice == AudioSystem::DEVICE_OUT_DGTL_DOCK_HEADSET)){
- LOGE("Routing everything from proxy for voipcall");
+ ALOGE("Routing everything from proxy for voipcall");
mALSADevice->route(&(*it), AudioSystem::DEVICE_IN_PROXY, AudioSystem::MODE_IN_COMMUNICATION);
- LOGD("enabling VOIP in openInputstream, musbPlaybackState: %d", musbPlaybackState);
+ ALOGD("enabling VOIP in openInputstream, musbPlaybackState: %d", musbPlaybackState);
startUsbPlaybackIfNotStarted();
musbPlaybackState |= USBPLAYBACKBIT_VOIPCALL;
- LOGD("Starting recording in openoutputstream, musbRecordingState: %d", musbRecordingState);
+ ALOGD("Starting recording in openoutputstream, musbRecordingState: %d", musbRecordingState);
startUsbRecordingIfNotStarted();
musbRecordingState |= USBRECBIT_VOIPCALL;
}else
@@ -1011,7 +1007,7 @@
it->channels = AudioSystem::popCount(*channels);
err = mALSADevice->startVoipCall(&(*it));
if (err) {
- LOGE("Error opening pcm input device");
+ ALOGE("Error opening pcm input device");
return NULL;
}
}
@@ -1019,9 +1015,9 @@
err = in->set(format, channels, sampleRate, devices);
if(err == NO_ERROR) {
mVoipStreamCount++; //increment VoipstreamCount only if success
- LOGD("OpenInput mVoipStreamCount %d",mVoipStreamCount);
+ ALOGD("OpenInput mVoipStreamCount %d",mVoipStreamCount);
}
- LOGE("openInput: After Get alsahandle");
+ ALOGE("openInput: After Get alsahandle");
if (status) *status = err;
return in;
} else
@@ -1039,7 +1035,7 @@
{
#if 0
if(!(devices == AudioSystem::DEVICE_IN_FM_RX_A2DP)){
- LOGD("Input stream already exists, new stream not permitted: useCase:%s, devices:0x%x, module:%p",
+ ALOGD("Input stream already exists, new stream not permitted: useCase:%s, devices:0x%x, module:%p",
itDev->useCase, itDev->devices, itDev->module);
return in;
}
@@ -1050,7 +1046,7 @@
||(0 == strncmp(itDev->useCase, SND_USE_CASE_MOD_CAPTURE_A2DP_FM, MAX_UC_LEN)))
{
if((devices == AudioSystem::DEVICE_IN_FM_RX_A2DP)){
- LOGD("Input stream already exists, new stream not permitted: useCase:%s, devices:0x%x, module:%p",
+ ALOGD("Input stream already exists, new stream not permitted: useCase:%s, devices:0x%x, module:%p",
itDev->useCase, itDev->devices, itDev->module);
return in;
}
@@ -1075,7 +1071,7 @@
if ((use_case != NULL) && (strcmp(use_case, SND_USE_CASE_VERB_INACTIVE))) {
if ((devices == AudioSystem::DEVICE_IN_VOICE_CALL) &&
(newMode == AudioSystem::MODE_IN_CALL)) {
- LOGD("openInputStream: into incall recording, channels %d", *channels);
+ ALOGD("openInputStream: into incall recording, channels %d", *channels);
mIncallMode = *channels;
if ((*channels & AudioSystem::CHANNEL_IN_VOICE_UPLINK) &&
(*channels & AudioSystem::CHANNEL_IN_VOICE_DNLINK)) {
@@ -1083,7 +1079,6 @@
mALSADevice->setVocRecMode(INCALL_REC_STEREO);
strlcpy(alsa_handle.useCase, SND_USE_CASE_MOD_CAPTURE_VOICE,
sizeof(alsa_handle.useCase));
- csd_client_start_record(INCALL_REC_STEREO);
} else {
strlcpy(alsa_handle.useCase, SND_USE_CASE_MOD_CAPTURE_VOICE_UL_DL,
sizeof(alsa_handle.useCase));
@@ -1093,7 +1088,6 @@
mALSADevice->setVocRecMode(INCALL_REC_MONO);
strlcpy(alsa_handle.useCase, SND_USE_CASE_MOD_CAPTURE_VOICE,
sizeof(alsa_handle.useCase));
- csd_client_start_record(INCALL_REC_MONO);
} else {
strlcpy(alsa_handle.useCase, SND_USE_CASE_MOD_CAPTURE_VOICE_DL,
sizeof(alsa_handle.useCase));
@@ -1111,7 +1105,7 @@
} else {
if ((devices == AudioSystem::DEVICE_IN_VOICE_CALL) &&
(newMode == AudioSystem::MODE_IN_CALL)) {
- LOGD("openInputStream: incall recording, channels %d", *channels);
+ ALOGD("openInputStream: incall recording, channels %d", *channels);
mIncallMode = *channels;
if ((*channels & AudioSystem::CHANNEL_IN_VOICE_UPLINK) &&
(*channels & AudioSystem::CHANNEL_IN_VOICE_DNLINK)) {
@@ -1119,7 +1113,6 @@
mALSADevice->setVocRecMode(INCALL_REC_STEREO);
strlcpy(alsa_handle.useCase, SND_USE_CASE_VERB_INCALL_REC,
sizeof(alsa_handle.useCase));
- csd_client_start_record(INCALL_REC_STEREO);
} else {
strlcpy(alsa_handle.useCase, SND_USE_CASE_VERB_UL_DL_REC,
sizeof(alsa_handle.useCase));
@@ -1129,7 +1122,6 @@
mALSADevice->setVocRecMode(INCALL_REC_MONO);
strlcpy(alsa_handle.useCase, SND_USE_CASE_VERB_INCALL_REC,
sizeof(alsa_handle.useCase));
- csd_client_start_record(INCALL_REC_MONO);
} else {
strlcpy(alsa_handle.useCase, SND_USE_CASE_VERB_DL_REC,
sizeof(alsa_handle.useCase));
@@ -1158,14 +1150,14 @@
| AudioSystem::CHANNEL_IN_5POINT1
#endif
));
- LOGV("updated channel info: channels=%d", it->channels);
+ ALOGV("updated channel info: channels=%d", it->channels);
}
if (devices == AudioSystem::DEVICE_IN_VOICE_CALL){
/* Add current devices info to devices to do route */
#if 0
if(mCurDevice == AudioSystem::DEVICE_OUT_ANLG_DOCK_HEADSET ||
mCurDevice == AudioSystem::DEVICE_OUT_DGTL_DOCK_HEADSET){
- LOGD("Routing everything from proxy for VOIP call");
+ ALOGD("Routing everything from proxy for VOIP call");
route_devices = devices | AudioSystem::DEVICE_IN_PROXY;
} else
#endif
@@ -1178,7 +1170,7 @@
if(devices & AudioSystem::DEVICE_IN_ANLG_DOCK_HEADSET ||
devices & AudioSystem::DEVICE_IN_PROXY) {
devices |= AudioSystem::DEVICE_IN_PROXY;
- LOGE("routing everything from proxy");
+ ALOGE("routing everything from proxy");
mALSADevice->route(&(*it), devices, mode());
} else
#endif
@@ -1206,14 +1198,14 @@
if (6 == it->channels) {
if (!strncmp(it->useCase, SND_USE_CASE_VERB_HIFI_REC, strlen(SND_USE_CASE_VERB_HIFI_REC))
|| !strncmp(it->useCase, SND_USE_CASE_MOD_CAPTURE_MUSIC, strlen(SND_USE_CASE_MOD_CAPTURE_MUSIC))) {
- LOGV("OpenInoutStream: Use larger buffer size for 5.1(%s) recording ", it->useCase);
+ ALOGV("OpenInoutStream: Use larger buffer size for 5.1(%s) recording ", it->useCase);
it->bufferSize = getInputBufferSize(it->sampleRate,*format,it->channels);
}
}
#endif
err = mALSADevice->open(&(*it));
if (err) {
- LOGE("Error opening pcm input device");
+ ALOGE("Error opening pcm input device");
} else {
in = new AudioStreamInALSA(this, &(*it), acoustics);
err = in->set(format, channels, sampleRate, devices);
@@ -1232,11 +1224,11 @@
status_t AudioHardwareALSA::setMicMute(bool state)
{
int newMode = mode();
- LOGD("setMicMute newMode %d",newMode);
+ ALOGD("setMicMute newMode %d",newMode);
if(newMode == AudioSystem::MODE_IN_COMMUNICATION) {
if (mVoipMicMute != state) {
mVoipMicMute = state;
- LOGD("setMicMute: mVoipMicMute %d", mVoipMicMute);
+ ALOGD("setMicMute: mVoipMicMute %d", mVoipMicMute);
if(mALSADevice) {
mALSADevice->setVoipMicMute(state);
}
@@ -1244,7 +1236,7 @@
} else {
if (mMicMute != state) {
mMicMute = state;
- LOGD("setMicMute: mMicMute %d", mMicMute);
+ ALOGD("setMicMute: mMicMute %d", mMicMute);
if(mALSADevice) {
if(mCSCallActive == AudioSystem::CS_ACTIVE)
mALSADevice->setMicMute(state);
@@ -1281,7 +1273,7 @@
&& format != AudioSystem::EVRC
&& format != AudioSystem::EVRCB
&& format != AudioSystem::EVRCWB) {
- LOGW("getInputBufferSize bad format: %d", format);
+ ALOGW("getInputBufferSize bad format: %d", format);
return 0;
}
if(sampleRate == 16000) {
@@ -1303,7 +1295,7 @@
unsigned long bufferSize = FM_BUFFER_SIZE;
alsa_handle_t alsa_handle;
char *use_case;
- LOGV("Start FM");
+ ALOGV("Start FM");
snd_use_case_get(mUcMgr, "_verb", (const char **)&use_case);
if ((use_case == NULL) || (!strcmp(use_case, SND_USE_CASE_VERB_INACTIVE))) {
strlcpy(alsa_handle.useCase, SND_USE_CASE_VERB_DIGITAL_RADIO, sizeof(alsa_handle.useCase));
@@ -1332,7 +1324,7 @@
(device & AudioSystem::DEVICE_OUT_DGTL_DOCK_HEADSET)){
device |= AudioSystem::DEVICE_OUT_PROXY;
alsa_handle.devices = AudioSystem::DEVICE_OUT_PROXY;
- LOGE("Routing to proxy for FM case");
+ ALOGE("Routing to proxy for FM case");
}
mALSADevice->route(&(*it), (uint32_t)device, newMode);
if(!strcmp(it->useCase, SND_USE_CASE_VERB_DIGITAL_RADIO)) {
@@ -1343,13 +1335,13 @@
mALSADevice->startFm(&(*it));
if((device & AudioSystem::DEVICE_OUT_ANLG_DOCK_HEADSET)||
(device & AudioSystem::DEVICE_OUT_DGTL_DOCK_HEADSET)){
- LOGE("Starting FM, musbPlaybackState %d", musbPlaybackState);
+ ALOGE("Starting FM, musbPlaybackState %d", musbPlaybackState);
startUsbPlaybackIfNotStarted();
musbPlaybackState |= USBPLAYBACKBIT_FM;
}
} else if (!(device & AudioSystem::DEVICE_OUT_FM) && mIsFmActive == 1) {
//i Stop FM Radio
- LOGV("Stop FM");
+ ALOGV("Stop FM");
for(ALSAHandleList::iterator it = mDeviceList.begin();
it != mDeviceList.end(); ++it) {
if((!strcmp(it->useCase, SND_USE_CASE_VERB_DIGITAL_RADIO)) ||
@@ -1376,7 +1368,7 @@
it != mDeviceList.end(); ++it) {
if((!strcmp(it->useCase, verb)) ||
(!strcmp(it->useCase, modifier))) {
- LOGV("Disabling voice call");
+ ALOGV("Disabling voice call");
mALSADevice->close(&(*it));
mALSADevice->route(&(*it), (uint32_t)device, mode);
mDeviceList.erase(it);
@@ -1384,7 +1376,7 @@
}
}
if(musbPlaybackState & USBPLAYBACKBIT_VOICECALL) {
- LOGE("Voice call ended on USB");
+ ALOGE("Voice call ended on USB");
musbPlaybackState &= ~USBPLAYBACKBIT_VOICECALL;
musbRecordingState &= ~USBRECBIT_VOICECALL;
closeUsbRecordingIfNothingActive();
@@ -1450,7 +1442,7 @@
switch (csCallState) {
case AudioSystem::CS_INACTIVE:
if (mCSCallActive != AudioSystem::CS_INACTIVE) {
- LOGD("doRouting: Disabling voice call");
+ ALOGD("doRouting: Disabling voice call");
disableVoiceCall((char *)SND_USE_CASE_VERB_VOICECALL,
(char *)SND_USE_CASE_MOD_PLAY_VOICE, newMode, device);
isRouted = true;
@@ -1459,13 +1451,13 @@
break;
case AudioSystem::CS_ACTIVE:
if (mCSCallActive == AudioSystem::CS_INACTIVE) {
- LOGD("doRouting: Enabling CS voice call ");
+ ALOGD("doRouting: Enabling CS voice call ");
enableVoiceCall((char *)SND_USE_CASE_VERB_VOICECALL,
(char *)SND_USE_CASE_MOD_PLAY_VOICE, newMode, device);
isRouted = true;
mCSCallActive = AudioSystem::CS_ACTIVE;
} else if (mCSCallActive == AudioSystem::CS_HOLD) {
- LOGD("doRouting: Resume voice call from hold state");
+ ALOGD("doRouting: Resume voice call from hold state");
ALSAHandleList::iterator vt_it;
for(vt_it = mDeviceList.begin();
vt_it != mDeviceList.end(); ++vt_it) {
@@ -1476,7 +1468,7 @@
alsa_handle_t *handle = (alsa_handle_t *)(&(*vt_it));
mCSCallActive = AudioSystem::CS_ACTIVE;
if(ioctl((int)handle->handle->fd,SNDRV_PCM_IOCTL_PAUSE,0)<0)
- LOGE("VoLTE resume failed");
+ ALOGE("VoLTE resume failed");
break;
}
}
@@ -1484,7 +1476,7 @@
break;
case AudioSystem::CS_HOLD:
if (mCSCallActive == AudioSystem::CS_ACTIVE) {
- LOGD("doRouting: Voice call going to Hold");
+ ALOGD("doRouting: Voice call going to Hold");
ALSAHandleList::iterator vt_it;
for(vt_it = mDeviceList.begin();
vt_it != mDeviceList.end(); ++vt_it) {
@@ -1495,7 +1487,7 @@
mCSCallActive = AudioSystem::CS_HOLD;
alsa_handle_t *handle = (alsa_handle_t *)(&(*vt_it));
if(ioctl((int)handle->handle->fd,SNDRV_PCM_IOCTL_PAUSE,1)<0)
- LOGE("Voice pause failed");
+ ALOGE("Voice pause failed");
break;
}
}
@@ -1511,7 +1503,7 @@
switch (volteCallState) {
case AudioSystem::IMS_INACTIVE:
if (mVolteCallActive != AudioSystem::IMS_INACTIVE) {
- LOGD("doRouting: Disabling IMS call");
+ ALOGD("doRouting: Disabling IMS call");
disableVoiceCall((char *)SND_USE_CASE_VERB_VOLTE,
(char *)SND_USE_CASE_MOD_PLAY_VOLTE, newMode, device);
isRouted = true;
@@ -1520,13 +1512,13 @@
break;
case AudioSystem::IMS_ACTIVE:
if (mVolteCallActive == AudioSystem::IMS_INACTIVE) {
- LOGD("doRouting: Enabling IMS voice call ");
+ ALOGD("doRouting: Enabling IMS voice call ");
enableVoiceCall((char *)SND_USE_CASE_VERB_VOLTE,
(char *)SND_USE_CASE_MOD_PLAY_VOLTE, newMode, device);
isRouted = true;
mVolteCallActive = AudioSystem::IMS_ACTIVE;
} else if (mVolteCallActive == AudioSystem::IMS_HOLD) {
- LOGD("doRouting: Resume IMS call from hold state");
+ ALOGD("doRouting: Resume IMS call from hold state");
ALSAHandleList::iterator vt_it;
for(vt_it = mDeviceList.begin();
vt_it != mDeviceList.end(); ++vt_it) {
@@ -1537,7 +1529,7 @@
alsa_handle_t *handle = (alsa_handle_t *)(&(*vt_it));
mVolteCallActive = AudioSystem::IMS_ACTIVE;
if(ioctl((int)handle->handle->fd,SNDRV_PCM_IOCTL_PAUSE,0)<0)
- LOGE("VoLTE resume failed");
+ ALOGE("VoLTE resume failed");
break;
}
}
@@ -1545,7 +1537,7 @@
break;
case AudioSystem::IMS_HOLD:
if (mVolteCallActive == AudioSystem::IMS_ACTIVE) {
- LOGD("doRouting: IMS ACTIVE going to HOLD");
+ ALOGD("doRouting: IMS ACTIVE going to HOLD");
ALSAHandleList::iterator vt_it;
for(vt_it = mDeviceList.begin();
vt_it != mDeviceList.end(); ++vt_it) {
@@ -1556,7 +1548,7 @@
mVolteCallActive = AudioSystem::IMS_HOLD;
alsa_handle_t *handle = (alsa_handle_t *)(&(*vt_it));
if(ioctl((int)handle->handle->fd,SNDRV_PCM_IOCTL_PAUSE,1)<0)
- LOGE("VoLTE Pause failed");
+ ALOGE("VoLTE Pause failed");
break;
}
}
diff --git a/alsa_sound/AudioPolicyManagerALSA.cpp b/alsa_sound/AudioPolicyManagerALSA.cpp
index 2a8e528..a6c2e73 100644
--- a/alsa_sound/AudioPolicyManagerALSA.cpp
+++ b/alsa_sound/AudioPolicyManagerALSA.cpp
@@ -15,22 +15,22 @@
* limitations under the License.
*/
-#define LOG_TAG "AudioPolicyManagerALSA"
+#define LOG_TAG "audio_policy.msm8960"
//#define LOG_NDEBUG 0
-#define LOG_NDDEBUG 0
#include <utils/Log.h>
+
#include "AudioPolicyManagerALSA.h"
#include <media/mediarecorder.h>
namespace android_audio_legacy {
// ----------------------------------------------------------------------------
-uint32_t AudioPolicyManager::getDeviceForStrategy(routing_strategy strategy, bool fromCache)
+audio_devices_t AudioPolicyManager::getDeviceForStrategy(routing_strategy strategy, bool fromCache)
{
uint32_t device = 0;
if (fromCache) {
- LOGV("getDeviceForStrategy() from cache strategy %d, device %x", strategy, mDeviceForStrategy[strategy]);
+ ALOGV("getDeviceForStrategy() from cache strategy %d, device %x", strategy, mDeviceForStrategy[strategy]);
return mDeviceForStrategy[strategy];
}
@@ -88,7 +88,7 @@
if (device) break;
device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_EARPIECE;
if (device == 0) {
- LOGE("getDeviceForStrategy() earpiece device not found");
+ ALOGE("getDeviceForStrategy() earpiece device not found");
}
break;
@@ -111,7 +111,7 @@
if (device) break;
device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
if (device == 0) {
- LOGE("getDeviceForStrategy() speaker device not found");
+ ALOGE("getDeviceForStrategy() speaker device not found");
}
break;
}
@@ -143,7 +143,7 @@
device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
if (device == 0) {
- LOGE("getDeviceForStrategy() speaker device not found");
+ ALOGE("getDeviceForStrategy() speaker device not found");
}
// The second device used for sonification is the same as the device used by media strategy
// FALL THROUGH
@@ -231,19 +231,19 @@
// output routing
if (mPhoneState == AudioSystem::MODE_IN_CALL &&
!AudioSystem::isA2dpDevice((AudioSystem::audio_devices)device) &&
- device != getDeviceForStrategy(STRATEGY_PHONE)) {
- device = getDeviceForStrategy(STRATEGY_PHONE);
- LOGV("getDeviceForStrategy() incompatible media and phone devices");
+ device != getDeviceForStrategy(STRATEGY_PHONE, true)) {
+ device = getDeviceForStrategy(STRATEGY_PHONE, true);
+ ALOGV("getDeviceForStrategy() incompatible media and phone devices");
}
} break;
default:
- LOGW("getDeviceForStrategy() unknown strategy: %d", strategy);
+ ALOGW("getDeviceForStrategy() unknown strategy: %d", strategy);
break;
}
- LOGV("getDeviceForStrategy() strategy %d, device %x", strategy, device);
- return device;
+ ALOGV("getDeviceForStrategy() strategy %d, device %x", strategy, device);
+ return (audio_devices_t)device;
}
@@ -252,13 +252,13 @@
const char *device_address)
{
- LOGV("setDeviceConnectionState() device: %x, state %d, address %s", device, state, device_address);
+ ALOGV("setDeviceConnectionState() device: %x, state %d, address %s", device, state, device_address);
// connect/disconnect only 1 device at a time
if (AudioSystem::popCount(device) != 1) return BAD_VALUE;
if (strlen(device_address) >= MAX_DEVICE_ADDRESS_LEN) {
- LOGE("setDeviceConnectionState() invalid address: %s", device_address);
+ ALOGE("setDeviceConnectionState() invalid address: %s", device_address);
return BAD_VALUE;
}
@@ -267,7 +267,7 @@
#ifndef WITH_A2DP
if (AudioSystem::isA2dpDevice(device)) {
- LOGE("setDeviceConnectionState() invalid device: %x", device);
+ ALOGE("setDeviceConnectionState() invalid device: %x", device);
return BAD_VALUE;
}
#endif
@@ -277,13 +277,13 @@
// handle output device connection
case AudioSystem::DEVICE_STATE_AVAILABLE:
if (mAvailableOutputDevices & device) {
- LOGW("setDeviceConnectionState() device already connected: %x", device);
+ ALOGW("setDeviceConnectionState() device already connected: %x", device);
return INVALID_OPERATION;
}
- LOGV("setDeviceConnectionState() connecting device %x", device);
+ ALOGV("setDeviceConnectionState() connecting device %x", device);
// register new device as available
- mAvailableOutputDevices |= device;
+ mAvailableOutputDevices = (audio_devices_t)((uint32_t)mAvailableOutputDevices | device);
#ifdef WITH_A2DP
// handle A2DP device connection
@@ -297,7 +297,7 @@
#endif
{
if (AudioSystem::isBluetoothScoDevice(device)) {
- LOGV("setDeviceConnectionState() BT SCO device, address %s", device_address);
+ ALOGV("setDeviceConnectionState() BT SCO device, address %s", device_address);
// keep track of SCO device address
mScoDeviceAddress = String8(device_address, MAX_DEVICE_ADDRESS_LEN);
}
@@ -306,21 +306,21 @@
// handle output device disconnection
case AudioSystem::DEVICE_STATE_UNAVAILABLE: {
if (!(mAvailableOutputDevices & device)) {
- LOGW("setDeviceConnectionState() device not connected: %x", device);
+ ALOGW("setDeviceConnectionState() device not connected: %x", device);
return INVALID_OPERATION;
}
- LOGV("setDeviceConnectionState() disconnecting device %x", device);
+ ALOGV("setDeviceConnectionState() disconnecting device %x", device);
// remove device from available output devices
- mAvailableOutputDevices &= ~device;
+ mAvailableOutputDevices = (audio_devices_t)((uint32_t)mAvailableOutputDevices & ~device);
#ifdef WITH_A2DP
// handle A2DP device disconnection
if (AudioSystem::isA2dpDevice(device)) {
status_t status = AudioPolicyManagerBase::handleA2dpDisconnection(device, device_address);
if (status != NO_ERROR) {
- mAvailableOutputDevices |= device;
+ mAvailableOutputDevices = (audio_devices_t)((uint32_t)mAvailableOutputDevices | device);
return status;
}
} else
@@ -333,12 +333,12 @@
} break;
default:
- LOGE("setDeviceConnectionState() invalid state: %x", state);
+ ALOGE("setDeviceConnectionState() invalid state: %x", state);
return BAD_VALUE;
}
// request routing change if necessary
- uint32_t newDevice = AudioPolicyManagerBase::getNewDevice(mHardwareOutput, false);
+ uint32_t newDevice = AudioPolicyManagerBase::getNewDevice(mPrimaryOutput, false);
if(newDevice == 0 && mLPADecodeOutput != -1) {
newDevice = AudioPolicyManagerBase::getNewDevice(mLPADecodeOutput, false);
@@ -346,17 +346,17 @@
#ifdef FM_ENABLED
if(device == AudioSystem::DEVICE_OUT_FM) {
if (state == AudioSystem::DEVICE_STATE_AVAILABLE) {
- mOutputs.valueFor(mHardwareOutput)->changeRefCount(AudioSystem::FM, 1);
+ mOutputs.valueFor(mPrimaryOutput)->changeRefCount(AudioSystem::FM, 1);
}
else {
- mOutputs.valueFor(mHardwareOutput)->changeRefCount(AudioSystem::FM, -1);
+ mOutputs.valueFor(mPrimaryOutput)->changeRefCount(AudioSystem::FM, -1);
}
if(newDevice == 0){
newDevice = getDeviceForStrategy(STRATEGY_MEDIA, false);
}
AudioParameter param = AudioParameter();
param.addInt(String8(AudioParameter::keyHandleFm), (int)newDevice);
- mpClientInterface->setParameters(mHardwareOutput, param.toString());
+ mpClientInterface->setParameters(mPrimaryOutput, param.toString());
}
#endif
if(device == AudioSystem::DEVICE_OUT_ANC_HEADPHONE ||
@@ -380,12 +380,12 @@
&& AudioSystem::DEVICE_OUT_WIRED_HEADSET == device) {
//Add some delay(192ms) while switching from wired headset to speaker before pause
//music keeps playing from speaker if there's not delay or delay is too small.
- delayMs = mOutputs.valueFor(mHardwareOutput)->mLatency*8;
+ delayMs = mOutputs.valueFor(mPrimaryOutput)->mLatency*8;
}
if(mLPADecodeOutput != -1)
setOutputDevice(mLPADecodeOutput, newDevice, false, delayMs);
- setOutputDevice(mHardwareOutput, newDevice, false, delayMs);
+ setOutputDevice(mPrimaryOutput, newDevice, false, delayMs);
if (device == AudioSystem::DEVICE_OUT_WIRED_HEADSET) {
device = AudioSystem::DEVICE_IN_WIRED_HEADSET;
@@ -409,24 +409,24 @@
// handle input device connection
case AudioSystem::DEVICE_STATE_AVAILABLE: {
if (mAvailableInputDevices & device) {
- LOGW("setDeviceConnectionState() device already connected: %d", device);
+ ALOGW("setDeviceConnectionState() device already connected: %d", device);
return INVALID_OPERATION;
}
- mAvailableInputDevices |= device;
+ mAvailableInputDevices = (audio_devices_t)(mAvailableInputDevices | device);
}
break;
// handle input device disconnection
case AudioSystem::DEVICE_STATE_UNAVAILABLE: {
if (!(mAvailableInputDevices & device)) {
- LOGW("setDeviceConnectionState() device not connected: %d", device);
+ ALOGW("setDeviceConnectionState() device not connected: %d", device);
return INVALID_OPERATION;
}
- mAvailableInputDevices &= ~device;
+ mAvailableInputDevices = (audio_devices_t)((uint32_t)mAvailableInputDevices & ~device);
} break;
default:
- LOGE("setDeviceConnectionState() invalid state: %x", state);
+ ALOGE("setDeviceConnectionState() invalid state: %x", state);
return BAD_VALUE;
}
@@ -435,9 +435,9 @@
AudioInputDescriptor *inputDesc = mInputs.valueFor(activeInput);
uint32_t newDevice = AudioPolicyManagerBase::getDeviceForInputSource(inputDesc->mInputSource);
if (newDevice != inputDesc->mDevice) {
- LOGV("setDeviceConnectionState() changing device from %x to %x for input %d",
+ ALOGV("setDeviceConnectionState() changing device from %x to %x for input %d",
inputDesc->mDevice, newDevice, activeInput);
- inputDesc->mDevice = newDevice;
+ inputDesc->mDevice = (audio_devices_t)newDevice;
AudioParameter param = AudioParameter();
param.addInt(String8(AudioParameter::keyRouting), (int)newDevice);
mpClientInterface->setParameters(activeInput, param.toString());
@@ -447,29 +447,29 @@
return NO_ERROR;
}
- LOGW("setDeviceConnectionState() invalid device: %x", device);
+ ALOGW("setDeviceConnectionState() invalid device: %x", device);
return BAD_VALUE;
}
void AudioPolicyManager::setPhoneState(int state)
{
- LOGD("setPhoneState() state %d", state);
+ ALOGD("setPhoneState() state %d", state);
uint32_t newDevice = 0;
if (state < 0 || state >= AudioSystem::NUM_MODES) {
- LOGW("setPhoneState() invalid state %d", state);
+ ALOGW("setPhoneState() invalid state %d", state);
return;
}
if (state == mPhoneState ) {
- LOGW("setPhoneState() setting same state %d", state);
+ ALOGW("setPhoneState() setting same state %d", state);
return;
}
// if leaving call state, handle special case of active streams
// pertaining to sonification strategy see handleIncallSonification()
if (isInCall()) {
- LOGV("setPhoneState() in call state management: new state is %d", state);
+ ALOGV("setPhoneState() in call state management: new state is %d", state);
for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) {
AudioPolicyManagerBase::handleIncallSonification(stream, false, true);
}
@@ -484,24 +484,24 @@
// are we entering or starting a call
if (!isStateInCall(oldState) && isStateInCall(state)) {
- LOGV(" Entering call in setPhoneState()");
+ ALOGV(" Entering call in setPhoneState()");
// force routing command to audio hardware when starting a call
// even if no device change is needed
force = true;
} else if (isStateInCall(oldState) && (state == AudioSystem::MODE_NORMAL)) {
- LOGV(" Exiting call in setPhoneState()");
+ ALOGV(" Exiting call in setPhoneState()");
// force routing command to audio hardware when exiting a call
// even if no device change is needed
force = true;
} else if (isStateInCall(state) && (state != oldState)) {
- LOGV(" Switching between telephony and VoIP in setPhoneState()");
+ ALOGV(" Switching between telephony and VoIP in setPhoneState()");
// force routing command to audio hardware when switching between telephony and VoIP
// even if no device change is needed
force = true;
}
// check for device and output changes triggered by new phone state
- newDevice = AudioPolicyManagerBase::getNewDevice(mHardwareOutput, false);
+ newDevice = AudioPolicyManagerBase::getNewDevice(mPrimaryOutput, false);
if (newDevice == 0 && (mLPADecodeOutput != -1 &&
mOutputs.valueFor(mLPADecodeOutput)->isUsedByStrategy(STRATEGY_MEDIA))) {
newDevice = getDeviceForStrategy(STRATEGY_MEDIA, false);
@@ -513,7 +513,7 @@
#endif
AudioPolicyManagerBase::updateDeviceForStrategy();
- AudioOutputDescriptor *hwOutputDesc = mOutputs.valueFor(mHardwareOutput);
+ AudioOutputDescriptor *hwOutputDesc = mOutputs.valueFor(mPrimaryOutput);
// force routing command to audio hardware when ending call
// even if no device change is needed
@@ -533,20 +533,20 @@
// and be sure that audio buffers not yet affected by the mute are out when
// we actually apply the route change
delayMs = hwOutputDesc->mLatency*2;
- setStreamMute(AudioSystem::RING, true, mHardwareOutput);
+ setStreamMute(AudioSystem::RING, true, mPrimaryOutput);
}
// change routing is necessary
- setOutputDevice(mHardwareOutput, newDevice, force, delayMs);
+ setOutputDevice(mPrimaryOutput, newDevice, force, delayMs);
// if entering in call state, handle special case of active streams
// pertaining to sonification strategy see handleIncallSonification()
if (isStateInCall(state)) {
- LOGV("setPhoneState() in call state management: new state is %d", state);
+ ALOGV("setPhoneState() in call state management: new state is %d", state);
// unmute the ringing tone after a sufficient delay if it was muted before
// setting output device above
if (oldState == AudioSystem::MODE_RINGTONE) {
- setStreamMute(AudioSystem::RING, false, mHardwareOutput, MUTE_TIME_MS);
+ setStreamMute(AudioSystem::RING, false, mPrimaryOutput, MUTE_TIME_MS);
}
for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) {
AudioPolicyManagerBase::handleIncallSonification(stream, true, true);
@@ -576,7 +576,7 @@
uint32_t latency = 0;
routing_strategy strategy = getStrategy((AudioSystem::stream_type)stream);
uint32_t device = getDeviceForStrategy(strategy);
- LOGV("getSession() stream %d, format %d, sessionId %x, flags %x device %d", stream, format, sessionId, flags, device);
+ ALOGV("getSession() stream %d, format %d, sessionId %x, flags %x device %d", stream, format, sessionId, flags, device);
AudioOutputDescriptor *outputDesc = new AudioOutputDescriptor();
outputDesc->mDevice = device;
outputDesc->mSamplingRate = 0;
@@ -595,7 +595,7 @@
// only accept an output with the requeted parameters
if ((format != 0 && format != outputDesc->mFormat) || !output) {
- LOGE("openSession() failed opening a session: format %d, sessionId %d output %d",
+ ALOGE("openSession() failed opening a session: format %d, sessionId %d output %d",
format, sessionId, output);
if(output) {
mpClientInterface->closeSession(output);
@@ -615,7 +615,7 @@
void AudioPolicyManager::pauseSession(audio_io_handle_t output, AudioSystem::stream_type stream)
{
- LOGV("pauseSession() Output [%d] and stream is [%d]", output, stream);
+ ALOGV("pauseSession() Output [%d] and stream is [%d]", output, stream);
if ( (output == mLPADecodeOutput) &&
(stream == mLPAStreamType) ) {
@@ -630,7 +630,7 @@
void AudioPolicyManager::resumeSession(audio_io_handle_t output, AudioSystem::stream_type stream)
{
- LOGV("resumeSession() Output [%d] and stream is [%d]", output, stream);
+ ALOGV("resumeSession() Output [%d] and stream is [%d]", output, stream);
if (output == mLPAActiveOuput)
{
@@ -646,7 +646,7 @@
void AudioPolicyManager::releaseSession(audio_io_handle_t output)
{
- LOGV("releaseSession() %d", output);
+ ALOGV("releaseSession() %d", output);
// This means the Output is put into Pause state
if (output == mLPAActiveOuput && mLPADecodeOutput == -1) {
@@ -656,7 +656,7 @@
ssize_t index = mOutputs.indexOfKey(output);
if (index < 0) {
- LOGW("releaseSession() releasing unknown output %d", output);
+ ALOGW("releaseSession() releasing unknown output %d", output);
return;
}
@@ -673,10 +673,10 @@
status_t AudioPolicyManager::startOutput(audio_io_handle_t output, AudioSystem::stream_type stream, int session)
{
- LOGV("startOutput() output %d, stream %d", output, stream);
+ ALOGV("startOutput() output %d, stream %d", output, stream);
ssize_t index = mOutputs.indexOfKey(output);
if (index < 0) {
- LOGW("startOutput() unknow output %d", output);
+ ALOGW("startOutput() unknow output %d", output);
return BAD_VALUE;
}
@@ -696,16 +696,16 @@
outputDesc->changeRefCount(stream, 1);
#ifdef FM_ENABLED
if(stream == AudioSystem::FM && output == mA2dpOutput) {
- setOutputDevice(output, AudioPolicyManagerBase::getNewDevice(output), true);
+ setOutputDevice(output, AudioPolicyManagerBase::getNewDevice(output, true), true);
} else
#endif
#ifdef TUNNEL_LPA_ENABLED
if (output != mLPADecodeOutput) {
- setOutputDevice(output, AudioPolicyManagerBase::getNewDevice(output));
+ setOutputDevice(output, AudioPolicyManagerBase::getNewDevice(output, true));
} else
#endif
{
- setOutputDevice(output, AudioPolicyManagerBase::getNewDevice(output), true);
+ setOutputDevice(output, AudioPolicyManagerBase::getNewDevice(output, true), true);
}
// handle special case for sonification while in call
@@ -714,17 +714,17 @@
}
// apply volume rules for current stream and device if necessary
- checkAndSetVolume(stream, mStreams[stream].mIndexCur, output, outputDesc->device());
+ checkAndSetVolume((int)stream, mStreams[stream].mIndexCur.valueFor(outputDesc->device()), output, outputDesc->device());
return NO_ERROR;
}
status_t AudioPolicyManager::stopOutput(audio_io_handle_t output, AudioSystem::stream_type stream, int session)
{
- LOGV("stopOutput() output %d, stream %d", output, stream);
+ ALOGV("stopOutput() output %d, stream %d", output, stream);
ssize_t index = mOutputs.indexOfKey(output);
if (index < 0) {
- LOGW("stopOutput() unknow output %d", output);
+ ALOGW("stopOutput() unknow output %d", output);
return BAD_VALUE;
}
@@ -745,7 +745,7 @@
// mMusicStopTime = systemTime();
}
- uint32_t newDevice = AudioPolicyManagerBase::getNewDevice(mHardwareOutput, false);
+ uint32_t newDevice = AudioPolicyManagerBase::getNewDevice(mPrimaryOutput, false);
if(newDevice == 0 && mLPADecodeOutput != -1) {
newDevice = AudioPolicyManagerBase::getNewDevice(mLPADecodeOutput, false);
@@ -759,15 +759,15 @@
setStrategyMute(STRATEGY_MEDIA,
false,
mA2dpOutput,
- mOutputs.valueFor(mHardwareOutput)->mLatency*2);
+ mOutputs.valueFor(mPrimaryOutput)->mLatency*2);
}
#endif
- if (output != mHardwareOutput) {
- setOutputDevice(mHardwareOutput, AudioPolicyManagerBase::getNewDevice(mHardwareOutput), true);
+ if (output != mPrimaryOutput) {
+ setOutputDevice(mPrimaryOutput, AudioPolicyManagerBase::getNewDevice(mPrimaryOutput, true), true);
}
return NO_ERROR;
} else {
- LOGW("stopOutput() refcount is already 0 for output %d", output);
+ ALOGW("stopOutput() refcount is already 0 for output %d", output);
return INVALID_OPERATION;
}
}
@@ -791,7 +791,7 @@
void AudioPolicyManager::setOutputDevice(audio_io_handle_t output, uint32_t device, bool force, int delayMs)
{
- LOGV("setOutputDevice() output %d device %x delayMs %d", output, device, delayMs);
+ ALOGV("setOutputDevice() output %d device %x delayMs %d", output, device, delayMs);
AudioOutputDescriptor *outputDesc = mOutputs.valueFor(output);
@@ -815,11 +815,11 @@
// - the requested device is the same as current device and force is not specified.
// Doing this check here allows the caller to call setOutputDevice() without conditions
if ((device == 0 || device == prevDevice) && !force) {
- LOGV("setOutputDevice() setting same device %x or null device for output %d", device, output);
+ ALOGV("setOutputDevice() setting same device %x or null device for output %d", device, output);
return;
}
- outputDesc->mDevice = device;
+ outputDesc->mDevice = (audio_devices_t)device;
// mute media streams if both speaker and headset are selected
if (device == (AudioSystem::DEVICE_OUT_SPEAKER | AudioSystem::DEVICE_OUT_WIRED_HEADSET)
|| device == (AudioSystem::DEVICE_OUT_SPEAKER | AudioSystem::DEVICE_OUT_ANC_HEADSET)
@@ -832,14 +832,14 @@
// Mute LPA output also if it belongs to STRATEGY_MEDIA
if(((mLPADecodeOutput != -1) && (mLPADecodeOutput != output) &&
mOutputs.valueFor(mLPADecodeOutput)->isUsedByStrategy(STRATEGY_MEDIA))) {
- LOGV("setOutputDevice: Muting mLPADecodeOutput:%d",mLPADecodeOutput);
+ ALOGV("setOutputDevice: Muting mLPADecodeOutput:%d",mLPADecodeOutput);
setStrategyMute(STRATEGY_MEDIA, true, mLPADecodeOutput);
}
// Mute hardware output also if it belongs to STRATEGY_MEDIA
- if(((mHardwareOutput != -1) && (mHardwareOutput != output) &&
- mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_MEDIA))) {
- LOGV("setOutputDevice: Muting mHardwareOutput:%d",mHardwareOutput);
- setStrategyMute(STRATEGY_MEDIA, true, mHardwareOutput);
+ if(((mPrimaryOutput != -1) && (mPrimaryOutput != output) &&
+ mOutputs.valueFor(mPrimaryOutput)->isUsedByStrategy(STRATEGY_MEDIA))) {
+ ALOGV("setOutputDevice: Muting mPrimaryOutput:%d",mPrimaryOutput);
+ setStrategyMute(STRATEGY_MEDIA, true, mPrimaryOutput);
}
// wait for the PCM output buffers to empty before proceeding with the rest of the command
usleep(outputDesc->mLatency*2*1000);
@@ -849,10 +849,14 @@
if(prevDevice == AudioSystem::DEVICE_OUT_AUX_DIGITAL) {
if((mLPADecodeOutput != -1 && output == mLPADecodeOutput &&
mOutputs.valueFor(mLPADecodeOutput)->isUsedByStrategy(STRATEGY_MEDIA))) {
- checkAndSetVolume(AudioSystem::MUSIC, mStreams[AudioSystem::MUSIC].mIndexCur, mLPADecodeOutput, device, delayMs, force);
+ checkAndSetVolume(AudioSystem::MUSIC,
+ mStreams[AudioSystem::MUSIC].mIndexCur.valueFor((audio_devices_t)device),
+ mLPADecodeOutput, (audio_devices_t)device, delayMs, force);
usleep(150*1000);
} else {
- checkAndSetVolume(AudioSystem::MUSIC, mStreams[AudioSystem::MUSIC].mIndexCur, output, device, delayMs, force);
+ checkAndSetVolume(AudioSystem::MUSIC,
+ mStreams[AudioSystem::MUSIC].mIndexCur.valueFor((audio_devices_t)device),
+ output, (audio_devices_t)device, delayMs, force);
usleep(outputDesc->mLatency*6*1000);
}
}
@@ -860,12 +864,12 @@
// do the routing
AudioParameter param = AudioParameter();
param.addInt(String8(AudioParameter::keyRouting), (int)device);
- mpClientInterface->setParameters(mHardwareOutput, param.toString(), delayMs);
+ mpClientInterface->setParameters(mPrimaryOutput, param.toString(), delayMs);
// update stream volumes according to new device
- AudioPolicyManagerBase::applyStreamVolumes(output, device, delayMs);
+ AudioPolicyManagerBase::applyStreamVolumes(output, (audio_devices_t)device, delayMs);
if((mLPADecodeOutput != -1 &&
mOutputs.valueFor(mLPADecodeOutput)->isUsedByStrategy(STRATEGY_MEDIA))) {
- AudioPolicyManagerBase::applyStreamVolumes(mLPADecodeOutput, device, delayMs);
+ AudioPolicyManagerBase::applyStreamVolumes(mLPADecodeOutput, (audio_devices_t)device, delayMs);
}
// if changing from a combined headset + speaker route, unmute media streams
@@ -880,14 +884,14 @@
// Unmute LPA output also if it belongs to STRATEGY_MEDIA
if(((mLPADecodeOutput != -1) && (mLPADecodeOutput != output) &&
mOutputs.valueFor(mLPADecodeOutput)->isUsedByStrategy(STRATEGY_MEDIA))) {
- LOGV("setOutputDevice: Unmuting mLPADecodeOutput:%d delayMs:%d",mLPADecodeOutput,delayMs);
+ ALOGV("setOutputDevice: Unmuting mLPADecodeOutput:%d delayMs:%d",mLPADecodeOutput,delayMs);
setStrategyMute(STRATEGY_MEDIA, false, mLPADecodeOutput, delayMs);
}
// Unmute hardware output also if it belongs to STRATEGY_MEDIA
- if(((mHardwareOutput != -1) && (mHardwareOutput != output) &&
- mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_MEDIA))) {
- LOGV("setOutputDevice: Unmuting mHardwareOutput:%d delayMs:%d",mHardwareOutput,delayMs);
- setStrategyMute(STRATEGY_MEDIA, false, mHardwareOutput, delayMs);
+ if(((mPrimaryOutput != -1) && (mPrimaryOutput != output) &&
+ mOutputs.valueFor(mPrimaryOutput)->isUsedByStrategy(STRATEGY_MEDIA))) {
+ ALOGV("setOutputDevice: Unmuting mPrimaryOutput:%d delayMs:%d",mPrimaryOutput,delayMs);
+ setStrategyMute(STRATEGY_MEDIA, false, mPrimaryOutput, delayMs);
}
}
}
@@ -897,19 +901,19 @@
// do not change actual stream volume if the stream is muted
if ((mOutputs.valueFor(output)->mMuteCount[stream] != 0 && output != mLPADecodeOutput) ||
(output == mLPADecodeOutput && stream == mLPAStreamType && mLPAMuted == true)) {
- LOGV("checkAndSetVolume() stream %d muted count %d", stream, mOutputs.valueFor(output)->mMuteCount[stream]);
+ ALOGV("checkAndSetVolume() stream %d muted count %d", stream, mOutputs.valueFor(output)->mMuteCount[stream]);
return NO_ERROR;
}
// do not change in call volume if bluetooth is connected and vice versa
if ((stream == AudioSystem::VOICE_CALL && mForceUse[AudioSystem::FOR_COMMUNICATION] == AudioSystem::FORCE_BT_SCO) ||
(stream == AudioSystem::BLUETOOTH_SCO && mForceUse[AudioSystem::FOR_COMMUNICATION] != AudioSystem::FORCE_BT_SCO)) {
- LOGV("checkAndSetVolume() cannot set stream %d volume with force use = %d for comm",
+ ALOGV("checkAndSetVolume() cannot set stream %d volume with force use = %d for comm",
stream, mForceUse[AudioSystem::FOR_COMMUNICATION]);
return INVALID_OPERATION;
}
- float volume = computeVolume(stream, index, output, device);
+ float volume = computeVolume(stream, index, output, (audio_devices_t)device);
// do not set volume if the float value did not change
if ((volume != mOutputs.valueFor(output)->mCurVolume[stream]) || (stream == AudioSystem::VOICE_CALL) ||
#ifdef FM_ENABLED
@@ -917,7 +921,7 @@
#endif
force) {
mOutputs.valueFor(output)->mCurVolume[stream] = volume;
- LOGD("setStreamVolume() for output %d stream %d, volume %f, delay %d", output, stream, volume, delayMs);
+ ALOGD("setStreamVolume() for output %d stream %d, volume %f, delay %d", output, stream, volume, delayMs);
if (stream == AudioSystem::VOICE_CALL ||
stream == AudioSystem::DTMF ||
stream == AudioSystem::BLUETOOTH_SCO) {
@@ -933,13 +937,13 @@
AudioParameter result(mpClientInterface->getParameters(0,key));
int value;
if(result.getInt(String8("isVGS"),value) == NO_ERROR){
- LOGD("BT-SCO Voice Volume %f",(float)index/(float)mStreams[stream].mIndexMax);
+ ALOGD("BT-SCO Voice Volume %f",(float)index/(float)mStreams[stream].mIndexMax);
voiceVolume = 1.0;
} else {
voiceVolume = (float)index/(float)mStreams[stream].mIndexMax;
}
}
- if (voiceVolume >= 0 && output == mHardwareOutput) {
+ if (voiceVolume >= 0 && output == mPrimaryOutput) {
mpClientInterface->setVoiceVolume(voiceVolume, delayMs);
}
}
@@ -948,7 +952,7 @@
float fmVolume = -1.0;
fmVolume = computeVolume(stream, index, output, device);
if (fmVolume >= 0) {
- if(output == mHardwareOutput)
+ if(output == mPrimaryOutput)
mpClientInterface->setFmVolume(fmVolume, delayMs);
else if(output == mA2dpOutput)
mpClientInterface->setStreamVolume((AudioSystem::stream_type)stream, volume, output, delayMs);
@@ -967,7 +971,7 @@
StreamDescriptor &streamDesc = mStreams[stream];
AudioOutputDescriptor *outputDesc = mOutputs.valueFor(output);
- LOGV("setStreamMute() stream %d, mute %d, output %d, mMuteCount %d", stream, on, output, outputDesc->mMuteCount[stream]);
+ ALOGV("setStreamMute() stream %d, mute %d, output %d, mMuteCount %d", stream, on, output, outputDesc->mMuteCount[stream]);
if (on) {
if ((outputDesc->mMuteCount[stream] == 0 && output != mLPADecodeOutput) ||
@@ -987,17 +991,17 @@
} else {
if ((outputDesc->mMuteCount[stream] == 0 && output != mLPADecodeOutput) ||
(output == mLPADecodeOutput && stream == mLPAStreamType && false == mLPAMuted)) {
- LOGW("setStreamMute() unmuting non muted stream!");
+ ALOGW("setStreamMute() unmuting non muted stream!");
return;
}
if(output == mLPADecodeOutput) {
if(stream == mLPAStreamType && true == mLPAMuted) {
mLPAMuted = false;
- checkAndSetVolume(stream, streamDesc.mIndexCur, output, outputDesc->device(), delayMs);
+ checkAndSetVolume(stream, streamDesc.mIndexCur.valueFor(outputDesc->device()), output, outputDesc->device(), delayMs);
}
} else {
if(--outputDesc->mMuteCount[stream] == 0){
- checkAndSetVolume(stream, streamDesc.mIndexCur, output, outputDesc->device(), delayMs);
+ checkAndSetVolume(stream, streamDesc.mIndexCur.valueFor(outputDesc->device()), output, outputDesc->device(), delayMs);
}
}
}
@@ -1005,14 +1009,14 @@
void AudioPolicyManager::setForceUse(AudioSystem::force_use usage, AudioSystem::forced_config config)
{
- LOGD("setForceUse() usage %d, config %d, mPhoneState %d", usage, config, mPhoneState);
+ ALOGD("setForceUse() usage %d, config %d, mPhoneState %d", usage, config, mPhoneState);
bool forceVolumeReeval = false;
switch(usage) {
case AudioSystem::FOR_COMMUNICATION:
if (config != AudioSystem::FORCE_SPEAKER && config != AudioSystem::FORCE_BT_SCO &&
config != AudioSystem::FORCE_NONE) {
- LOGW("setForceUse() invalid config %d for FOR_COMMUNICATION", config);
+ ALOGW("setForceUse() invalid config %d for FOR_COMMUNICATION", config);
return;
}
mForceUse[usage] = config;
@@ -1021,19 +1025,19 @@
if (config != AudioSystem::FORCE_HEADPHONES && config != AudioSystem::FORCE_BT_A2DP &&
config != AudioSystem::FORCE_WIRED_ACCESSORY && config != AudioSystem::FORCE_NONE &&
config != AudioSystem::FORCE_SPEAKER) {
- LOGW("setForceUse() invalid config %d for FOR_MEDIA", config);
+ ALOGW("setForceUse() invalid config %d for FOR_MEDIA", config);
return;
}
mForceUse[usage] = config;
{
- uint32_t device = getDeviceForStrategy(STRATEGY_MEDIA);
- setOutputDevice(mHardwareOutput, device);
+ uint32_t device = getDeviceForStrategy(STRATEGY_MEDIA, true);
+ setOutputDevice(mPrimaryOutput, device);
}
break;
case AudioSystem::FOR_RECORD:
if (config != AudioSystem::FORCE_BT_SCO && config != AudioSystem::FORCE_WIRED_ACCESSORY &&
config != AudioSystem::FORCE_NONE) {
- LOGW("setForceUse() invalid config %d for FOR_RECORD", config);
+ ALOGW("setForceUse() invalid config %d for FOR_RECORD", config);
return;
}
mForceUse[usage] = config;
@@ -1041,30 +1045,30 @@
case AudioSystem::FOR_DOCK:
if (config != AudioSystem::FORCE_NONE && config != AudioSystem::FORCE_BT_CAR_DOCK &&
config != AudioSystem::FORCE_BT_DESK_DOCK && config != AudioSystem::FORCE_WIRED_ACCESSORY) {
- LOGW("setForceUse() invalid config %d for FOR_DOCK", config);
+ ALOGW("setForceUse() invalid config %d for FOR_DOCK", config);
}
forceVolumeReeval = true;
mForceUse[usage] = config;
break;
default:
- LOGW("setForceUse() invalid usage %d", usage);
+ ALOGW("setForceUse() invalid usage %d", usage);
break;
}
// check for device and output changes triggered by new phone state
- uint32_t newDevice = getNewDevice(mHardwareOutput, false);
+ uint32_t newDevice = getNewDevice(mPrimaryOutput, false);
#ifdef WITH_A2DP
AudioPolicyManagerBase::checkA2dpSuspend();
checkOutputForAllStrategies();
#endif
updateDeviceForStrategy();
- setOutputDevice(mHardwareOutput, newDevice);
+ setOutputDevice(mPrimaryOutput, newDevice);
if (forceVolumeReeval) {
- applyStreamVolumes(mHardwareOutput, newDevice);
+ applyStreamVolumes(mPrimaryOutput, (audio_devices_t)newDevice);
}
}
-uint32_t AudioPolicyManager::getDeviceForInputSource(int inputSource)
+audio_devices_t AudioPolicyManager::getDeviceForInputSource(int inputSource)
{
uint32_t device;
@@ -1100,19 +1104,24 @@
case AUDIO_SOURCE_VOICE_CALL:
device = AudioSystem::DEVICE_IN_VOICE_CALL;
break;
+#if 0
case AUDIO_SOURCE_FM_RX:
device = AudioSystem::DEVICE_IN_FM_RX;
break;
case AUDIO_SOURCE_FM_RX_A2DP:
device = AudioSystem::DEVICE_IN_FM_RX_A2DP;
break;
+#endif
default:
- LOGW("getInput() invalid input source %d", inputSource);
+ ALOGW("getInput() invalid input source %d", inputSource);
device = 0;
break;
}
- LOGV("getDeviceForInputSource()input source %d, device %08x", inputSource, device);
- return device;
+ ALOGV("getDeviceForInputSource()input source %d, device %08x", inputSource, device);
+ if (!device)
+ ALOGE("%s: did not select device for input source %d",
+ __FUNCTION__, inputSource);
+ return (audio_devices_t)device;
}
/*
@@ -1121,10 +1130,10 @@
*/
status_t AudioPolicyManager::startInput(audio_io_handle_t input)
{
- LOGV("startInput() input %d", input);
+ ALOGV("startInput() input %d", input);
ssize_t index = mInputs.indexOfKey(input);
if (index < 0) {
- LOGW("startInput() unknow input %d", input);
+ ALOGW("startInput() unknow input %d", input);
return BAD_VALUE;
}
AudioInputDescriptor *inputDesc = mInputs.valueAt(index);
@@ -1133,7 +1142,7 @@
// use Voice Recognition mode or not for this input based on input source
int vr_enabled = inputDesc->mInputSource == AUDIO_SOURCE_VOICE_RECOGNITION ? 1 : 0;
param.addInt(String8("vr_mode"), vr_enabled);
- LOGV("AudioPolicyManager::startInput(%d), setting vr_mode to %d", inputDesc->mInputSource, vr_enabled);
+ ALOGV("AudioPolicyManager::startInput(%d), setting vr_mode to %d", inputDesc->mInputSource, vr_enabled);
mpClientInterface->setParameters(input, param.toString());
inputDesc->mRefCount = 1;
return NO_ERROR;
diff --git a/alsa_sound/AudioPolicyManagerALSA.h b/alsa_sound/AudioPolicyManagerALSA.h
index 75ed196..5f8f63d 100644
--- a/alsa_sound/AudioPolicyManagerALSA.h
+++ b/alsa_sound/AudioPolicyManagerALSA.h
@@ -33,9 +33,7 @@
#define SONIFICATION_HEADSET_VOLUME_FACTOR 0.5
// Min volume for STRATEGY_SONIFICATION streams when limited by music volume: -36dB
#define SONIFICATION_HEADSET_VOLUME_MIN 0.016
-// Time in seconds during which we consider that music is still active after a music
-// track was stopped - see computeVolume()
-#define SONIFICATION_HEADSET_MUSIC_DELAY 5
+
class AudioPolicyManager: public AudioPolicyManagerBase
{
@@ -65,7 +63,9 @@
// "future" device selection (fromCache == false) when called from a context
// where conditions are changing (setDeviceConnectionState(), setPhoneState()...) AND
// before updateDeviceForStrategy() is called.
- virtual uint32_t getDeviceForStrategy(routing_strategy strategy, bool fromCache = true);
+ virtual audio_devices_t getDeviceForStrategy(routing_strategy strategy,
+ bool fromCache);
+
#ifdef TUNNEL_LPA_ENABLED
virtual audio_io_handle_t getSession(AudioSystem::stream_type stream,
@@ -95,7 +95,7 @@
// check that volume change is permitted, compute and send new volume to audio hardware
status_t checkAndSetVolume(int stream, int index, audio_io_handle_t output, uint32_t device, int delayMs = 0, bool force = false);
// select input device corresponding to requested audio source
- virtual uint32_t getDeviceForInputSource(int inputSource);
+ virtual audio_devices_t getDeviceForInputSource(int inputSource);
// Mute or unmute the stream on the specified output
void setStreamMute(int stream, bool on, audio_io_handle_t output, int delayMs = 0);
audio_io_handle_t mLPADecodeOutput; // active output handler
diff --git a/alsa_sound/AudioStreamInALSA.cpp b/alsa_sound/AudioStreamInALSA.cpp
index 321984c..ba5d5e0 100644
--- a/alsa_sound/AudioStreamInALSA.cpp
+++ b/alsa_sound/AudioStreamInALSA.cpp
@@ -24,9 +24,8 @@
#include <unistd.h>
#include <dlfcn.h>
-#define LOG_TAG "AudioStreamInALSA"
+#define LOG_TAG "audio.primary.msm8960"
//#define LOG_NDEBUG 0
-#define LOG_NDDEBUG 0
#include <utils/Log.h>
#include <utils/String8.h>
@@ -92,7 +91,7 @@
err = initSurroundSoundLibrary(handle->bufferSize);
if ( NO_ERROR != err) {
- LOGE("initSurroundSoundLibrary failed: %d handle->bufferSize:%d", err,handle->bufferSize);
+ ALOGE("initSurroundSoundLibrary failed: %d handle->bufferSize:%d", err,handle->bufferSize);
}
property_get("ssr.pcmdump",c_multi_ch_dump,"0");
@@ -104,7 +103,7 @@
if ( !mFp_6ch)
mFp_6ch = fopen("/data/6ch_ssr.pcm", "wb");
if ((!mFp_4ch) || (!mFp_6ch))
- LOGE("mfp_4ch or mfp_6ch open failed: mfp_4ch:%p mfp_6ch:%p",mFp_4ch,mFp_6ch);
+ ALOGE("mfp_4ch or mfp_6ch open failed: mfp_4ch:%p mfp_6ch:%p",mFp_4ch,mFp_6ch);
}
}
}
@@ -125,7 +124,7 @@
{
int period_size;
- LOGV("read:: buffer %p, bytes %d", buffer, bytes);
+ ALOGV("read:: buffer %p, bytes %d", buffer, bytes);
int n;
status_t err;
@@ -141,7 +140,7 @@
if ((use_case != NULL) && (strcmp(use_case, SND_USE_CASE_VERB_INACTIVE))) {
if ((mHandle->devices == AudioSystem::DEVICE_IN_VOICE_CALL) &&
(newMode == AudioSystem::MODE_IN_CALL)) {
- LOGD("read:: mParent->mIncallMode=%d", mParent->mIncallMode);
+ ALOGD("read:: mParent->mIncallMode=%d", mParent->mIncallMode);
if ((mParent->mIncallMode & AudioSystem::CHANNEL_IN_VOICE_UPLINK) &&
(mParent->mIncallMode & AudioSystem::CHANNEL_IN_VOICE_DNLINK)) {
#if 0
@@ -184,7 +183,7 @@
} else {
if ((mHandle->devices == AudioSystem::DEVICE_IN_VOICE_CALL) &&
(newMode == AudioSystem::MODE_IN_CALL)) {
- LOGD("read:: ---- mParent->mIncallMode=%d", mParent->mIncallMode);
+ ALOGD("read:: ---- mParent->mIncallMode=%d", mParent->mIncallMode);
if ((mParent->mIncallMode & AudioSystem::CHANNEL_IN_VOICE_UPLINK) &&
(mParent->mIncallMode & AudioSystem::CHANNEL_IN_VOICE_DNLINK)) {
#if 0
@@ -268,7 +267,7 @@
else
mHandle->module->open(mHandle);
if(mHandle->handle == NULL) {
- LOGE("read:: PCM device open failed");
+ ALOGE("read:: PCM device open failed");
mParent->mLock.unlock();
return 0;
@@ -292,14 +291,14 @@
(mDevices & AudioSystem::DEVICE_OUT_ANLG_DOCK_HEADSET)) &&
(!mParent->musbRecordingState)) {
mParent->mLock.lock();
- LOGD("Starting UsbRecording thread");
+ ALOGD("Starting UsbRecording thread");
mParent->startUsbRecordingIfNotStarted();
if(!strcmp(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL) ||
!strcmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_VOIP)) {
- LOGD("Enabling voip recording bit");
+ ALOGD("Enabling voip recording bit");
mParent->musbRecordingState |= USBRECBIT_VOIPCALL;
}else{
- LOGD("Enabling HiFi Recording bit");
+ ALOGD("Enabling HiFi Recording bit");
mParent->musbRecordingState |= USBRECBIT_REC;
}
mParent->mLock.unlock();
@@ -319,7 +318,7 @@
do {
if (mSurroundOutputBufferIdx > 0) {
- LOGV("AudioStreamInALSA::read() - copy processed output "
+ ALOGV("AudioStreamInALSA::read() - copy processed output "
"to buffer, mSurroundOutputBufferIdx = %d",
mSurroundOutputBufferIdx);
// Copy processed output to buffer
@@ -340,7 +339,7 @@
}
if (processed >= samples) {
- LOGV("AudioStreamInALSA::read() - done processing buffer, "
+ ALOGV("AudioStreamInALSA::read() - done processing buffer, "
"processed = %d", processed);
// Done processing this buffer
break;
@@ -352,7 +351,7 @@
while (mHandle->handle && read_pending > 0) {
n = pcm_read(mHandle->handle, &mSurroundInputBuffer[read],
period_bytes);
- LOGV("pcm_read() returned n = %d buffer:%p size:%d", n, &mSurroundInputBuffer[read], period_bytes);
+ ALOGV("pcm_read() returned n = %d buffer:%p size:%d", n, &mSurroundInputBuffer[read], period_bytes);
if (n && n != -EAGAIN) {
//Recovery part of pcm_read. TODO:split recovery.
return static_cast<ssize_t>(n);
@@ -392,7 +391,7 @@
}
mSurroundOutputBufferIdx += SSR_OUTPUT_FRAME_SIZE;
- LOGV("do_while loop: processed=%d, samples=%d\n", processed, samples);
+ ALOGV("do_while loop: processed=%d, samples=%d\n", processed, samples);
} while (mHandle->handle && processed < samples);
read = processed * sizeof(Word16);
buffer = buffer_start;
@@ -407,10 +406,10 @@
n = pcm_read(mHandle->handle, buffer,
period_size);
- LOGV("pcm_read() returned n = %d", n);
+ ALOGV("pcm_read() returned n = %d", n);
if (n && (n == -EIO || n == -EAGAIN || n == -EPIPE || n == -EBADFD)) {
mParent->mLock.lock();
- LOGW("pcm_read() returned error n %d, Recovering from error\n", n);
+ ALOGW("pcm_read() returned error n %d, Recovering from error\n", n);
pcm_close(mHandle->handle);
mHandle->handle = NULL;
if((!strncmp(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL, strlen(SND_USE_CASE_VERB_IP_VOICECALL))) ||
@@ -425,7 +424,7 @@
continue;
}
else if (n < 0) {
- LOGD("pcm_read() returned n < 0");
+ ALOGD("pcm_read() returned n < 0");
return static_cast<ssize_t>(n);
}
else {
@@ -458,14 +457,14 @@
{
Mutex::Autolock autoLock(mParent->mLock);
- LOGD("close");
+ ALOGD("close");
if((!strcmp(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL)) ||
(!strcmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_VOIP))) {
if((mParent->mVoipStreamCount)) {
- LOGD("musbRecordingState: %d, mVoipStreamCount:%d",mParent->musbRecordingState,
+ ALOGD("musbRecordingState: %d, mVoipStreamCount:%d",mParent->musbRecordingState,
mParent->mVoipStreamCount );
if(mParent->mVoipStreamCount == 1) {
- LOGE("Deregistering VOIP Call bit, musbPlaybackState:%d,"
+ ALOGE("Deregistering VOIP Call bit, musbPlaybackState:%d,"
"musbRecordingState:%d", mParent->musbPlaybackState, mParent->musbRecordingState);
mParent->musbPlaybackState &= ~USBPLAYBACKBIT_VOIPCALL;
mParent->musbRecordingState &= ~USBRECBIT_VOIPCALL;
@@ -477,7 +476,7 @@
mParent->mVoipStreamCount = 0;
mParent->mVoipMicMute = 0;
} else {
- LOGD("Deregistering REC bit, musbRecordingState:%d", mParent->musbRecordingState);
+ ALOGD("Deregistering REC bit, musbRecordingState:%d", mParent->musbRecordingState);
mParent->musbRecordingState &= ~USBRECBIT_REC;
}
#if 0
@@ -488,7 +487,7 @@
}
}
#endif
- LOGD("close");
+ ALOGD("close");
mParent->closeUsbRecordingIfNothingActive();
ALSAStreamOps::close();
@@ -541,7 +540,7 @@
{
Mutex::Autolock autoLock(mParent->mLock);
- LOGD("standby");
+ ALOGD("standby");
if((!strcmp(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL)) ||
(!strcmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_VOIP))) {
@@ -549,18 +548,18 @@
}
#if 0
- LOGD("standby");
+ ALOGD("standby");
if (mParent->mFusion3Platform) {
if((!strcmp(mHandle->useCase, SND_USE_CASE_VERB_INCALL_REC)) ||
(!strcmp(mHandle->useCase, SND_USE_CASE_MOD_CAPTURE_VOICE))) {
- LOGD(" into standby, stop record");
+ ALOGD(" into standby, stop record");
csd_client_stop_record();
}
}
#endif
mHandle->module->standby(mHandle);
- LOGD("Checking for musbRecordingState %d", mParent->musbRecordingState);
+ ALOGD("Checking for musbRecordingState %d", mParent->musbRecordingState);
mParent->musbRecordingState &= ~USBRECBIT_REC;
mParent->closeUsbRecordingIfNothingActive();
@@ -600,7 +599,7 @@
mSurroundOutputBufferIdx = 0;
if ( mSurroundObj ) {
- LOGE("ola filter library is already initialized");
+ ALOGE("ola filter library is already initialized");
return ALREADY_EXISTS;
}
@@ -608,7 +607,7 @@
mSurroundInputBuffer = (Word16 *) calloc(2 * SSR_INPUT_FRAME_SIZE,
sizeof(Word16));
if ( !mSurroundInputBuffer ) {
- LOGE("Memory allocation failure. Not able to allocate memory for surroundInputBuffer");
+ ALOGE("Memory allocation failure. Not able to allocate memory for surroundInputBuffer");
goto init_fail;
}
@@ -616,25 +615,25 @@
mSurroundOutputBuffer = (Word16 *) calloc(2 * SSR_OUTPUT_FRAME_SIZE,
sizeof(Word16));
if ( !mSurroundOutputBuffer ) {
- LOGE("Memory allocation failure. Not able to allocate memory for surroundOutputBuffer");
+ ALOGE("Memory allocation failure. Not able to allocate memory for surroundOutputBuffer");
goto init_fail;
}
// Allocate memory for real and imag coeffs array
mRealCoeffs = (Word16 **) calloc(COEFF_ARRAY_SIZE, sizeof(Word16 *));
if ( !mRealCoeffs ) {
- LOGE("Memory allocation failure during real Coefficient array");
+ ALOGE("Memory allocation failure during real Coefficient array");
goto init_fail;
}
mImagCoeffs = (Word16 **) calloc(COEFF_ARRAY_SIZE, sizeof(Word16 *));
if ( !mImagCoeffs ) {
- LOGE("Memory allocation failure during imaginary Coefficient array");
+ ALOGE("Memory allocation failure during imaginary Coefficient array");
goto init_fail;
}
if( readCoeffsFromFile() != NO_ERROR) {
- LOGE("Error while loading coeffs from file");
+ ALOGE("Error while loading coeffs from file");
goto init_fail;
}
@@ -650,7 +649,7 @@
NULL);
if ( ret > 0 ) {
- LOGV("Allocating surroundObj size is %d", ret);
+ ALOGV("Allocating surroundObj size is %d", ret);
mSurroundObj = (void *)malloc(ret);
memset(mSurroundObj,0,ret);
if (NULL != mSurroundObj) {
@@ -665,16 +664,16 @@
high_freq,
NULL);
if (0 != ret) {
- LOGE("surround_filters_init failed with ret:%d",ret);
+ ALOGE("surround_filters_init failed with ret:%d",ret);
surround_filters_release(mSurroundObj);
goto init_fail;
}
} else {
- LOGE("Allocationg mSurroundObj failed");
+ ALOGE("Allocationg mSurroundObj failed");
goto init_fail;
}
} else {
- LOGE("surround_filters_init(mSurroundObj=Null) failed with ret: %d",ret);
+ ALOGE("surround_filters_init(mSurroundObj=Null) failed with ret: %d",ret);
goto init_fail;
}
@@ -735,45 +734,45 @@
FILE *flt4i;
if ( (flt1r = fopen(SURROUND_FILE_1R, "rb")) == NULL ) {
- LOGE("Cannot open filter co-efficient file %s", SURROUND_FILE_1R);
+ ALOGE("Cannot open filter co-efficient file %s", SURROUND_FILE_1R);
return NAME_NOT_FOUND;
}
if ( (flt2r = fopen(SURROUND_FILE_2R, "rb")) == NULL ) {
- LOGE("Cannot open filter co-efficient file %s", SURROUND_FILE_2R);
+ ALOGE("Cannot open filter co-efficient file %s", SURROUND_FILE_2R);
return NAME_NOT_FOUND;
}
if ( (flt3r = fopen(SURROUND_FILE_3R, "rb")) == NULL ) {
- LOGE("Cannot open filter co-efficient file %s", SURROUND_FILE_3R);
+ ALOGE("Cannot open filter co-efficient file %s", SURROUND_FILE_3R);
return NAME_NOT_FOUND;
}
if ( (flt4r = fopen(SURROUND_FILE_4R, "rb")) == NULL ) {
- LOGE("Cannot open filter co-efficient file %s", SURROUND_FILE_4R);
+ ALOGE("Cannot open filter co-efficient file %s", SURROUND_FILE_4R);
return NAME_NOT_FOUND;
}
if ( (flt1i = fopen(SURROUND_FILE_1I, "rb")) == NULL ) {
- LOGE("Cannot open filter co-efficient file %s", SURROUND_FILE_1I);
+ ALOGE("Cannot open filter co-efficient file %s", SURROUND_FILE_1I);
return NAME_NOT_FOUND;
}
if ( (flt2i = fopen(SURROUND_FILE_2I, "rb")) == NULL ) {
- LOGE("Cannot open filter co-efficient file %s", SURROUND_FILE_2I);
+ ALOGE("Cannot open filter co-efficient file %s", SURROUND_FILE_2I);
return NAME_NOT_FOUND;
}
if ( (flt3i = fopen(SURROUND_FILE_3I, "rb")) == NULL ) {
- LOGE("Cannot open filter co-efficient file %s", SURROUND_FILE_3I);
+ ALOGE("Cannot open filter co-efficient file %s", SURROUND_FILE_3I);
return NAME_NOT_FOUND;
}
if ( (flt4i = fopen(SURROUND_FILE_4I, "rb")) == NULL ) {
- LOGE("Cannot open filter co-efficient file %s", SURROUND_FILE_4I);
+ ALOGE("Cannot open filter co-efficient file %s", SURROUND_FILE_4I);
return NAME_NOT_FOUND;
}
- LOGV("readCoeffsFromFile all filter files opened");
+ ALOGV("readCoeffsFromFile all filter files opened");
for (int i=0; i<COEFF_ARRAY_SIZE; i++) {
mRealCoeffs[i] = (Word16 *)calloc(FILT_SIZE, sizeof(Word16));
diff --git a/alsa_sound/AudioStreamOutALSA.cpp b/alsa_sound/AudioStreamOutALSA.cpp
index e20b7ac..b370791 100644
--- a/alsa_sound/AudioStreamOutALSA.cpp
+++ b/alsa_sound/AudioStreamOutALSA.cpp
@@ -25,9 +25,8 @@
#include <dlfcn.h>
#include <math.h>
-#define LOG_TAG "AudioStreamOutALSA"
+#define LOG_TAG "audio.primary.msm8960"
//#define LOG_NDEBUG 0
-#define LOG_NDDEBUG 0
#include <utils/Log.h>
#include <utils/String8.h>
@@ -76,32 +75,32 @@
volume = (left + right) / 2;
if (volume < 0.0) {
- LOGW("AudioSessionOutALSA::setVolume(%f) under 0.0, assuming 0.0\n", volume);
+ ALOGW("AudioSessionOutALSA::setVolume(%f) under 0.0, assuming 0.0\n", volume);
volume = 0.0;
} else if (volume > 1.0) {
- LOGW("AudioSessionOutALSA::setVolume(%f) over 1.0, assuming 1.0\n", volume);
+ ALOGW("AudioSessionOutALSA::setVolume(%f) over 1.0, assuming 1.0\n", volume);
volume = 1.0;
}
vol = lrint((volume * 0x2000)+0.5);
if(!strcmp(mHandle->useCase, SND_USE_CASE_VERB_HIFI_LOW_POWER) ||
!strcmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_LPA)) {
- LOGD("setLpaVolume(%f)\n", volume);
- LOGD("Setting LPA volume to %d (available range is 0 to 100)\n", vol);
+ ALOGD("setLpaVolume(%f)\n", volume);
+ ALOGD("Setting LPA volume to %d (available range is 0 to 100)\n", vol);
mHandle->module->setLpaVolume(vol);
return status;
}
else if(!strcmp(mHandle->useCase, SND_USE_CASE_VERB_HIFI_TUNNEL) ||
!strcmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_TUNNEL)) {
- LOGD("setCompressedVolume(%f)\n", volume);
- LOGD("Setting Compressed volume to %d (available range is 0 to 100)\n", vol);
+ ALOGD("setCompressedVolume(%f)\n", volume);
+ ALOGD("Setting Compressed volume to %d (available range is 0 to 100)\n", vol);
mHandle->module->setCompressedVolume(vol);
return status;
}
else if(!strncmp(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL,
sizeof(mHandle->useCase)) || !strncmp(mHandle->useCase,
SND_USE_CASE_MOD_PLAY_VOIP, sizeof(mHandle->useCase))) {
- LOGV("Avoid Software volume by returning success\n");
+ ALOGV("Avoid Software volume by returning success\n");
return status;
}
return INVALID_OPERATION;
@@ -112,7 +111,7 @@
int period_size;
char *use_case;
- LOGV("write:: buffer %p, bytes %d", buffer, bytes);
+ ALOGV("write:: buffer %p, bytes %d", buffer, bytes);
snd_pcm_sframes_t n = 0;
size_t sent = 0;
@@ -180,7 +179,7 @@
else
mHandle->module->open(mHandle);
if(mHandle->handle == NULL) {
- LOGE("write:: device open failed");
+ ALOGE("write:: device open failed");
mParent->mLock.unlock();
return 0;
}
@@ -205,13 +204,13 @@
(!mParent->musbPlaybackState)) {
mParent->mLock.lock();
mParent->startUsbPlaybackIfNotStarted();
- LOGD("Starting playback on USB");
+ ALOGD("Starting playback on USB");
if(!strcmp(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL) ||
!strcmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_VOIP)) {
- LOGE("Setting VOIPCALL bit here, musbPlaybackState %d", mParent->musbPlaybackState);
+ ALOGE("Setting VOIPCALL bit here, musbPlaybackState %d", mParent->musbPlaybackState);
mParent->musbPlaybackState |= USBPLAYBACKBIT_VOIPCALL;
}else{
- LOGD("enabling music, musbPlaybackState: %d ", mParent->musbPlaybackState);
+ ALOGD("enabling music, musbPlaybackState: %d ", mParent->musbPlaybackState);
mParent->musbPlaybackState |= USBPLAYBACKBIT_MUSIC;
}
mParent->mLock.unlock();
@@ -233,7 +232,7 @@
}
if (n < 0) {
mParent->mLock.lock();
- LOGE("pcm_write returned error %d, trying to recover\n", n);
+ ALOGE("pcm_write returned error %d, trying to recover\n", n);
pcm_close(mHandle->handle);
mHandle->handle = NULL;
if((!strncmp(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL, strlen(SND_USE_CASE_VERB_IP_VOICECALL))) ||
@@ -274,12 +273,12 @@
{
Mutex::Autolock autoLock(mParent->mLock);
- LOGD("close");
+ ALOGD("close");
if((!strcmp(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL)) ||
(!strcmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_VOIP))) {
if((mParent->mVoipStreamCount)) {
if(mParent->mVoipStreamCount == 1) {
- LOGD("Deregistering VOIP Call bit, musbPlaybackState:%d, musbRecordingState: %d",
+ ALOGD("Deregistering VOIP Call bit, musbPlaybackState:%d, musbRecordingState: %d",
mParent->musbPlaybackState, mParent->musbRecordingState);
mParent->musbPlaybackState &= ~USBPLAYBACKBIT_VOIPCALL;
mParent->musbRecordingState &= ~USBRECBIT_VOIPCALL;
@@ -308,7 +307,7 @@
{
Mutex::Autolock autoLock(mParent->mLock);
- LOGD("standby");
+ ALOGD("standby");
if((!strcmp(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL)) ||
(!strcmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_VOIP))) {
@@ -317,10 +316,10 @@
if((!strcmp(mHandle->useCase, SND_USE_CASE_VERB_HIFI_LOW_POWER)) ||
(!strcmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_LPA))) {
- LOGD("Deregistering LPA bit");
+ ALOGD("Deregistering LPA bit");
mParent->musbPlaybackState &= ~USBPLAYBACKBIT_LPA;
} else {
- LOGD("Deregistering MUSIC bit, musbPlaybackState: %d", mParent->musbPlaybackState);
+ ALOGD("Deregistering MUSIC bit, musbPlaybackState: %d", mParent->musbPlaybackState);
mParent->musbPlaybackState &= ~USBPLAYBACKBIT_MUSIC;
}
diff --git a/alsa_sound/AudioUsbALSA.cpp b/alsa_sound/AudioUsbALSA.cpp
index c054081..2d62d34 100644
--- a/alsa_sound/AudioUsbALSA.cpp
+++ b/alsa_sound/AudioUsbALSA.cpp
@@ -26,10 +26,10 @@
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
-#define LOG_TAG "AudioUsbALSA"
+#define LOG_TAG "audio.primary.msm8960"
//#define LOG_NDEBUG 0
-//#define LOG_NDDEBUG 0
#include <utils/Log.h>
+
#include <utils/String8.h>
#include <cutils/properties.h>
@@ -74,7 +74,7 @@
char *nextSRString, *temp_ptr;
nextSRString = strtok_r(ratesStr, " ,", &temp_ptr);
if (nextSRString == NULL) {
- LOGE("ERROR: getnumOfRates: could not find rates string");
+ ALOGE("ERROR: getnumOfRates: could not find rates string");
return NULL;
}
for (i = 1; nextSRString != NULL; i++) {
@@ -86,7 +86,7 @@
status_t AudioUsbALSA::getPlaybackCap()
{
- LOGD("getPlaybackCap");
+ ALOGD("getPlaybackCap");
long unsigned fileSize;
FILE *fp;
char *buffer;
@@ -100,13 +100,13 @@
msampleRatePlayback = 0;
fd = open(PATH, O_RDONLY);
if (fd <0) {
- LOGE("ERROR: failed to open config file %s error: %d\n", PATH, errno);
+ ALOGE("ERROR: failed to open config file %s error: %d\n", PATH, errno);
close(fd);
return UNKNOWN_ERROR;
}
if (fstat(fd, &st) < 0) {
- LOGE("ERROR: failed to stat %s error %d\n", PATH, errno);
+ ALOGE("ERROR: failed to stat %s error %d\n", PATH, errno);
close(fd);
return UNKNOWN_ERROR;
}
@@ -118,7 +118,7 @@
err = read(fd, read_buf, BUFFSIZE);
playbackstr_start = strstr(read_buf, "Playback:");
if (playbackstr_start == NULL) {
- LOGE("ERROR:Playback section not found in usb config file");
+ ALOGE("ERROR:Playback section not found in usb config file");
close(fd);
free(read_buf);
return UNKNOWN_ERROR;
@@ -126,14 +126,14 @@
channel_start = strstr(playbackstr_start, "Channels:");
if (channel_start == NULL) {
- LOGE("ERROR: Could not find Channels information");
+ ALOGE("ERROR: Could not find Channels information");
close(fd);
free(read_buf);
return UNKNOWN_ERROR;
}
channel_start = strstr(channel_start, " ");
if (channel_start == NULL) {
- LOGE("ERROR: Channel section not found in usb config file");
+ ALOGE("ERROR: Channel section not found in usb config file");
close(fd);
free(read_buf);
return UNKNOWN_ERROR;
@@ -145,10 +145,10 @@
} else {
mchannelsPlayback = 2;
}
- LOGD("channels supported by device: %d", lchannelsPlayback);
+ ALOGD("channels supported by device: %d", lchannelsPlayback);
ratesStrStart = strstr(playbackstr_start, "Rates:");
if (ratesStrStart == NULL) {
- LOGE("ERROR: Cant find rates information");
+ ALOGE("ERROR: Cant find rates information");
close(fd);
free(read_buf);
return UNKNOWN_ERROR;
@@ -156,7 +156,7 @@
ratesStrStart = strstr(ratesStrStart, " ");
if (ratesStrStart == NULL) {
- LOGE("ERROR: Channel section not found in usb config file");
+ ALOGE("ERROR: Channel section not found in usb config file");
close(fd);
free(read_buf);
return UNKNOWN_ERROR;
@@ -165,7 +165,7 @@
//copy to ratesStr, current line.
char *target = strchr(ratesStrStart, '\n');
if (target == NULL) {
- LOGE("ERROR: end of line not found");
+ ALOGE("ERROR: end of line not found");
close(fd);
free(read_buf);
return UNKNOWN_ERROR;
@@ -180,7 +180,7 @@
size = getnumOfRates(ratesStr);
if (!size) {
- LOGE("ERROR: Could not get rate size, returning");
+ ALOGE("ERROR: Could not get rate size, returning");
close(fd);
free(ratesStrForVal);
free(ratesStr);
@@ -192,7 +192,7 @@
int ratesSupported[size];
nextSRString = strtok_r(ratesStrForVal, " ,", &temp_ptr);
if (nextSRString == NULL) {
- LOGE("ERROR: Could not get first rate val");
+ ALOGE("ERROR: Could not get first rate val");
close(fd);
free(ratesStrForVal);
free(ratesStr);
@@ -204,7 +204,7 @@
for (i = 1; i<size; i++) {
nextSRString = strtok_r(NULL, " ,.-", &temp_ptr);
ratesSupported[i] = atoi(nextSRString);
- LOGV("ratesSupported[%d] for playback: %d",i, ratesSupported[i]);
+ ALOGV("ratesSupported[%d] for playback: %d",i, ratesSupported[i]);
}
for (i = 0; i<=size; i++) {
@@ -213,7 +213,7 @@
break;
}
}
- LOGD("msampleRatePlayback: %d", msampleRatePlayback);
+ ALOGD("msampleRatePlayback: %d", msampleRatePlayback);
close(fd);
free(ratesStrForVal);
@@ -240,12 +240,12 @@
msampleRateCapture = 0;
fd = open(PATH, O_RDONLY);
if (fd <0) {
- LOGE("ERROR: failed to open config file %s error: %d\n", PATH, errno);
+ ALOGE("ERROR: failed to open config file %s error: %d\n", PATH, errno);
return UNKNOWN_ERROR;
}
if (fstat(fd, &st) < 0) {
- LOGE("ERROR: failed to stat %s error %d\n", PATH, errno);
+ ALOGE("ERROR: failed to stat %s error %d\n", PATH, errno);
close(fd);
return UNKNOWN_ERROR;
}
@@ -255,7 +255,7 @@
err = read(fd, read_buf, BUFFSIZE);
capturestr_start = strstr(read_buf, "Capture:");
if (capturestr_start == NULL) {
- LOGE("ERROR: Could not find capture section for recording");
+ ALOGE("ERROR: Could not find capture section for recording");
free(read_buf);
close(fd);
return NULL;
@@ -263,14 +263,14 @@
channel_startCapture = strstr(capturestr_start, "Channels: ");
if (channel_startCapture == NULL) {
- LOGE("ERROR: Could not find Channels info for recording");
+ ALOGE("ERROR: Could not find Channels info for recording");
close(fd);
free(read_buf);
return UNKNOWN_ERROR;
}
channel_startCapture = strstr(channel_startCapture, " ");
if (channel_startCapture == NULL) {
- LOGE("ERROR: Could not find channels information for recording");
+ ALOGE("ERROR: Could not find channels information for recording");
close(fd);
free(read_buf);
return UNKNOWN_ERROR;
@@ -279,21 +279,21 @@
if (lchannelsCapture == 1) {
mchannelsCapture = 1;
} else {
- LOGD("lchannelsCapture: %d", lchannelsCapture);
+ ALOGD("lchannelsCapture: %d", lchannelsCapture);
mchannelsCapture = 2;
}
}
ratesStrStartCapture = strstr(capturestr_start, "Rates:");
if (ratesStrStartCapture == NULL) {
- LOGE("ERROR; Could not find rates section in config file for recording");
+ ALOGE("ERROR; Could not find rates section in config file for recording");
close(fd);
free(read_buf);
return UNKNOWN_ERROR;
}
ratesStrStartCapture = strstr(ratesStrStartCapture, " ");
if (ratesStrStartCapture == NULL) {
- LOGE("ERROR: Could not find rates section in config file for recording");
+ ALOGE("ERROR: Could not find rates section in config file for recording");
close(fd);
free(read_buf);
return UNKNOWN_ERROR;
@@ -302,7 +302,7 @@
//copy to ratesStr, current line.
target = strchr(ratesStrStartCapture, '\n');
if (target == NULL) {
- LOGE("ERROR: end of line not found for rates");
+ ALOGE("ERROR: end of line not found for rates");
close(fd);
free(read_buf);
return UNKNOWN_ERROR;
@@ -318,7 +318,7 @@
size = getnumOfRates(ratesStr);
if (!size) {
- LOGE("ERROR: Could not get rate size for capture, returning");
+ ALOGE("ERROR: Could not get rate size for capture, returning");
close(fd);
free(read_buf);
free(ratesStr);
@@ -330,7 +330,7 @@
int ratesSupportedCapture[size];
nextSRString = strtok_r(ratesStrForVal, " ,", &temp_ptr);
if (nextSRString == NULL) {
- LOGE("ERROR: Could not find ratesStr for recording");
+ ALOGE("ERROR: Could not find ratesStr for recording");
close(fd);
free(read_buf);
free(ratesStr);
@@ -349,7 +349,7 @@
break;
}
}
- LOGD("msampleRateCapture: %d", msampleRateCapture);
+ ALOGD("msampleRateCapture: %d", msampleRateCapture);
close(fd);
free(read_buf);
@@ -363,7 +363,7 @@
void AudioUsbALSA::exitPlaybackThread(uint64_t writeVal)
{
- LOGD("exitPlaybackThread, mproxypfdPlayback: %d", mproxypfdPlayback);
+ ALOGD("exitPlaybackThread, mproxypfdPlayback: %d", mproxypfdPlayback);
if (writeVal == SIGNAL_EVENT_KILLTHREAD) {
closePlaybackDevices();
}
@@ -377,7 +377,7 @@
void AudioUsbALSA::exitRecordingThread(uint64_t writeVal)
{
- LOGD("exitRecordingThread");
+ ALOGD("exitRecordingThread");
if (writeVal == SIGNAL_EVENT_KILLTHREAD) {
closeRecordingDevices();
}
@@ -389,11 +389,11 @@
err = closeDevice(mproxyRecordingHandle);
if (err) {
- LOGE("Info: Could not close proxy for recording %p", mproxyRecordingHandle);
+ ALOGE("Info: Could not close proxy for recording %p", mproxyRecordingHandle);
}
err = closeDevice(musbRecordingHandle);
if (err) {
- LOGE("Info: Could not close USB recording device %p", musbRecordingHandle);
+ ALOGE("Info: Could not close USB recording device %p", musbRecordingHandle);
}
}
@@ -402,22 +402,22 @@
err = closeDevice(mproxyPlaybackHandle);
if (err) {
- LOGE("Info: Could not close proxy %p", mproxyPlaybackHandle);
+ ALOGE("Info: Could not close proxy %p", mproxyPlaybackHandle);
}
err = closeDevice(musbPlaybackHandle);
if (err) {
- LOGE("Info: Could not close USB device %p", musbPlaybackHandle);
+ ALOGE("Info: Could not close USB device %p", musbPlaybackHandle);
}
}
void AudioUsbALSA::setkillUsbRecordingThread(bool val){
- LOGD("setkillUsbRecordingThread");
+ ALOGD("setkillUsbRecordingThread");
mkillRecordingThread = val;
}
status_t AudioUsbALSA::setHardwareParams(pcm *txHandle, uint32_t sampleRate, uint32_t channels)
{
- LOGD("setHardwareParams");
+ ALOGD("setHardwareParams");
struct snd_pcm_hw_params *params;
unsigned long bufferSize, reqBuffSize;
unsigned int periodTime, bufferTime;
@@ -436,7 +436,7 @@
SNDRV_PCM_FORMAT_S16_LE);
param_set_mask(params, SNDRV_PCM_HW_PARAM_SUBFORMAT,
SNDRV_PCM_SUBFORMAT_STD);
- LOGV("Setting period size: 768 samplerate:%d, channels: %d",sampleRate, channels);
+ ALOGV("Setting period size: 768 samplerate:%d, channels: %d",sampleRate, channels);
param_set_min(params, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 768);
param_set_int(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, 16);
param_set_int(params, SNDRV_PCM_HW_PARAM_FRAME_BITS,
@@ -447,7 +447,7 @@
param_set_hw_refine(txHandle, params);
if (param_set_hw_params(txHandle, params)) {
- LOGE("ERROR: cannot set hw params");
+ ALOGE("ERROR: cannot set hw params");
return NO_INIT;
}
@@ -457,7 +457,7 @@
txHandle->buffer_size = pcm_buffer_size(params);
txHandle->period_cnt = txHandle->buffer_size/txHandle->period_size;
- LOGD("setHardwareParams: buffer_size %d, period_size %d, period_cnt %d",
+ ALOGD("setHardwareParams: buffer_size %d, period_size %d, period_cnt %d",
txHandle->buffer_size, txHandle->period_size,
txHandle->period_cnt);
@@ -466,7 +466,7 @@
status_t AudioUsbALSA::setSoftwareParams(pcm *pcm)
{
- LOGD("setSoftwareParams");
+ ALOGD("setSoftwareParams");
struct snd_pcm_sw_params* params;
unsigned long periodSize = 1024;
@@ -489,7 +489,7 @@
params->silence_threshold = 0;
if (param_set_sw_params(pcm, params)) {
- LOGE("ERROR: cannot set sw params");
+ ALOGE("ERROR: cannot set sw params");
return NO_INIT;
}
@@ -498,12 +498,12 @@
status_t AudioUsbALSA::closeDevice(pcm *handle)
{
- LOGD("closeDevice handle %p", handle);
+ ALOGD("closeDevice handle %p", handle);
status_t err = NO_ERROR;
if (handle) {
err = pcm_close(handle);
if (err != NO_ERROR) {
- LOGE("INFO: closeDevice: pcm_close failed with err %d", err);
+ ALOGE("INFO: closeDevice: pcm_close failed with err %d", err);
}
}
handle = NULL;
@@ -511,7 +511,7 @@
}
void AudioUsbALSA::RecordingThreadEntry() {
- LOGD("Inside RecordingThreadEntry");
+ ALOGD("Inside RecordingThreadEntry");
int nfds = 1;
mtimeOutRecording = TIMEOUT_INFINITE;
int fd;
@@ -531,11 +531,11 @@
err = configureUsbDeviceForRecording();
if (err) {
- LOGE("ERROR: Could not configure USB device for recording");
+ ALOGE("ERROR: Could not configure USB device for recording");
closeDevice(musbRecordingHandle);
return;
} else {
- LOGD("USB device Configured for recording");
+ ALOGD("USB device Configured for recording");
}
pfdUsbRecording[0].fd = musbRecordingHandle->fd; //DEBUG
@@ -543,12 +543,12 @@
err = configureProxyDeviceForRecording();
if (err) {
- LOGE("ERROR: Could not configure Proxy for recording");
+ ALOGE("ERROR: Could not configure Proxy for recording");
closeDevice(mproxyRecordingHandle);
closeDevice(musbRecordingHandle);
return;
} else {
- LOGD("Proxy Configured for recording");
+ ALOGD("Proxy Configured for recording");
}
bufsize = musbRecordingHandle->period_size;
@@ -561,14 +561,14 @@
while (mkillRecordingThread != true) {
if (!musbRecordingHandle->running) {
if (pcm_prepare(musbRecordingHandle)) {
- LOGE("ERROR: pcm_prepare failed for usb device for recording");
+ ALOGE("ERROR: pcm_prepare failed for usb device for recording");
mkillRecordingThread = true;
break;;
}
}
if (!mproxyRecordingHandle->running) {
if (pcm_prepare(mproxyRecordingHandle)) {
- LOGE("ERROR: pcm_prepare failed for proxy device for recording");
+ ALOGE("ERROR: pcm_prepare failed for proxy device for recording");
mkillRecordingThread = true;
break;;
}
@@ -587,7 +587,7 @@
for (;;) {
if (!musbRecordingHandle->running) {
if (pcm_prepare(musbRecordingHandle)) {
- LOGE("ERROR: pcm_prepare failed for proxy device for recording");
+ ALOGE("ERROR: pcm_prepare failed for proxy device for recording");
mkillRecordingThread = true;
break;
}
@@ -625,7 +625,7 @@
for (;;) {
if (!mproxyRecordingHandle->running) {
if (pcm_prepare(mproxyRecordingHandle)) {
- LOGE("ERROR: pcm_prepare failed for proxy device for recording");
+ ALOGE("ERROR: pcm_prepare failed for proxy device for recording");
mkillRecordingThread = true;
break;
}
@@ -699,7 +699,7 @@
closeDevice(mproxyRecordingHandle);
closeDevice(musbRecordingHandle);
}
- LOGD("Exiting USB Recording thread");
+ ALOGD("Exiting USB Recording thread");
}
void *AudioUsbALSA::PlaybackThreadWrapper(void *me) {
@@ -720,43 +720,43 @@
musbPlaybackHandle = pcm_open(flags, (char *)"hw:1,0");
if (!musbPlaybackHandle) {
- LOGE("ERROR: pcm_open failed for usb playback case");
+ ALOGE("ERROR: pcm_open failed for usb playback case");
return UNKNOWN_ERROR;
}
if (!pcm_ready(musbPlaybackHandle)) {
- LOGE("ERROR: pcm_ready failed for usb playback case");
+ ALOGE("ERROR: pcm_ready failed for usb playback case");
return err;
}
err = getPlaybackCap();
if (err) {
- LOGE("ERROR: Could not get playback capabilities from usb device");
+ ALOGE("ERROR: Could not get playback capabilities from usb device");
return UNKNOWN_ERROR;
}
- LOGD("Setting hardware params: sampleRate:%d, channels: %d",msampleRatePlayback, mchannelsPlayback);
+ ALOGD("Setting hardware params: sampleRate:%d, channels: %d",msampleRatePlayback, mchannelsPlayback);
err = setHardwareParams(musbPlaybackHandle, msampleRatePlayback, mchannelsPlayback);
if (err != NO_ERROR) {
- LOGE("ERROR: setHardwareParams failed for usb playback case");
+ ALOGE("ERROR: setHardwareParams failed for usb playback case");
return err;
}
err = setSoftwareParams(musbPlaybackHandle);
if (err != NO_ERROR) {
- LOGE("ERROR: setSoftwareParams failed for usb playback case");
+ ALOGE("ERROR: setSoftwareParams failed for usb playback case");
return err;
}
err = mmap_buffer(musbPlaybackHandle);
if (err) {
- LOGE("ERROR: mmap_buffer failed for usb playback case");
+ ALOGE("ERROR: mmap_buffer failed for usb playback case");
return err;
}
err = pcm_prepare(musbPlaybackHandle);
if (err) {
- LOGE("ERROR: pcm_prepare failed for usb playback case");
+ ALOGE("ERROR: pcm_prepare failed for usb playback case");
return err;
}
@@ -771,43 +771,43 @@
musbRecordingHandle = pcm_open(flags, (char *)"hw:1,0");
if (!musbRecordingHandle) {
- LOGE("ERROR: pcm_open failed for usb recording case");
+ ALOGE("ERROR: pcm_open failed for usb recording case");
return UNKNOWN_ERROR;
}
if (!pcm_ready(musbRecordingHandle)) {
- LOGE("ERROR: pcm_ready failed for usb recording case");
+ ALOGE("ERROR: pcm_ready failed for usb recording case");
return err;
}
err = getCaptureCap();
if (err) {
- LOGE("ERROR: Could not get capture capabilities from usb device");
+ ALOGE("ERROR: Could not get capture capabilities from usb device");
return UNKNOWN_ERROR;
}
- LOGD("Setting hardwareParams for Usb recording msampleRateCapture %d, mchannelsCapture %d", msampleRateCapture, mchannelsCapture);
+ ALOGD("Setting hardwareParams for Usb recording msampleRateCapture %d, mchannelsCapture %d", msampleRateCapture, mchannelsCapture);
err = setHardwareParams(musbRecordingHandle, msampleRateCapture, mchannelsCapture);
if (err != NO_ERROR) {
- LOGE("ERROR: setHardwareParams failed for usb recording case");
+ ALOGE("ERROR: setHardwareParams failed for usb recording case");
return err;
}
err = setSoftwareParams(musbRecordingHandle);
if (err != NO_ERROR) {
- LOGE("ERROR: setSoftwareParams failed for usb recording case");
+ ALOGE("ERROR: setSoftwareParams failed for usb recording case");
return err;
}
err = mmap_buffer(musbRecordingHandle);
if (err) {
- LOGE("ERROR: mmap_buffer failed for usb recording case");
+ ALOGE("ERROR: mmap_buffer failed for usb recording case");
return err;
}
err = pcm_prepare(musbRecordingHandle);
if (err) {
- LOGE("ERROR: pcm_prepare failed for usb recording case");
+ ALOGE("ERROR: pcm_prepare failed for usb recording case");
return err;
}
@@ -820,36 +820,36 @@
flags = PCM_OUT|PCM_MONO|PCM_MMAP;
mproxyRecordingHandle = pcm_open(flags, (char *)"hw:0,7");
if (!mproxyRecordingHandle) {
- LOGE("ERROR: pcm_open failed for proxy recording case");
+ ALOGE("ERROR: pcm_open failed for proxy recording case");
return UNKNOWN_ERROR;
}
if (!pcm_ready(mproxyRecordingHandle)) {
- LOGE("ERROR: pcm_ready failed for proxy recording case");
+ ALOGE("ERROR: pcm_ready failed for proxy recording case");
return UNKNOWN_ERROR;
}
err = setHardwareParams(mproxyRecordingHandle, msampleRateCapture, mchannelsCapture);
if (err != NO_ERROR) {
- LOGE("ERROR: setHardwareParams failed for proxy recording case");
+ ALOGE("ERROR: setHardwareParams failed for proxy recording case");
return err;
}
err = setSoftwareParams(mproxyRecordingHandle);
if (err != NO_ERROR) {
- LOGE("ERROR: setSoftwareParams failed for proxy recording case");
+ ALOGE("ERROR: setSoftwareParams failed for proxy recording case");
return err;
}
err = mmap_buffer(mproxyRecordingHandle);
if (err != NO_ERROR) {
- LOGE("ERROR: mmap_buffer failed for proxy recording case");
+ ALOGE("ERROR: mmap_buffer failed for proxy recording case");
return err;
}
err = pcm_prepare(mproxyRecordingHandle);
if (err != NO_ERROR) {
- LOGE("ERROR: pcm_prepare failed for proxy recording case");
+ ALOGE("ERROR: pcm_prepare failed for proxy recording case");
return err;
}
@@ -862,36 +862,36 @@
flags = PCM_IN|PCM_STEREO|PCM_MMAP;
mproxyPlaybackHandle = pcm_open(flags, (char *)"hw:0,8");
if (!mproxyPlaybackHandle) {
- LOGE("ERROR: pcm_open failed for proxy playback case");
+ ALOGE("ERROR: pcm_open failed for proxy playback case");
return UNKNOWN_ERROR;
}
if (!pcm_ready(mproxyPlaybackHandle)) {
- LOGE("ERROR: pcm_ready failed for proxy playback case");
+ ALOGE("ERROR: pcm_ready failed for proxy playback case");
return err;
}
err = setHardwareParams(mproxyPlaybackHandle, msampleRatePlayback, mchannelsPlayback);
if (err != NO_ERROR) {
- LOGE("ERROR: setHardwareParams failed for proxy playback case");
+ ALOGE("ERROR: setHardwareParams failed for proxy playback case");
return err;;
}
err = setSoftwareParams(mproxyPlaybackHandle);
if (err != NO_ERROR) {
- LOGE("ERROR: setSoftwareParams failed for proxy playback case");
+ ALOGE("ERROR: setSoftwareParams failed for proxy playback case");
return err;
}
err = mmap_buffer(mproxyPlaybackHandle);
if (err != NO_ERROR) {
- LOGE("ERROR: mmap_buffer failed for proxy playback case");
+ ALOGE("ERROR: mmap_buffer failed for proxy playback case");
return err;
}
err = pcm_prepare(mproxyPlaybackHandle);
if (err != NO_ERROR) {
- LOGE("ERROR: pcm_prepare failed for proxy playback case");
+ ALOGE("ERROR: pcm_prepare failed for proxy playback case");
return err;
}
@@ -903,26 +903,26 @@
if (ioctl(handle->fd, SNDRV_PCM_IOCTL_START)) {
err = -errno;
if (errno == EPIPE) {
- LOGE("ERROR: SNDRV_PCM_IOCTL_START returned EPIPE for usb recording case");
+ ALOGE("ERROR: SNDRV_PCM_IOCTL_START returned EPIPE for usb recording case");
handle->underruns++;
handle->running = 0;
handle->start = 0;
return errno;
} else {
- LOGE("ERROR: SNDRV_PCM_IOCTL_START failed for usb recording case errno:%d", errno);
+ ALOGE("ERROR: SNDRV_PCM_IOCTL_START failed for usb recording case errno:%d", errno);
*killThread = true;
return errno;
}
}
handle->start = 1;
if (handle == musbRecordingHandle) {
- LOGD("Usb Driver started for recording");
+ ALOGD("Usb Driver started for recording");
} else if (handle == mproxyRecordingHandle) {
- LOGD("Proxy Driver started for recording");
+ ALOGD("Proxy Driver started for recording");
} else if (handle == musbPlaybackHandle) {
- LOGD("Usb Driver started for playback");
+ ALOGD("Usb Driver started for playback");
} else if (handle == mproxyPlaybackHandle) {
- LOGD("proxy Driver started for playback");
+ ALOGD("proxy Driver started for playback");
}
return NO_ERROR;
}
@@ -931,14 +931,14 @@
int err;
err = sync_ptr(handle);
if (err == EPIPE) {
- LOGE("ERROR: Failed in sync_ptr \n");
+ ALOGE("ERROR: Failed in sync_ptr \n");
handle->running = 0;
handle->underruns++;
handle->start = 0;
} else if (err == ENODEV) {
- LOGE("Info: Device not available");
+ ALOGE("Info: Device not available");
} else if (err != NO_ERROR) {
- LOGE("ERROR: Sync ptr returned %d", err);
+ ALOGE("ERROR: Sync ptr returned %d", err);
*killThread = true;
}
return err;
@@ -947,7 +947,7 @@
void AudioUsbALSA::pollForProxyData(){
int err_poll = poll(pfdProxyPlayback, mnfdsPlayback, mtimeOut);
if (err_poll == 0 ) {
- LOGD("POLL timedout");
+ ALOGD("POLL timedout");
mkillPlayBackThread = true;
pfdProxyPlayback[0].revents = 0;
pfdProxyPlayback[1].revents = 0;
@@ -955,23 +955,23 @@
}
if (pfdProxyPlayback[1].revents & POLLIN) {
- LOGD("Signalled from HAL about timeout");
+ ALOGD("Signalled from HAL about timeout");
uint64_t u;
read(mproxypfdPlayback, &u, sizeof(uint64_t));
pfdProxyPlayback[1].revents = 0;
if (u == SIGNAL_EVENT_KILLTHREAD) {
- LOGD("kill thread event");
+ ALOGD("kill thread event");
mkillPlayBackThread = true;
pfdProxyPlayback[0].revents = 0;
pfdProxyPlayback[1].revents = 0;
return;
} else if (u == SIGNAL_EVENT_TIMEOUT) {
- LOGD("Setting timeout for 3 sec");
+ ALOGD("Setting timeout for 3 sec");
mtimeOut = POLL_TIMEOUT;
}
} else if (pfdProxyPlayback[1].revents & POLLERR || pfdProxyPlayback[1].revents & POLLHUP ||
pfdProxyPlayback[1].revents & POLLNVAL) {
- LOGE("Info: proxy throwing error from location 1");
+ ALOGE("Info: proxy throwing error from location 1");
mkillPlayBackThread = true;
pfdProxyPlayback[0].revents = 0;
pfdProxyPlayback[1].revents = 0;
@@ -980,7 +980,7 @@
if (pfdProxyPlayback[0].revents & POLLERR || pfdProxyPlayback[0].revents & POLLHUP ||
pfdProxyPlayback[0].revents & POLLNVAL) {
- LOGE("Info: proxy throwing error");
+ ALOGE("Info: proxy throwing error");
mkillPlayBackThread = true;
pfdProxyPlayback[0].revents = 0;
pfdProxyPlayback[1].revents = 0;
@@ -990,7 +990,7 @@
void AudioUsbALSA::pollForUsbData(){
int err_poll = poll(pfdUsbPlayback, mnfdsPlayback, mtimeOut);
if (err_poll == 0 ) {
- LOGD("POLL timedout");
+ ALOGD("POLL timedout");
mkillPlayBackThread = true;
pfdUsbPlayback[0].revents = 0;
pfdUsbPlayback[1].revents = 0;
@@ -998,22 +998,22 @@
}
if (pfdUsbPlayback[1].revents & POLLIN) {
- LOGD("Info: Signalled from HAL about an event");
+ ALOGD("Info: Signalled from HAL about an event");
uint64_t u;
read(musbpfdPlayback, &u, sizeof(uint64_t));
pfdUsbPlayback[0].revents = 0;
pfdUsbPlayback[1].revents = 0;
if (u == SIGNAL_EVENT_KILLTHREAD) {
- LOGD("kill thread");
+ ALOGD("kill thread");
mkillPlayBackThread = true;
return;
} else if (u == SIGNAL_EVENT_TIMEOUT) {
- LOGD("Setting timeout for 3 sec");
+ ALOGD("Setting timeout for 3 sec");
mtimeOut = POLL_TIMEOUT;
}
} else if (pfdUsbPlayback[1].revents & POLLERR || pfdUsbPlayback[1].revents & POLLHUP ||
pfdUsbPlayback[1].revents & POLLNVAL) {
- LOGE("Info: usb throwing error from location 1");
+ ALOGE("Info: usb throwing error from location 1");
mkillPlayBackThread = true;
pfdUsbPlayback[0].revents = 0;
pfdUsbPlayback[1].revents = 0;
@@ -1022,7 +1022,7 @@
if (pfdUsbPlayback[0].revents & POLLERR || pfdProxyPlayback[0].revents & POLLHUP ||
pfdUsbPlayback[0].revents & POLLNVAL) {
- LOGE("Info: usb throwing error");
+ ALOGE("Info: usb throwing error");
mkillPlayBackThread = true;
pfdUsbPlayback[0].revents = 0;
return;
@@ -1030,7 +1030,7 @@
}
void AudioUsbALSA::PlaybackThreadEntry() {
- LOGD("PlaybackThreadEntry");
+ ALOGD("PlaybackThreadEntry");
mnfdsPlayback = 2;
mtimeOut = TIMEOUT_INFINITE;
long frames;
@@ -1051,11 +1051,11 @@
filed = open(fn, O_WRONLY | O_CREAT | O_TRUNC | O_APPEND, 0664);
err = configureUsbDevice();
if (err) {
- LOGE("ERROR: configureUsbDevice failed, returning");
+ ALOGE("ERROR: configureUsbDevice failed, returning");
closeDevice(musbPlaybackHandle);
return;
} else {
- LOGD("USB Configured for playback");
+ ALOGD("USB Configured for playback");
}
if (!mkillPlayBackThread) {
@@ -1068,12 +1068,12 @@
err = configureProxyDevice();
if (err) {
- LOGE("ERROR: Could not configure Proxy, returning");
+ ALOGE("ERROR: Could not configure Proxy, returning");
closeDevice(musbPlaybackHandle);
closeDevice(mproxyPlaybackHandle);
return;
} else {
- LOGD("Proxy Configured for playback");
+ ALOGD("Proxy Configured for playback");
}
bufsize = mproxyPlaybackHandle->period_size;
@@ -1093,14 +1093,14 @@
while (mkillPlayBackThread != true) {
if (!mproxyPlaybackHandle->running) {
if (pcm_prepare(mproxyPlaybackHandle)) {
- LOGE("ERROR: pcm_prepare failed for proxy");
+ ALOGE("ERROR: pcm_prepare failed for proxy");
mkillPlayBackThread = true;
break;
}
}
if (!musbPlaybackHandle->running) {
if (pcm_prepare(musbPlaybackHandle)) {
- LOGE("ERROR: pcm_prepare failed for usb");
+ ALOGE("ERROR: pcm_prepare failed for usb");
mkillPlayBackThread = true;
break;
}
@@ -1120,7 +1120,7 @@
for (;;) {
if (!mproxyPlaybackHandle->running) {
if (pcm_prepare(mproxyPlaybackHandle)) {
- LOGE("ERROR: pcm_prepare failed for proxy");
+ ALOGE("ERROR: pcm_prepare failed for proxy");
mkillPlayBackThread = true;
break;
}
@@ -1165,7 +1165,7 @@
for (;;) {
if (!musbPlaybackHandle->running) {
if (pcm_prepare(musbPlaybackHandle)) {
- LOGE("ERROR: pcm_prepare failed for usb");
+ ALOGE("ERROR: pcm_prepare failed for usb");
mkillPlayBackThread = true;
break;
}
@@ -1181,7 +1181,7 @@
break;
}
avail = pcm_avail(musbPlaybackHandle);
- //LOGV("Avail USB is: %d", avail);
+ //ALOGV("Avail USB is: %d", avail);
}
if (avail < musbPlaybackHandle->sw_p->avail_min && !mkillPlayBackThread) {
@@ -1256,13 +1256,13 @@
closeDevice(mproxyPlaybackHandle);
closeDevice(musbPlaybackHandle);
}
- LOGD("Exiting USB Playback Thread");
+ ALOGD("Exiting USB Playback Thread");
}
void AudioUsbALSA::startPlayback()
{
mkillPlayBackThread = false;
- LOGD("Creating USB Playback Thread");
+ ALOGD("Creating USB Playback Thread");
pthread_create(&mPlaybackUsb, NULL, PlaybackThreadWrapper, this);
}
@@ -1270,7 +1270,7 @@
{
//create Thread
mkillRecordingThread = false;
- LOGV("Creating USB recording Thread");
+ ALOGV("Creating USB recording Thread");
pthread_create(&mRecordingUsb, NULL, RecordingThreadWrapper, this);
}
}
diff --git a/alsa_sound/acoustics_default.cpp b/alsa_sound/acoustics_default.cpp
index 6280979..c5aecac 100644
--- a/alsa_sound/acoustics_default.cpp
+++ b/alsa_sound/acoustics_default.cpp
@@ -35,7 +35,7 @@
open : s_device_open
};
-extern "C" const hw_module_t HAL_MODULE_INFO_SYM = {
+extern "C" hw_module_t HAL_MODULE_INFO_SYM = {
tag : HARDWARE_MODULE_TAG,
version_major : 1,
version_minor : 0,
diff --git a/alsa_sound/alsa_default.cpp b/alsa_sound/alsa_default.cpp
index dc3ad11..b876734 100644
--- a/alsa_sound/alsa_default.cpp
+++ b/alsa_sound/alsa_default.cpp
@@ -16,17 +16,19 @@
** limitations under the License.
*/
-#define LOG_TAG "ALSAModule"
+#define LOG_TAG "alsa.msm8960"
//#define LOG_NDEBUG 0
-#define LOG_NDDEBUG 0
#include <utils/Log.h>
+
#include <cutils/properties.h>
#include <linux/ioctl.h>
#include "AudioHardwareALSA.h"
#include <media/AudioRecord.h>
+#if 0
extern "C" {
#include "csd_client.h"
}
+#endif
#ifndef ALSA_DEFAULT_SAMPLE_RATE
#define ALSA_DEFAULT_SAMPLE_RATE 44100 // in Hz
@@ -80,7 +82,7 @@
open : s_device_open
};
-extern "C" const hw_module_t HAL_MODULE_INFO_SYM = {
+extern "C" hw_module_t HAL_MODULE_INFO_SYM = {
tag : HARDWARE_MODULE_TAG,
version_major : 1,
version_minor : 0,
@@ -144,7 +146,7 @@
}
strlcpy(curRxUCMDevice, "None", sizeof(curRxUCMDevice));
strlcpy(curTxUCMDevice, "None", sizeof(curTxUCMDevice));
- LOGD("ALSA module opened");
+ ALOGD("ALSA module opened");
return 0;
}
@@ -191,7 +193,7 @@
}
strlcat(ident, handle->useCase, sizeof(ident));
ret = snd_use_case_get(handle->ucMgr, ident, (const char **)value);
- LOGD("Device value returned is %s", (*value));
+ ALOGD("Device value returned is %s", (*value));
return ret;
}
@@ -207,19 +209,19 @@
params = (snd_pcm_hw_params*) calloc(1, sizeof(struct snd_pcm_hw_params));
if (!params) {
- LOGE("Failed to allocate ALSA hardware parameters!");
+ ALOGE("Failed to allocate ALSA hardware parameters!");
return NO_INIT;
}
reqBuffSize = handle->bufferSize;
- LOGD("setHardwareParams: reqBuffSize %d channels %d sampleRate %d",
+ ALOGD("setHardwareParams: reqBuffSize %d channels %d sampleRate %d",
(int) reqBuffSize, handle->channels, handle->sampleRate);
#ifdef SSR_ENABLED
if (channels == 6) {
if (!strncmp(handle->useCase, SND_USE_CASE_VERB_HIFI_REC, strlen(SND_USE_CASE_VERB_HIFI_REC))
|| !strncmp(handle->useCase, SND_USE_CASE_MOD_CAPTURE_MUSIC, strlen(SND_USE_CASE_MOD_CAPTURE_MUSIC))) {
- LOGV("HWParams: Use 4 channels in kernel for 5.1(%s) recording ", handle->useCase);
+ ALOGV("HWParams: Use 4 channels in kernel for 5.1(%s) recording ", handle->useCase);
channels = 4;
reqBuffSize = DEFAULT_IN_BUFFER_SIZE;
}
@@ -251,7 +253,7 @@
param_set_hw_refine(handle->handle, params);
if (param_set_hw_params(handle->handle, params)) {
- LOGE("cannot set hw params");
+ ALOGE("cannot set hw params");
return NO_INIT;
}
param_dump(params);
@@ -259,7 +261,7 @@
handle->handle->buffer_size = pcm_buffer_size(params);
handle->handle->period_size = pcm_period_size(params);
handle->handle->period_cnt = handle->handle->buffer_size/handle->handle->period_size;
- LOGD("setHardwareParams: buffer_size %d, period_size %d, period_cnt %d",
+ ALOGD("setHardwareParams: buffer_size %d, period_size %d, period_cnt %d",
handle->handle->buffer_size, handle->handle->period_size,
handle->handle->period_cnt);
handle->handle->rate = handle->sampleRate;
@@ -293,7 +295,7 @@
if (channels == 6) {
if (!strncmp(handle->useCase, SND_USE_CASE_VERB_HIFI_REC, strlen(SND_USE_CASE_VERB_HIFI_REC))
|| !strncmp(handle->useCase, SND_USE_CASE_MOD_CAPTURE_MUSIC, strlen(SND_USE_CASE_MOD_CAPTURE_MUSIC))) {
- LOGV("SWParams: Use 4 channels in kernel for 5.1(%s) recording ", handle->useCase);
+ ALOGV("SWParams: Use 4 channels in kernel for 5.1(%s) recording ", handle->useCase);
channels = 4;
}
}
@@ -304,7 +306,7 @@
params->period_step = 1;
if(((!strcmp(handle->useCase,SND_USE_CASE_MOD_PLAY_VOIP)) ||
(!strcmp(handle->useCase,SND_USE_CASE_VERB_IP_VOICECALL)))){
- LOGV("setparam: start & stop threshold for Voip ");
+ ALOGV("setparam: start & stop threshold for Voip ");
params->avail_min = handle->channels - 1 ? periodSize/4 : periodSize/2;
params->start_threshold = periodSize/2;
params->stop_threshold = INT_MAX;
@@ -317,7 +319,7 @@
params->silence_size = 0;
if (param_set_sw_params(handle->handle, params)) {
- LOGE("cannot set sw params");
+ ALOGE("cannot set sw params");
return NO_INIT;
}
return NO_ERROR;
@@ -332,7 +334,7 @@
char *rxDevice, *txDevice, ident[70], *use_case = NULL;
int err = 0, index, mods_size;
int rx_dev_id, tx_dev_id;
- LOGV("%s: device %d", __FUNCTION__, devices);
+ ALOGV("%s: device %d", __FUNCTION__, devices);
if ((mode == AudioSystem::MODE_IN_CALL) || (mode == AudioSystem::MODE_IN_COMMUNICATION)) {
if ((devices & AudioSystem::DEVICE_OUT_WIRED_HEADSET) ||
@@ -378,7 +380,7 @@
if ((devices & AudioSystem::DEVICE_IN_BUILTIN_MIC) && ( 6 == handle->channels)) {
if (!strncmp(handle->useCase, SND_USE_CASE_VERB_HIFI_REC, strlen(SND_USE_CASE_VERB_HIFI_REC))
|| !strncmp(handle->useCase, SND_USE_CASE_MOD_CAPTURE_MUSIC, strlen(SND_USE_CASE_MOD_CAPTURE_MUSIC))) {
- LOGV(" switchDevice , use ssr devices for channels:%d usecase:%s",handle->channels,handle->useCase);
+ ALOGV(" switchDevice , use ssr devices for channels:%d usecase:%s",handle->channels,handle->useCase);
s_set_flags(SSRQMIC_FLAG);
}
}
@@ -417,7 +419,7 @@
strlen(SND_USE_CASE_VERB_INACTIVE)))) {
usecase_type = getUseCaseType(use_case);
if (usecase_type & USECASE_TYPE_RX) {
- LOGD("Deroute use case %s type is %d\n", use_case, usecase_type);
+ ALOGD("Deroute use case %s type is %d\n", use_case, usecase_type);
strlcpy(useCaseNode.useCase, use_case, MAX_STR_LEN);
snd_use_case_set(handle->ucMgr, "_verb", SND_USE_CASE_VERB_INACTIVE);
mUseCaseList.push_front(useCaseNode);
@@ -427,7 +429,7 @@
for(index = 0; index < mods_size; index++) {
usecase_type = getUseCaseType(mods_list[index]);
if (usecase_type & USECASE_TYPE_RX) {
- LOGD("Deroute use case %s type is %d\n", mods_list[index], usecase_type);
+ ALOGD("Deroute use case %s type is %d\n", mods_list[index], usecase_type);
strlcpy(useCaseNode.useCase, mods_list[index], MAX_STR_LEN);
snd_use_case_set(handle->ucMgr, "_dismod", mods_list[index]);
mUseCaseList.push_back(useCaseNode);
@@ -444,7 +446,7 @@
strlen(SND_USE_CASE_VERB_INACTIVE)))) {
usecase_type = getUseCaseType(use_case);
if ((usecase_type & USECASE_TYPE_TX) && (!(usecase_type & USECASE_TYPE_RX))) {
- LOGD("Deroute use case %s type is %d\n", use_case, usecase_type);
+ ALOGD("Deroute use case %s type is %d\n", use_case, usecase_type);
strlcpy(useCaseNode.useCase, use_case, MAX_STR_LEN);
snd_use_case_set(handle->ucMgr, "_verb", SND_USE_CASE_VERB_INACTIVE);
mUseCaseList.push_front(useCaseNode);
@@ -454,7 +456,7 @@
for(index = 0; index < mods_size; index++) {
usecase_type = getUseCaseType(mods_list[index]);
if ((usecase_type & USECASE_TYPE_TX) && (!(usecase_type & USECASE_TYPE_RX))) {
- LOGD("Deroute use case %s type is %d\n", mods_list[index], usecase_type);
+ ALOGD("Deroute use case %s type is %d\n", mods_list[index], usecase_type);
strlcpy(useCaseNode.useCase, mods_list[index], MAX_STR_LEN);
snd_use_case_set(handle->ucMgr, "_dismod", mods_list[index]);
mUseCaseList.push_back(useCaseNode);
@@ -464,13 +466,13 @@
snd_use_case_set(handle->ucMgr, "_disdev", curTxUCMDevice);
}
}
- LOGV("%s,rxDev:%s, txDev:%s, curRxDev:%s, curTxDev:%s\n", __FUNCTION__, rxDevice, txDevice, curRxUCMDevice, curTxUCMDevice);
+ ALOGV("%s,rxDev:%s, txDev:%s, curRxDev:%s, curTxDev:%s\n", __FUNCTION__, rxDevice, txDevice, curRxUCMDevice, curTxUCMDevice);
#if 0
if (mode == AudioSystem::MODE_IN_CALL && platform_is_Fusion3() && (inCallDevSwitch == true)) {
err = csd_client_disable_device();
if (err < 0)
{
- LOGE("csd_client_disable_device, failed, error %d", err);
+ ALOGE("csd_client_disable_device, failed, error %d", err);
}
}
#endif
@@ -488,7 +490,7 @@
strlcpy(curTxUCMDevice, txDevice, sizeof(curTxUCMDevice));
}
for(ALSAUseCaseList::iterator it = mUseCaseList.begin(); it != mUseCaseList.end(); ++it) {
- LOGD("Route use case %s\n", it->useCase);
+ ALOGD("Route use case %s\n", it->useCase);
if ((use_case != NULL) && (strncmp(use_case, SND_USE_CASE_VERB_INACTIVE,
strlen(SND_USE_CASE_VERB_INACTIVE))) && (!strncmp(use_case, it->useCase, MAX_UC_LEN))) {
snd_use_case_set(handle->ucMgr, "_verb", it->useCase);
@@ -502,7 +504,7 @@
free(use_case);
use_case = NULL;
}
- LOGD("switchDevice: curTxUCMDevivce %s curRxDevDevice %s", curTxUCMDevice, curRxUCMDevice);
+ ALOGD("switchDevice: curTxUCMDevivce %s curRxDevDevice %s", curTxUCMDevice, curRxUCMDevice);
if (mode == AudioSystem::MODE_IN_CALL && platform_is_Fusion3() && (inCallDevSwitch == true)) {
/* get tx acdb id */
@@ -521,12 +523,14 @@
tx_dev_id = DEVICE_SPEAKER_TX_ACDB_ID;
}
- LOGV("rx_dev_id=%d, tx_dev_id=%d\n", rx_dev_id, tx_dev_id);
+#if 0
+ ALOGV("rx_dev_id=%d, tx_dev_id=%d\n", rx_dev_id, tx_dev_id);
err = csd_client_enable_device(rx_dev_id, tx_dev_id, mDevSettingsFlag);
if (err < 0)
{
- LOGE("csd_client_disable_device failed, error %d", err);
+ ALOGE("csd_client_disable_device failed, error %d", err);
}
+#endif
}
if (rxDevice != NULL) {
@@ -557,7 +561,7 @@
static status_t s_init(alsa_device_t *module, ALSAHandleList &list)
{
- LOGD("s_init: Initializing devices for ALSA module");
+ ALOGD("s_init: Initializing devices for ALSA module");
list.clear();
@@ -573,13 +577,13 @@
/* No need to call s_close for LPA as pcm device open and close is handled by LPAPlayer in stagefright */
if((!strcmp(handle->useCase, SND_USE_CASE_VERB_HIFI_LOW_POWER)) || (!strcmp(handle->useCase, SND_USE_CASE_MOD_PLAY_LPA))
||(!strcmp(handle->useCase, SND_USE_CASE_VERB_HIFI_TUNNEL)) || (!strcmp(handle->useCase, SND_USE_CASE_MOD_PLAY_TUNNEL))) {
- LOGD("s_open: Opening LPA /Tunnel playback");
+ ALOGD("s_open: Opening LPA /Tunnel playback");
return NO_ERROR;
}
s_close(handle);
- LOGD("s_open: handle %p", handle);
+ ALOGD("s_open: handle %p", handle);
// ASoC multicomponent requires a valid path (frontend/backend) for
// the device to be opened
@@ -612,18 +616,18 @@
flags |= PCM_STEREO;
}
if (deviceName(handle, flags, &devName) < 0) {
- LOGE("Failed to get pcm device node: %s", devName);
+ ALOGE("Failed to get pcm device node: %s", devName);
return NO_INIT;
}
if (devName != NULL) {
handle->handle = pcm_open(flags, (char*)devName);
} else {
- LOGE("Failed to get pcm device node");
+ ALOGE("Failed to get pcm device node");
return NO_INIT;
}
if (!handle->handle) {
- LOGE("s_open: Failed to initialize ALSA device '%s'", devName);
+ ALOGE("s_open: Failed to initialize ALSA device '%s'", devName);
free(devName);
return NO_INIT;
}
@@ -636,7 +640,7 @@
}
if(err != NO_ERROR) {
- LOGE("Set HW/SW params failed: Closing the pcm stream");
+ ALOGE("Set HW/SW params failed: Closing the pcm stream");
s_standby(handle);
}
@@ -656,28 +660,28 @@
s_close(handle);
flags = PCM_OUT;
flags |= PCM_MONO;
- LOGV("s_open:s_start_voip_call handle %p", handle);
+ ALOGV("s_open:s_start_voip_call handle %p", handle);
if (deviceName(handle, flags, &devName) < 0) {
- LOGE("Failed to get pcm device node");
+ ALOGE("Failed to get pcm device node");
return NO_INIT;
}
if (devName != NULL) {
handle->handle = pcm_open(flags, (char*)devName);
} else {
- LOGE("Failed to get pcm device node");
+ ALOGE("Failed to get pcm device node");
return NO_INIT;
}
if (!handle->handle) {
free(devName);
- LOGE("s_open: Failed to initialize ALSA device '%s'", devName);
+ ALOGE("s_open: Failed to initialize ALSA device '%s'", devName);
return NO_INIT;
}
if (!pcm_ready(handle->handle)) {
- LOGE(" pcm ready failed");
+ ALOGE(" pcm ready failed");
}
handle->handle->flags = flags;
@@ -689,7 +693,7 @@
err = pcm_prepare(handle->handle);
if(err != NO_ERROR) {
- LOGE("DEVICE_OUT_DIRECTOUTPUT: pcm_prepare failed");
+ ALOGE("DEVICE_OUT_DIRECTOUTPUT: pcm_prepare failed");
}
/* first write required start dsp */
@@ -697,30 +701,30 @@
pcm_write(handle->handle,&voc_pkt,handle->handle->period_size);
handle->rxHandle = handle->handle;
free(devName);
- LOGV("s_open: DEVICE_IN_COMMUNICATION ");
+ ALOGV("s_open: DEVICE_IN_COMMUNICATION ");
flags = PCM_IN;
flags |= PCM_MONO;
handle->handle = 0;
if (deviceName(handle, flags, &devName1) < 0) {
- LOGE("Failed to get pcm device node");
+ ALOGE("Failed to get pcm device node");
return NO_INIT;
}
if (devName != NULL) {
handle->handle = pcm_open(flags, (char*)devName1);
} else {
- LOGE("Failed to get pcm device node");
+ ALOGE("Failed to get pcm device node");
return NO_INIT;
}
if (!handle->handle) {
free(devName);
- LOGE("s_open: Failed to initialize ALSA device '%s'", devName);
+ ALOGE("s_open: Failed to initialize ALSA device '%s'", devName);
return NO_INIT;
}
if (!pcm_ready(handle->handle)) {
- LOGE(" pcm ready in failed");
+ ALOGE(" pcm ready in failed");
}
handle->handle->flags = flags;
@@ -734,7 +738,7 @@
err = pcm_prepare(handle->handle);
if(err != NO_ERROR) {
- LOGE("DEVICE_IN_COMMUNICATION: pcm_prepare failed");
+ ALOGE("DEVICE_IN_COMMUNICATION: pcm_prepare failed");
}
/* first read required start dsp */
@@ -749,47 +753,47 @@
unsigned flags = 0;
int err = NO_ERROR;
- LOGD("s_start_voice_call: handle %p", handle);
+ ALOGD("s_start_voice_call: handle %p", handle);
// ASoC multicomponent requires a valid path (frontend/backend) for
// the device to be opened
flags = PCM_OUT | PCM_MONO;
if (deviceName(handle, flags, &devName) < 0) {
- LOGE("Failed to get pcm device node");
+ ALOGE("Failed to get pcm device node");
return NO_INIT;
}
if (devName != NULL) {
handle->handle = pcm_open(flags, (char*)devName);
} else {
- LOGE("Failed to get pcm device node");
+ ALOGE("Failed to get pcm device node");
return NO_INIT;
}
if (!handle->handle) {
- LOGE("s_start_voicecall: could not open PCM device");
+ ALOGE("s_start_voicecall: could not open PCM device");
goto Error;
}
handle->handle->flags = flags;
err = setHardwareParams(handle);
if(err != NO_ERROR) {
- LOGE("s_start_voice_call: setHardwareParams failed");
+ ALOGE("s_start_voice_call: setHardwareParams failed");
goto Error;
}
err = setSoftwareParams(handle);
if(err != NO_ERROR) {
- LOGE("s_start_voice_call: setSoftwareParams failed");
+ ALOGE("s_start_voice_call: setSoftwareParams failed");
goto Error;
}
err = pcm_prepare(handle->handle);
if(err != NO_ERROR) {
- LOGE("s_start_voice_call: pcm_prepare failed");
+ ALOGE("s_start_voice_call: pcm_prepare failed");
goto Error;
}
if (ioctl(handle->handle->fd, SNDRV_PCM_IOCTL_START)) {
- LOGE("s_start_voice_call:SNDRV_PCM_IOCTL_START failed\n");
+ ALOGE("s_start_voice_call:SNDRV_PCM_IOCTL_START failed\n");
goto Error;
}
@@ -800,13 +804,13 @@
// Open PCM capture device
flags = PCM_IN | PCM_MONO;
if (deviceName(handle, flags, &devName) < 0) {
- LOGE("Failed to get pcm device node");
+ ALOGE("Failed to get pcm device node");
goto Error;
}
if (devName != NULL) {
handle->handle = pcm_open(flags, (char*)devName);
} else {
- LOGE("Failed to get pcm device node");
+ ALOGE("Failed to get pcm device node");
return NO_INIT;
}
if (!handle->handle) {
@@ -817,40 +821,42 @@
handle->handle->flags = flags;
err = setHardwareParams(handle);
if(err != NO_ERROR) {
- LOGE("s_start_voice_call: setHardwareParams failed");
+ ALOGE("s_start_voice_call: setHardwareParams failed");
goto Error;
}
err = setSoftwareParams(handle);
if(err != NO_ERROR) {
- LOGE("s_start_voice_call: setSoftwareParams failed");
+ ALOGE("s_start_voice_call: setSoftwareParams failed");
goto Error;
}
err = pcm_prepare(handle->handle);
if(err != NO_ERROR) {
- LOGE("s_start_voice_call: pcm_prepare failed");
+ ALOGE("s_start_voice_call: pcm_prepare failed");
goto Error;
}
if (ioctl(handle->handle->fd, SNDRV_PCM_IOCTL_START)) {
- LOGE("s_start_voice_call:SNDRV_PCM_IOCTL_START failed\n");
+ ALOGE("s_start_voice_call:SNDRV_PCM_IOCTL_START failed\n");
goto Error;
}
if (platform_is_Fusion3()) {
+#if 0
err = csd_client_start_voice();
if (err < 0) {
- LOGE("s_start_voice_call: csd_client error %d\n", err);
+ ALOGE("s_start_voice_call: csd_client error %d\n", err);
goto Error;
}
+#endif
}
free(devName);
return NO_ERROR;
Error:
- LOGE("s_start_voice_call: Failed to initialize ALSA device '%s'", devName);
+ ALOGE("s_start_voice_call: Failed to initialize ALSA device '%s'", devName);
free(devName);
s_close(handle);
return NO_INIT;
@@ -862,48 +868,48 @@
unsigned flags = 0;
int err = NO_ERROR;
- LOGE("s_start_fm: handle %p", handle);
+ ALOGE("s_start_fm: handle %p", handle);
// ASoC multicomponent requires a valid path (frontend/backend) for
// the device to be opened
flags = PCM_OUT | PCM_STEREO;
if (deviceName(handle, flags, &devName) < 0) {
- LOGE("Failed to get pcm device node");
+ ALOGE("Failed to get pcm device node");
goto Error;
}
if (devName != NULL) {
handle->handle = pcm_open(flags, (char*)devName);
} else {
- LOGE("Failed to get pcm device node");
+ ALOGE("Failed to get pcm device node");
return NO_INIT;
}
if (!handle->handle) {
- LOGE("s_start_fm: could not open PCM device");
+ ALOGE("s_start_fm: could not open PCM device");
goto Error;
}
handle->handle->flags = flags;
err = setHardwareParams(handle);
if(err != NO_ERROR) {
- LOGE("s_start_fm: setHardwareParams failed");
+ ALOGE("s_start_fm: setHardwareParams failed");
goto Error;
}
err = setSoftwareParams(handle);
if(err != NO_ERROR) {
- LOGE("s_start_fm: setSoftwareParams failed");
+ ALOGE("s_start_fm: setSoftwareParams failed");
goto Error;
}
err = pcm_prepare(handle->handle);
if(err != NO_ERROR) {
- LOGE("s_start_fm: setSoftwareParams failed");
+ ALOGE("s_start_fm: setSoftwareParams failed");
goto Error;
}
if (ioctl(handle->handle->fd, SNDRV_PCM_IOCTL_START)) {
- LOGE("s_start_fm: SNDRV_PCM_IOCTL_START failed\n");
+ ALOGE("s_start_fm: SNDRV_PCM_IOCTL_START failed\n");
goto Error;
}
@@ -914,13 +920,13 @@
// Open PCM capture device
flags = PCM_IN | PCM_STEREO;
if (deviceName(handle, flags, &devName) < 0) {
- LOGE("Failed to get pcm device node");
+ ALOGE("Failed to get pcm device node");
goto Error;
}
if (devName != NULL) {
handle->handle = pcm_open(flags, (char*)devName);
} else {
- LOGE("Failed to get pcm device node");
+ ALOGE("Failed to get pcm device node");
return NO_INIT;
}
if (!handle->handle) {
@@ -930,24 +936,24 @@
handle->handle->flags = flags;
err = setHardwareParams(handle);
if(err != NO_ERROR) {
- LOGE("s_start_fm: setHardwareParams failed");
+ ALOGE("s_start_fm: setHardwareParams failed");
goto Error;
}
err = setSoftwareParams(handle);
if(err != NO_ERROR) {
- LOGE("s_start_fm: setSoftwareParams failed");
+ ALOGE("s_start_fm: setSoftwareParams failed");
goto Error;
}
err = pcm_prepare(handle->handle);
if(err != NO_ERROR) {
- LOGE("s_start_fm: pcm_prepare failed");
+ ALOGE("s_start_fm: pcm_prepare failed");
goto Error;
}
if (ioctl(handle->handle->fd, SNDRV_PCM_IOCTL_START)) {
- LOGE("s_start_fm: SNDRV_PCM_IOCTL_START failed\n");
+ ALOGE("s_start_fm: SNDRV_PCM_IOCTL_START failed\n");
goto Error;
}
@@ -987,7 +993,7 @@
status_t err = NO_ERROR;
if(!handle->handle) {
- LOGE("No active PCM driver to start");
+ ALOGE("No active PCM driver to start");
return err;
}
@@ -1003,12 +1009,12 @@
struct pcm *h = handle->rxHandle;
handle->rxHandle = 0;
- LOGD("s_close: handle %p h %p", handle, h);
+ ALOGD("s_close: handle %p h %p", handle, h);
if (h) {
- LOGV("s_close rxHandle\n");
+ ALOGV("s_close rxHandle\n");
err = pcm_close(h);
if(err != NO_ERROR) {
- LOGE("s_close: pcm_close failed for rxHandle with err %d", err);
+ ALOGE("s_close: pcm_close failed for rxHandle with err %d", err);
}
}
@@ -1016,19 +1022,21 @@
handle->handle = 0;
if (h) {
- LOGV("s_close handle h %p\n", h);
+ ALOGV("s_close handle h %p\n", h);
err = pcm_close(h);
if(err != NO_ERROR) {
- LOGE("s_close: pcm_close failed for handle with err %d", err);
+ ALOGE("s_close: pcm_close failed for handle with err %d", err);
}
if ((!strcmp(handle->useCase, SND_USE_CASE_VERB_VOICECALL) ||
!strcmp(handle->useCase, SND_USE_CASE_MOD_PLAY_VOICE)) &&
platform_is_Fusion3()) {
+#if 0
err = csd_client_stop_voice();
if (err < 0) {
- LOGE("s_close: csd_client error %d\n", err);
+ ALOGE("s_close: csd_client error %d\n", err);
}
+#endif
}
disableDevice(handle);
@@ -1054,12 +1062,12 @@
status_t err = NO_ERROR;
struct pcm *h = handle->rxHandle;
handle->rxHandle = 0;
- LOGD("s_standby: handle %p h %p", handle, h);
+ ALOGD("s_standby: handle %p h %p", handle, h);
if (h) {
- LOGE("s_standby rxHandle\n");
+ ALOGE("s_standby rxHandle\n");
err = pcm_close(h);
if(err != NO_ERROR) {
- LOGE("s_standby: pcm_close failed for rxHandle with err %d", err);
+ ALOGE("s_standby: pcm_close failed for rxHandle with err %d", err);
}
}
@@ -1067,10 +1075,10 @@
handle->handle = 0;
if (h) {
- LOGE("s_standby handle h %p\n", h);
+ ALOGE("s_standby handle h %p\n", h);
err = pcm_close(h);
if(err != NO_ERROR) {
- LOGE("s_standby: pcm_close failed for handle with err %d", err);
+ ALOGE("s_standby: pcm_close failed for handle with err %d", err);
}
disableDevice(handle);
} else if((!strcmp(handle->useCase, SND_USE_CASE_VERB_HIFI_LOW_POWER)) ||
@@ -1087,7 +1095,7 @@
{
status_t status = NO_ERROR;
- LOGD("s_route: devices 0x%x in mode %d", devices, mode);
+ ALOGD("s_route: devices 0x%x in mode %d", devices, mode);
callMode = mode;
switchDevice(handle, devices, mode);
return status;
@@ -1095,7 +1103,7 @@
int getUseCaseType(const char *useCase)
{
- LOGE("use case is %s\n", useCase);
+ ALOGE("use case is %s\n", useCase);
if (!strncmp(useCase, SND_USE_CASE_VERB_HIFI,
strlen(SND_USE_CASE_VERB_HIFI)) ||
!strncmp(useCase, SND_USE_CASE_VERB_HIFI_LOW_POWER,
@@ -1150,7 +1158,7 @@
strlen(SND_USE_CASE_MOD_PLAY_VOLTE))) {
return (USECASE_TYPE_RX | USECASE_TYPE_TX);
} else {
- LOGE("unknown use case %s\n", useCase);
+ ALOGE("unknown use case %s\n", useCase);
return 0;
}
}
@@ -1175,20 +1183,20 @@
strlen(SND_USE_CASE_VERB_INACTIVE)))
usecase_type |= getUseCaseType(useCase);
mods_size = snd_use_case_get_list(handle->ucMgr, "_enamods", &mods_list);
- LOGE("Number of modifiers %d\n", mods_size);
+ ALOGE("Number of modifiers %d\n", mods_size);
if (mods_size) {
for(i = 0; i < mods_size; i++) {
- LOGE("index %d modifier %s\n", i, mods_list[i]);
+ ALOGE("index %d modifier %s\n", i, mods_list[i]);
usecase_type |= getUseCaseType(mods_list[i]);
}
}
- LOGE("usecase_type is %d\n", usecase_type);
+ ALOGE("usecase_type is %d\n", usecase_type);
if (!(usecase_type & USECASE_TYPE_TX) && (strncmp(curTxUCMDevice, "None", 4)))
snd_use_case_set(handle->ucMgr, "_disdev", curTxUCMDevice);
if (!(usecase_type & USECASE_TYPE_RX) && (strncmp(curRxUCMDevice, "None", 4)))
snd_use_case_set(handle->ucMgr, "_disdev", curRxUCMDevice);
} else {
- LOGE("Invalid state, no valid use case found to disable");
+ ALOGE("Invalid state, no valid use case found to disable");
}
free(useCase);
}
@@ -1275,7 +1283,7 @@
} else if (devices & AudioSystem::DEVICE_OUT_DEFAULT) {
return strdup(SND_USE_CASE_DEV_SPEAKER); /* SPEAKER RX */
} else {
- LOGD("No valid output device: %u", devices);
+ ALOGD("No valid output device: %u", devices);
}
} else {
if (!(mDevSettingsFlag & TTY_OFF) &&
@@ -1289,11 +1297,15 @@
} else if (mDevSettingsFlag & TTY_FULL) {
return strdup(SND_USE_CASE_DEV_TTY_FULL_TX);
} else if (mDevSettingsFlag & TTY_VCO) {
+#if 0
if (!strncmp(mic_type, "analog", 6)) {
- return strdup(SND_USE_CASE_DEV_TTY_HANDSET_ANALOG_TX);
+ return strdup(SND_USE_CASE_DEV_TTY_HANDSET_ANAALOG_TX);
} else {
return strdup(SND_USE_CASE_DEV_TTY_HANDSET_TX);
}
+#else
+ return strdup(SND_USE_CASE_DEV_TTY_HANDSET_TX);
+#endif
}
} else if (devices & AudioSystem::DEVICE_IN_BUILTIN_MIC) {
if (!strncmp(mic_type, "analog", 6)) {
@@ -1322,7 +1334,7 @@
}
#ifdef SSR_ENABLED
else if (mDevSettingsFlag & SSRQMIC_FLAG){
- LOGV("return SSRQMIC_FLAG: 0x%x devices:0x%x",mDevSettingsFlag,devices);
+ ALOGV("return SSRQMIC_FLAG: 0x%x devices:0x%x",mDevSettingsFlag,devices);
// Mapping for quad mic input device.
return strdup(SND_USE_CASE_DEV_SSR_QUAD_MIC); /* SSR Quad MIC */
}
@@ -1366,14 +1378,14 @@
#endif
} else if ((devices & AudioSystem::DEVICE_IN_AMBIENT) ||
(devices & AudioSystem::DEVICE_IN_BACK_MIC)) {
- LOGI("No proper mapping found with UCM device list, setting default");
+ ALOGI("No proper mapping found with UCM device list, setting default");
if (!strncmp(mic_type, "analog", 6)) {
return strdup(SND_USE_CASE_DEV_HANDSET); /* HANDSET TX */
} else {
return strdup(SND_USE_CASE_DEV_LINE); /* BUILTIN-MIC TX */
}
} else {
- LOGD("No valid input device: %u", devices);
+ ALOGD("No valid input device: %u", devices);
}
}
return NULL;
@@ -1382,21 +1394,23 @@
void s_set_voice_volume(int vol)
{
int err = 0;
- LOGD("s_set_voice_volume: volume %d", vol);
+ ALOGD("s_set_voice_volume: volume %d", vol);
ALSAControl control("/dev/snd/controlC0");
control.set("Voice Rx Volume", vol, 0);
if (platform_is_Fusion3()) {
+#if 0
err = csd_client_volume(vol);
if (err < 0) {
- LOGE("s_set_voice_volume: csd_client error %d", err);
+ ALOGE("s_set_voice_volume: csd_client error %d", err);
}
+#endif
}
}
void s_set_volte_volume(int vol)
{
- LOGD("s_set_volte_volume: volume %d", vol);
+ ALOGD("s_set_volte_volume: volume %d", vol);
ALSAControl control("/dev/snd/controlC0");
control.set("VoLTE Rx Volume", vol, 0);
}
@@ -1404,41 +1418,43 @@
void s_set_voip_volume(int vol)
{
- LOGD("s_set_voip_volume: volume %d", vol);
+ ALOGD("s_set_voip_volume: volume %d", vol);
ALSAControl control("/dev/snd/controlC0");
control.set("Voip Rx Volume", vol, 0);
}
void s_set_mic_mute(int state)
{
int err = 0;
- LOGD("s_set_mic_mute: state %d", state);
+ ALOGD("s_set_mic_mute: state %d", state);
ALSAControl control("/dev/snd/controlC0");
control.set("Voice Tx Mute", state, 0);
if (platform_is_Fusion3()) {
+#if 0
err = csd_client_mic_mute(state);
if (err < 0) {
- LOGE("s_set_mic_mute: csd_client error %d", err);
+ ALOGE("s_set_mic_mute: csd_client error %d", err);
}
+#endif
}
}
void s_set_volte_mic_mute(int state)
{
- LOGD("s_set_volte_mic_mute: state %d", state);
+ ALOGD("s_set_volte_mic_mute: state %d", state);
ALSAControl control("/dev/snd/controlC0");
control.set("VoLTE Tx Mute", state, 0);
}
void s_set_voip_mic_mute(int state)
{
- LOGD("s_set_voip_mic_mute: state %d", state);
+ ALOGD("s_set_voip_mic_mute: state %d", state);
ALSAControl control("/dev/snd/controlC0");
control.set("Voip Tx Mute", state, 0);
}
void s_set_voip_config(int mode, int rate)
{
- LOGD("s_set_voip_config: mode %d,rate %d", mode, rate);
+ ALOGD("s_set_voip_config: mode %d,rate %d", mode, rate);
ALSAControl control("/dev/snd/controlC0");
char** setValues;
setValues = (char**)malloc(2*sizeof(char*));
@@ -1477,7 +1493,7 @@
{
int err = 0;
- LOGD("s_enable_wide_voice: flag %d", flag);
+ ALOGD("s_enable_wide_voice: flag %d", flag);
ALSAControl control("/dev/snd/controlC0");
if(flag == true) {
control.set("Widevoice Enable", 1, 0);
@@ -1486,16 +1502,18 @@
}
if (platform_is_Fusion3()) {
+#if 0
err == csd_client_wide_voice(flag);
if (err < 0) {
- LOGE("s_enable_wide_voice: csd_client error %d", err);
+ ALOGE("s_enable_wide_voice: csd_client error %d", err);
}
+#endif
}
}
void s_set_voc_rec_mode(uint8_t mode)
{
- LOGD("s_set_voc_rec_mode: mode %d", mode);
+ ALOGD("s_set_voc_rec_mode: mode %d", mode);
ALSAControl control("/dev/snd/controlC0");
control.set("Incall Rec Mode", mode, 0);
}
@@ -1504,7 +1522,7 @@
{
int err = 0;
- LOGD("s_enable_fens: flag %d", flag);
+ ALOGD("s_enable_fens: flag %d", flag);
ALSAControl control("/dev/snd/controlC0");
if(flag == true) {
control.set("FENS Enable", 1, 0);
@@ -1513,10 +1531,12 @@
}
if (platform_is_Fusion3()) {
+#if 0
err = csd_client_fens(flag);
if (err < 0) {
- LOGE("s_enable_fens: csd_client error %d", err);
+ ALOGE("s_enable_fens: csd_client error %d", err);
}
+#endif
}
}
@@ -1524,7 +1544,7 @@
{
int err = 0;
- LOGD("s_enable_slow_talk: flag %d", flag);
+ ALOGD("s_enable_slow_talk: flag %d", flag);
ALSAControl control("/dev/snd/controlC0");
if(flag == true) {
control.set("Slowtalk Enable", 1, 0);
@@ -1533,16 +1553,18 @@
}
if (platform_is_Fusion3()) {
+#if 0
err = csd_client_slow_talk(flag);
if (err < 0) {
- LOGE("s_enable_slow_talk: csd_client error %d", err);
+ ALOGE("s_enable_slow_talk: csd_client error %d", err);
}
+#endif
}
}
void s_set_flags(uint32_t flags)
{
- LOGV("s_set_flags: flags %d", flags);
+ ALOGV("s_set_flags: flags %d", flags);
mDevSettingsFlag = flags;
}
diff --git a/alsa_sound/audio_hw_hal.cpp b/alsa_sound/audio_hw_hal.cpp
index ab4f415..58fd7d3 100644
--- a/alsa_sound/audio_hw_hal.cpp
+++ b/alsa_sound/audio_hw_hal.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-#define LOG_TAG "qcom_audio_hw_hal"
+#define LOG_TAG "audio.primary.msm8960"
//#define LOG_NDEBUG 0
#include <stdint.h>
@@ -66,7 +66,7 @@
struct qcom_stream_out *out =
reinterpret_cast<struct qcom_stream_out *>(stream);
- LOGE("(%s:%d) %s: Implement me!", __FILE__, __LINE__, __func__);
+ ALOGE("(%s:%d) %s: Implement me!", __FILE__, __LINE__, __func__);
/* TODO: implement this */
return 0;
}
@@ -89,14 +89,14 @@
{
const struct qcom_stream_out *out =
reinterpret_cast<const struct qcom_stream_out *>(stream);
- return out->qcom_out->format();
+ return (audio_format_t)out->qcom_out->format();
}
static int out_set_format(struct audio_stream *stream, audio_format_t format)
{
struct qcom_stream_out *out =
reinterpret_cast<struct qcom_stream_out *>(stream);
- LOGE("(%s:%d) %s: Implement me!", __FILE__, __LINE__, __func__);
+ ALOGE("(%s:%d) %s: Implement me!", __FILE__, __LINE__, __func__);
/* TODO: implement me */
return 0;
}
@@ -192,7 +192,7 @@
struct qcom_stream_in *in =
reinterpret_cast<struct qcom_stream_in *>(stream);
- LOGE("(%s:%d) %s: Implement me!", __FILE__, __LINE__, __func__);
+ ALOGE("(%s:%d) %s: Implement me!", __FILE__, __LINE__, __func__);
/* TODO: implement this */
return 0;
}
@@ -215,14 +215,14 @@
{
const struct qcom_stream_in *in =
reinterpret_cast<const struct qcom_stream_in *>(stream);
- return in->qcom_in->format();
+ return (audio_format_t)in->qcom_in->format();
}
static int in_set_format(struct audio_stream *stream, audio_format_t format)
{
struct qcom_stream_in *in =
reinterpret_cast<struct qcom_stream_in *>(stream);
- LOGE("(%s:%d) %s: Implement me!", __FILE__, __LINE__, __func__);
+ ALOGE("(%s:%d) %s: Implement me!", __FILE__, __LINE__, __func__);
/* TODO: implement me */
return 0;
}
@@ -319,14 +319,14 @@
AUDIO_DEVICE_OUT_WIRED_HEADPHONE |
AUDIO_DEVICE_OUT_AUX_DIGITAL |
AUDIO_DEVICE_OUT_ALL_SCO |
- AUDIO_DEVICE_OUT_ANC_HEADSET |
+// AUDIO_DEVICE_OUT_ANC_HEADSET |
AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET |
AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET |
- AUDIO_DEVICE_OUT_ANC_HEADPHONE |
- AUDIO_DEVICE_OUT_FM |
- AUDIO_DEVICE_OUT_FM_TX |
- AUDIO_DEVICE_OUT_DIRECTOUTPUT |
- AUDIO_DEVICE_OUT_PROXY |
+// AUDIO_DEVICE_OUT_ANC_HEADPHONE |
+// AUDIO_DEVICE_OUT_FM |
+// AUDIO_DEVICE_OUT_FM_TX |
+// AUDIO_DEVICE_OUT_DIRECTOUTPUT |
+// AUDIO_DEVICE_OUT_PROXY |
AUDIO_DEVICE_OUT_DEFAULT |
/* IN */
AUDIO_DEVICE_IN_VOICE_CALL |
@@ -337,9 +337,9 @@
AUDIO_DEVICE_IN_AUX_DIGITAL |
AUDIO_DEVICE_IN_BACK_MIC |
AUDIO_DEVICE_IN_ALL_SCO |
- AUDIO_DEVICE_IN_ANC_HEADSET |
- AUDIO_DEVICE_IN_FM_RX |
- AUDIO_DEVICE_IN_FM_RX_A2DP |
+// AUDIO_DEVICE_IN_ANC_HEADSET |
+// AUDIO_DEVICE_IN_FM_RX |
+// AUDIO_DEVICE_IN_FM_RX_A2DP |
AUDIO_DEVICE_IN_DEFAULT);
}
@@ -364,7 +364,8 @@
static int adev_get_master_volume(struct audio_hw_device *dev, float *volume) {
- return -ENOSYS;
+ struct qcom_audio_device *qadev = to_ladev(dev);
+ return qadev->hwif->getMasterVolume(volume);
}
#ifdef QUALCOMM_FEATURES_ENABLED
static int adev_set_fm_volume(struct audio_hw_device *dev, float volume)
@@ -412,7 +413,7 @@
const struct audio_config *config)
{
const struct qcom_audio_device *qadev = to_cladev(dev);
- return qadev->hwif->getInputBufferSize(sample_rate, format, channel_count);
+ return qadev->hwif->getInputBufferSize(config->sample_rate, config->format, config->channel_mask);
}
#ifdef QUALCOMM_FEATURES_ENABLED
@@ -469,8 +470,11 @@
if (!out)
return -ENOMEM;
- out->qcom_out = qadev->hwif->openOutputStream(devices, config->format, config->channels_mask,
- config->sample_rate, &status);
+ out->qcom_out = qadev->hwif->openOutputStream(devices,
+ (int *)&config->format,
+ &config->channel_mask,
+ &config->sample_rate,
+ &status);
if (!out->qcom_out) {
ret = status;
goto err_open;
@@ -529,9 +533,11 @@
if (!in)
return -ENOMEM;
- in->qcom_in = qadev->hwif->openInputStream(devices, config->format, config->channels_mask,
- config->sample_rate, &status,
- (AudioSystem::audio_in_acoustics)acoustics);
+ in->qcom_in = qadev->hwif->openInputStream(devices, (int *)&config->format,
+ &config->channel_mask,
+ &config->sample_rate,
+ &status,
+ (AudioSystem::audio_in_acoustics)0);
if (!in->qcom_in) {
ret = status;
goto err_open;
diff --git a/alsa_sound/audio_policy_hal.cpp b/alsa_sound/audio_policy_hal.cpp
index a16e2cb..7c05fab 100644
--- a/alsa_sound/audio_policy_hal.cpp
+++ b/alsa_sound/audio_policy_hal.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define LOG_TAG "qcom_audio_policy_hal"
+#define LOG_TAG "audio_policy.msm8960"
//#define LOG_NDEBUG 0
#include <stdint.h>
@@ -94,8 +94,10 @@
static void ap_set_ringer_mode(struct audio_policy *pol, uint32_t mode,
uint32_t mask)
{
+#if 0
struct qcom_audio_policy *qap = to_qap(pol);
qap->apm->setRingerMode(mode, mask);
+#endif
}
/* force using a specific device category for the specified usage */
@@ -144,7 +146,7 @@
{
struct qcom_audio_policy *qap = to_qap(pol);
- LOGV("%s: tid %d", __func__, gettid());
+ ALOGV("%s: tid %d", __func__, gettid());
return qap->apm->getSession((AudioSystem::stream_type)stream,
format, (AudioSystem::output_flags)flags,
sessionId,
@@ -177,12 +179,12 @@
audio_stream_type_t stream,
uint32_t sampling_rate,
audio_format_t format,
- audio_output_flags_t channels,
- audio_policy_output_flags_t flags)
+ uint32_t channels,
+ audio_output_flags_t flags)
{
struct qcom_audio_policy *qap = to_qap(pol);
- LOGV("%s: tid %d", __func__, gettid());
+ ALOGV("%s: tid %d", __func__, gettid());
return qap->apm->getOutput((AudioSystem::stream_type)stream,
sampling_rate, format, channels,
(AudioSystem::output_flags)flags);
@@ -255,7 +257,8 @@
{
struct qcom_audio_policy *qap = to_qap(pol);
return qap->apm->setStreamVolumeIndex((AudioSystem::stream_type)stream,
- index);
+ index,
+ AUDIO_DEVICE_OUT_DEFAULT);
}
static int ap_get_stream_volume_index(const struct audio_policy *pol,
@@ -264,7 +267,8 @@
{
const struct qcom_audio_policy *qap = to_cqap(pol);
return qap->apm->getStreamVolumeIndex((AudioSystem::stream_type)stream,
- index);
+ index,
+ AUDIO_DEVICE_OUT_DEFAULT);
}
static uint32_t ap_get_strategy_for_stream(const struct audio_policy *pol,
@@ -279,7 +283,10 @@
int index,
audio_devices_t device)
{
- return -ENOSYS;
+ const struct qcom_audio_policy *qap = to_cqap(pol);
+ return qap->apm->setStreamVolumeIndex((AudioSystem::stream_type)stream,
+ index,
+ device);
}
static int ap_get_stream_volume_index_for_device(const struct audio_policy *pol,
@@ -287,7 +294,10 @@
int *index,
audio_devices_t device)
{
- return -ENOSYS;
+ const struct qcom_audio_policy *qap = to_cqap(pol);
+ return qap->apm->getStreamVolumeIndex((AudioSystem::stream_type)stream,
+ index,
+ AUDIO_DEVICE_OUT_DEFAULT);
}
static audio_devices_t ap_get_devices_for_stream(const struct audio_policy *pol,