summaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-api-sndstreams.c
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2018-05-17 12:48:12 +0200
committerFulup Ar Foll <fulup@iot.bzh>2018-05-17 12:48:12 +0200
commit29f5fc4e093b8793eaeeef056d0b998182269718 (patch)
treedfeab4eec7f485c40c595fa045cdf734b0a3e37b /plugins/alsa/alsa-api-sndstreams.c
parentea9cd4223a9ff1f0da3276ea12727a59ab09531f (diff)
Cleanup soft vol control creation
Diffstat (limited to 'plugins/alsa/alsa-api-sndstreams.c')
-rw-r--r--plugins/alsa/alsa-api-sndstreams.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/alsa/alsa-api-sndstreams.c b/plugins/alsa/alsa-api-sndstreams.c
index d02d47e..e55aeff 100644
--- a/plugins/alsa/alsa-api-sndstreams.c
+++ b/plugins/alsa/alsa-api-sndstreams.c
@@ -21,6 +21,11 @@
#include "alsa-softmixer.h"
#include <string.h>
+// Set stream volume control in %
+#define VOL_CONTROL_MAX 100
+#define VOL_CONTROL_MIN 0
+#define VOL_CONTROL_STEP 1
+
// Fulup need to be cleanup with new controller version
extern Lua2cWrapperT Lua2cWrap;
@@ -158,14 +163,14 @@ CTLP_LUA2C(snd_streams, source, argsJ, responseJ) {
// create stream and delay pcm openning until vol control is created
char volName[ALSA_CARDID_MAX_LEN];
snprintf(volName, sizeof (volName), "vol-%s", sndStream[idx].uid);
- AlsaPcmInfoT *streamPcm = AlsaCreateStream(source, &sndStream[idx], captureDev, volName, 0);
+ AlsaPcmInfoT *streamPcm = AlsaCreateStream(source, &sndStream[idx], captureDev, volName, VOL_CONTROL_MAX, 0);
if (!streamPcm) {
AFB_ApiError(source->api, "L2C:sndstreams:%s(pcm) fail to create stream", sndStream[idx].uid);
goto OnErrorExit;
}
// create volume control before softvol pcm is opened
- int volNumid = AlsaCtlCreateControl(source, ctlDev, playbackDev, volName, streamPcm->params.channels, 0, 100, 1, sndStream[idx].volume);
+ int volNumid = AlsaCtlCreateControl(source, ctlDev, playbackDev, volName, streamPcm->params.channels, VOL_CONTROL_MIN, VOL_CONTROL_MAX, VOL_CONTROL_STEP, sndStream[idx].volume);
if (volNumid <= 0) goto OnErrorExit;
// **** Fulup (would need some help to get automatic rate converter to work).