From dbc5e694a20a97d70621c279b563e5a09fdb5a09 Mon Sep 17 00:00:00 2001 From: Tobias Jahnke Date: Tue, 19 Dec 2017 12:15:00 +0100 Subject: hal_most_unicens.c: Set amp volumes initially Sets the default values for the amps to a predefined value of 80%. The previous implementation requested the values from ALSA mixer controls which may cause to be muted when someone has reduced the volume on a previous boot. We found this too risky for the current state and wanted to make sure that we find the same volume levels after each system boot. Change-Id: Id6434c2a3bea23d7c95918b2294fb7619c690695 Signed-off-by: Tobias Jahnke --- MOST_UNICENS/hal_most_unicens.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/MOST_UNICENS/hal_most_unicens.c b/MOST_UNICENS/hal_most_unicens.c index 12abe29..4bb9b45 100644 --- a/MOST_UNICENS/hal_most_unicens.c +++ b/MOST_UNICENS/hal_most_unicens.c @@ -126,9 +126,9 @@ STATIC halVolRampT volRampFallback= { }; -static int master_volume; +static int master_volume = 80; static json_bool master_switch; -static int pcm_volume[PCM_MAX_CHANNELS]; +static int pcm_volume[PCM_MAX_CHANNELS] = {100,100,100,100,100,100}; static void unicens_apply_card_value(void *closure, struct json_object *j_obj){ @@ -174,7 +174,7 @@ static void unicens_request_card_values_cb(void *closure, int status, struct jso } } -static void unicens_request_card_values(const char* dev_id) { +static __attribute__((unused)) void unicens_request_card_values(const char* dev_id) { int err; json_object *j_query = NULL; @@ -365,8 +365,14 @@ STATIC int unicens_service_init() { goto OnErrorExit; } + /* Step 1: Set output volume to pre-defined level */ + /* in order to avoid muted volume to be persistent after boot. */ + wrap_volume_master(80); + wrap_volume_pcm(pcm_volume, PCM_MAX_CHANNELS/*array size*/); + + /* Step 2: risk to have influence on mixer controls init */ /* request of initial card values */ - unicens_request_card_values(ALSA_DEVICE_ID); + /* unicens_request_card_values(ALSA_DEVICE_ID); */ OnErrorExit: AFB_NOTICE("Initializing HAL-MOST-UNICENS-BINDING done.."); -- cgit 1.2.3-korg