aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonan Le Martret <ronan.lemartret@iot.bzh>2017-12-20 02:22:05 +0100
committerRonan Le Martret <ronan.lemartret@iot.bzh>2017-12-20 02:22:05 +0100
commit5b5acbd56d431ac69970dbc5f260c2abb7b3a148 (patch)
treee49f0c45af0c337d81fd881b4324809b9b557ab0
parent3001ab587926c8d165f1476275ba5792891e9dd7 (diff)
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 <tobias.jahnke@microchip.com> Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
-rw-r--r--MOST_UNICENS/hal_most_unicens.c14
1 files 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..");