diff options
| author | sbrissen <sbrissen@hotmail.com> | 2013-08-20 15:51:40 -0400 |
|---|---|---|
| committer | sbrissen <sbrissen@hotmail.com> | 2013-08-20 15:52:17 -0400 |
| commit | c5de77275001eaede07fe3b072e701a1f9e2604c (patch) | |
| tree | 42215b396251a8cfde0263bed05a4a10dd2ec612 /audio/audio_hw.c | |
| parent | 76bc1378ff0b0df0e7fb0eaa2aece11f0bb83c84 (diff) | |
| download | device_samsung_t0lte-c5de77275001eaede07fe3b072e701a1f9e2604c.tar.gz device_samsung_t0lte-c5de77275001eaede07fe3b072e701a1f9e2604c.tar.bz2 device_samsung_t0lte-c5de77275001eaede07fe3b072e701a1f9e2604c.zip | |
Revert "t0lte: user configureable voice/streaming volumes [1/2]"
This reverts commit 56b68617e0dff7e1f4cf879b8531ad57037d9fac.
Conflicts:
overlay-cdma/device/samsung/smdk4412-common/DeviceSettings/res/values/config.xml
rootdir/init.smdk4x12.rc
Change-Id: I927c0eba5c25dac3ebe3b2ed6af81f943f838bdf
Diffstat (limited to 'audio/audio_hw.c')
| -rwxr-xr-x | audio/audio_hw.c | 123 |
1 files changed, 9 insertions, 114 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 6a4ca04..3cb40c2 100755 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -25,7 +25,6 @@ #include <pthread.h> #include <stdint.h> #include <sys/time.h> -#include <sys/stat.h> #include <stdlib.h> #include <expat.h> #include <dlfcn.h> @@ -197,6 +196,7 @@ struct m0_dev_cfg { void *mCsdHandle; int rx_dev_id, tx_dev_id, old_rx_dev; +int voice_index; static int (*csd_client_init)(); static int (*csd_client_deinit)(); @@ -533,6 +533,7 @@ static void set_incall_device(struct m0_audio_device *adev) case AUDIO_DEVICE_OUT_EARPIECE: rx_dev_id = DEVICE_HANDSET_RX_ACDB_ID; tx_dev_id = DEVICE_HANDSET_TX_ACDB_ID; + voice_index = 5; break; case AUDIO_DEVICE_OUT_SPEAKER: case AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET: @@ -540,11 +541,13 @@ static void set_incall_device(struct m0_audio_device *adev) case AUDIO_DEVICE_OUT_AUX_DIGITAL: rx_dev_id = DEVICE_SPEAKER_MONO_RX_ACDB_ID; tx_dev_id = DEVICE_SPEAKER_TX_ACDB_ID; + voice_index = 7; break; case AUDIO_DEVICE_OUT_WIRED_HEADSET: case AUDIO_DEVICE_OUT_WIRED_HEADPHONE: rx_dev_id = DEVICE_HEADSET_RX_ACDB_ID; tx_dev_id = DEVICE_HEADSET_TX_ACDB_ID; + voice_index = 5; break; case AUDIO_DEVICE_OUT_BLUETOOTH_SCO: case AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET: @@ -556,10 +559,12 @@ static void set_incall_device(struct m0_audio_device *adev) rx_dev_id = DEVICE_BT_SCO_RX_ACDB_ID; tx_dev_id = DEVICE_BT_SCO_TX_ACDB_ID; } + voice_index = 7; break; default: rx_dev_id = DEVICE_HANDSET_RX_ACDB_ID; tx_dev_id = DEVICE_HANDSET_TX_ACDB_ID; + voice_index = 5; break; } @@ -605,25 +610,8 @@ static void set_input_volumes(struct m0_audio_device *adev, int main_mic_on, { } -static void set_output_volumes(struct m0_audio_device *adev) +static void set_output_volumes(struct m0_audio_device *adev, bool tty_volume) { - int volume; - - switch(adev->out_device) { - case AUDIO_DEVICE_OUT_SPEAKER: - volume = get_volume(OUT_SPEAKER); - ALOGV("%s: SPEAKER Volume: %i", __func__, volume); - mixer_ctl_set_value(adev->mixer_ctls.speaker_volume,0,volume); - mixer_ctl_set_value(adev->mixer_ctls.speaker_volume,1,volume); - break; - case AUDIO_DEVICE_OUT_WIRED_HEADSET: - case AUDIO_DEVICE_OUT_WIRED_HEADPHONE: - volume = get_volume(OUT_HEADPHONE); - ALOGV("%s: HEADPHONE Volume: %i", __func__, volume); - mixer_ctl_set_value(adev->mixer_ctls.headphone_volume,0,volume); - mixer_ctl_set_value(adev->mixer_ctls.headphone_volume,1,volume); - break; - } } static void force_all_standby(struct m0_audio_device *adev) @@ -754,8 +742,6 @@ static void select_output_device(struct m0_audio_device *adev) set_eq_filter(adev); - set_output_volumes(adev); - if (adev->mode == AUDIO_MODE_IN_CALL) { if (!bt_on) { /* force tx path according to TTY mode when in call */ @@ -2733,19 +2719,16 @@ static int adev_init_check(const struct audio_hw_device *dev) static int adev_set_voice_volume(struct audio_hw_device *dev, float volume) { struct m0_audio_device *adev = (struct m0_audio_device *)dev; - int voice_index; adev->voice_volume = volume; - voice_index = update_voice_index(adev); - ALOGD("%s: Voice Index: %i", __func__, voice_index); if (adev->mode == AUDIO_MODE_IN_CALL) { if (csd_volume_index == NULL) { ALOGE("dlsym: Error:%s Loading csd_volume_index", dlerror()); } else { - volume = volume * (float)voice_index; + volume = volume * voice_index; ALOGD("%s: calling csd_volume_index(%f)", __func__, volume); csd_volume_index(volume); } @@ -2753,36 +2736,6 @@ static int adev_set_voice_volume(struct audio_hw_device *dev, float volume) return 0; } -int update_voice_index(struct m0_audio_device *adev) -{ - int voice_index; - - switch(adev->out_device) { - case AUDIO_DEVICE_OUT_EARPIECE: - voice_index = get_volume(INCALL_EARPIECE); - break; - case AUDIO_DEVICE_OUT_SPEAKER: - case AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET: - case AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET: - case AUDIO_DEVICE_OUT_AUX_DIGITAL: - voice_index = get_volume(INCALL_SPEAKER); - break; - case AUDIO_DEVICE_OUT_WIRED_HEADSET: - case AUDIO_DEVICE_OUT_WIRED_HEADPHONE: - voice_index = get_volume(INCALL_HEADPHONE); - break; - case AUDIO_DEVICE_OUT_BLUETOOTH_SCO: - case AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET: - case AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT: - voice_index = get_volume(INCALL_BT); - break; - default: - voice_index = get_volume(INCALL_EARPIECE); - break; - } - return voice_index; -} - static int adev_set_master_volume(struct audio_hw_device *dev, float volume) { return -ENOSYS; @@ -3198,63 +3151,11 @@ static int adev_config_parse(struct m0_audio_device *adev) return ret; } -static int volume_file_check() -{ - FILE *f; - int i; - int default_voice_vol = 5; - int default_stream_vol = 50; - struct stat st = {0}; - - if (stat(AUDIO_DIR, &st) == -1) { - ALOGE("Directory %s does not exist, skip creating volume files\n", AUDIO_DIR); - return -ENODEV; - } - - for ( i = 0; i < MAX_NUM_VOLUME_FILES; i++ ) { - f = fopen(volume_file[i], "r"); - if(!f){ - ALOGW("Failed to open %s, attempting to create file\n", volume_file[i]); - f = fopen(volume_file[i], "w"); - if(!f){ - ALOGE("Failed to create %s\n", volume_file[i]); - continue; - }else{ - ALOGI("Successfully created %s\n", volume_file[i]); - /* first 4 files are for incall voice, anything over that is considered streaming out */ - if(i > 3) - fprintf(f, "%d", default_stream_vol); - else - fprintf(f, "%d", default_voice_vol); - fclose(f); - chmod(volume_file[i], 0666); - } - }else{ - chmod(volume_file[i],0666); - } - } - - return 0; -} - -int get_volume(char *file) -{ - FILE *f; - int index = 1; - - f = fopen(file, "r"); - if(f) { - fscanf(f, "%i", &index); - fclose(f); - } - return index; -} - static int adev_open(const hw_module_t* module, const char* name, hw_device_t** device) { struct m0_audio_device *adev; - int ret, volfs; + int ret; if (strcmp(name, AUDIO_HARDWARE_INTERFACE) != 0) return -EINVAL; @@ -3294,16 +3195,10 @@ static int adev_open(const hw_module_t* module, const char* name, adev->mixer_ctls.mixinl_in1l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN1L Volume"); adev->mixer_ctls.mixinl_in2l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN2L Volume"); - /* speaker/headphone volume control*/ - adev->mixer_ctls.speaker_volume = mixer_get_ctl_by_name(adev->mixer, "Speaker Volume"); - adev->mixer_ctls.headphone_volume = mixer_get_ctl_by_name(adev->mixer, "Headphone Volume"); - ret = adev_config_parse(adev); if (ret != 0) goto err_mixer; - volfs = volume_file_check(); - /* Set the default route before the PCM stream is opened */ pthread_mutex_lock(&adev->lock); adev->mode = AUDIO_MODE_NORMAL; |
