aboutsummaryrefslogtreecommitdiffstats
path: root/HAL-afb
diff options
context:
space:
mode:
Diffstat (limited to 'HAL-afb')
-rw-r--r--HAL-afb/hal-most-unicens/hal_most_unicens.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/HAL-afb/hal-most-unicens/hal_most_unicens.c b/HAL-afb/hal-most-unicens/hal_most_unicens.c
index a98906c..388b840 100644
--- a/HAL-afb/hal-most-unicens/hal_most_unicens.c
+++ b/HAL-afb/hal-most-unicens/hal_most_unicens.c
@@ -19,11 +19,27 @@
#include "hal-interface.h"
#include "audio-interface.h"
+static int master_volume;
+static int master_switch;
+static int pcm_volume;
+
+void unicens_volume_cb(halCtlsEnumT tag, alsaHalCtlMapT *control, void* handle, json_object *valuesJ) {
+
+ AFB_NOTICE("UNICENS Volume tag=%d, vol=%d, min=%d, max=%d", tag, control->value, control->minval, control->maxval);
+
+}
+
/* declare ALSA mixer controls */
STATIC alsaHalMapT alsaHalMap[]= {
- { .tag=Master_Playback_Volume, .ctl={.name="Master Playback Volume" } },
- { .tag=Master_OnOff_Switch , .ctl={.name="Master Playback Switch" } },
- { .tag=PCM_Playback_Volume , .ctl={.name="PCM Playback Volume" } },
+ { .tag=Master_Playback_Volume, .cb={.callback=unicens_volume_cb, .handle=&master_volume}, .info="Sets master playback volume",
+ .ctl={.numid=0, .type=SND_CTL_ELEM_TYPE_INTEGER, .count=1, .minval=0, .maxval=100, .step=1, .value=50, .name="Master Playback Volume"}
+ },
+ { .tag=Master_OnOff_Switch, .cb={.callback=unicens_volume_cb, .handle=&master_switch}, .info="Sets master playback switch",
+ .ctl={.numid=0, .type=SND_CTL_ELEM_TYPE_BOOLEAN, .count=1, .minval=0, .maxval=1, .step=1, .value=1, .name="Master Playback Switch"}
+ },
+ { .tag=PCM_Playback_Volume, .cb={.callback=unicens_volume_cb, .handle=&pcm_volume}, .info="Sets PCM playback volume",
+ .ctl={.numid=0, .type=SND_CTL_ELEM_TYPE_INTEGER, .count=6, .minval=0, .maxval=100, .step=1, .value=100, .name="PCM Playback Volume"}
+ },
{ .tag=EndHalCrlTag} /* marker for end of the array */
} ;
@@ -35,7 +51,6 @@ STATIC alsaHalSndCardT alsaHalSndCard = {
.volumeCB = NULL, /* use default volume normalization function */
};
-
STATIC int sndServiceInit () {
int err;
AFB_DEBUG ("Initializing HAL-MOST-UNICENS-BINDING");
@@ -44,7 +59,7 @@ STATIC int sndServiceInit () {
return err;
}
-// API prefix should be unique for each snd card
+/* API prefix should be unique for each snd card */
PUBLIC const struct afb_binding_v2 afbBindingV2 = {
.api = "hal-most-unicens",
.init = sndServiceInit,