summaryrefslogtreecommitdiffstats
path: root/MOST_UNICENS/hal_most_unicens.c
diff options
context:
space:
mode:
authorTobias Jahnke <tobias.jahnke@microchip.com>2017-12-19 12:15:00 +0100
committerTobias Jahnke <tobias.jahnke@microchip.com>2017-12-19 12:15:00 +0100
commitdbc5e694a20a97d70621c279b563e5a09fdb5a09 (patch)
tree2e5eccc3a6d6d2b2e7d9e4dbef676936d584738e /MOST_UNICENS/hal_most_unicens.c
parent99857404cbeef5fda673cb6fcb392489d70934e0 (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>
Diffstat (limited to 'MOST_UNICENS/hal_most_unicens.c')
-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..");