summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2017-02-02 18:29:12 +0100
committerChristopher N. Hesse <raymanfx@gmail.com>2017-02-10 20:29:56 +0000
commit74ef3a12fce51c4ca27326977471cc7376a4c88d (patch)
treecebef179efc2810faf1032f7dab83723f9b3c7cd
parentafec0fd5cae5b552db5a014858007cba4503503c (diff)
downloadandroid_hardware_samsung-74ef3a12fce51c4ca27326977471cc7376a4c88d.tar.gz
android_hardware_samsung-74ef3a12fce51c4ca27326977471cc7376a4c88d.tar.bz2
android_hardware_samsung-74ef3a12fce51c4ca27326977471cc7376a4c88d.zip
audio: Create a structure for voice to group values
Change-Id: I184d39460aa8a9a3ee5efc5fe3aa63e99a2e9d12
-rw-r--r--audio/audio_hw.c31
-rw-r--r--audio/audio_hw.h11
2 files changed, 25 insertions, 17 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 3d80f7b..59cc0f4 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -871,7 +871,7 @@ static int select_devices(struct audio_device *adev,
* be switched to new device when select_devices() is called for voice call
* usecase.
*/
- if (adev->in_call) {
+ if (adev->voice.in_call) {
vc_usecase = get_usecase_from_id(adev, USECASE_VOICE_CALL);
if (usecase == NULL) {
ALOGE("%s: Could not find the voice call usecase", __func__);
@@ -2403,7 +2403,7 @@ static int stop_voice_call(struct audio_device *adev)
struct audio_usecase *uc_info;
ALOGV("%s: enter", __func__);
- adev->in_call = false;
+ adev->voice.in_call = false;
/* TODO: implement voice call stop */
@@ -2456,9 +2456,9 @@ static int start_voice_call(struct audio_device *adev)
/* TODO: implement voice call start */
/* set cached volume */
- set_voice_volume_l(adev, adev->voice_volume);
+ set_voice_volume_l(adev, adev->voice.volume);
- adev->in_call = true;
+ adev->voice.in_call = true;
exit:
ALOGV("%s: exit", __func__);
return ret;
@@ -2693,16 +2693,17 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
}
}
- if ((adev->mode == AUDIO_MODE_IN_CALL) && !adev->in_call &&
+ if ((adev->mode == AUDIO_MODE_IN_CALL) && !adev->voice.in_call &&
(out == adev->primary_output)) {
start_voice_call(adev);
- } else if ((adev->mode == AUDIO_MODE_IN_CALL) && adev->in_call &&
+ } else if ((adev->mode == AUDIO_MODE_IN_CALL) &&
+ adev->voice.in_call &&
(out == adev->primary_output)) {
select_devices(adev, USECASE_VOICE_CALL);
}
}
- if ((adev->mode == AUDIO_MODE_NORMAL) && adev->in_call &&
+ if ((adev->mode == AUDIO_MODE_NORMAL) && adev->voice.in_call &&
(out == adev->primary_output)) {
stop_voice_call(adev);
}
@@ -3867,9 +3868,9 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
* But it is currently not supported.
*/
if (strcmp(value, AUDIO_PARAMETER_VALUE_ON) == 0)
- adev->bluetooth_nrec = true;
+ adev->voice.bluetooth_nrec = true;
else
- adev->bluetooth_nrec = false;
+ adev->voice.bluetooth_nrec = false;
}
#if SWAP_SPEAKER_ON_SCREEN_ROTATION
@@ -3939,8 +3940,8 @@ static int adev_set_voice_volume(struct audio_hw_device *dev, float volume)
struct audio_device *adev = (struct audio_device *)dev;
pthread_mutex_lock(&adev->lock);
/* cache volume */
- adev->voice_volume = volume;
- ret = set_voice_volume_l(adev, adev->voice_volume);
+ adev->voice.volume = volume;
+ ret = set_voice_volume_l(adev, adev->voice.volume);
pthread_mutex_unlock(&adev->lock);
return ret;
}
@@ -4251,9 +4252,11 @@ static int adev_open(const hw_module_t *module, const char *name,
adev->mode = AUDIO_MODE_NORMAL;
adev->active_input = NULL;
adev->primary_output = NULL;
- adev->voice_volume = 1.0f;
- adev->bluetooth_nrec = true;
- adev->in_call = false;
+
+ adev->voice.volume = 1.0f;
+ adev->voice.bluetooth_nrec = true;
+ adev->voice.in_call = false;
+
/* adev->cur_hdmi_channels = 0; by calloc() */
adev->snd_dev_ref_cnt = calloc(SND_DEVICE_MAX, sizeof(int));
if (adev->snd_dev_ref_cnt == NULL) {
diff --git a/audio/audio_hw.h b/audio/audio_hw.h
index da5cd86..ab50ef7 100644
--- a/audio/audio_hw.h
+++ b/audio/audio_hw.h
@@ -369,6 +369,11 @@ struct audio_usecase {
struct listnode mixer_list;
};
+struct voice_data {
+ bool in_call;
+ float volume;
+ bool bluetooth_nrec;
+};
struct audio_device {
struct audio_hw_device device;
@@ -377,10 +382,10 @@ struct audio_device {
audio_mode_t mode;
struct stream_in* active_input;
struct stream_out* primary_output;
- bool in_call;
- float voice_volume;
bool mic_mute;
- bool bluetooth_nrec;
+
+ struct voice_data voice;
+
int* snd_dev_ref_cnt;
struct listnode usecase_list;
bool speaker_lr_swap;