aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfulup <fulup.arfoll@iot.bzh>2018-06-05 01:02:16 +0200
committerfulup <fulup.arfoll@iot.bzh>2018-06-05 01:02:16 +0200
commitf2510b35caf15cf59a7c3efaf95a3483c046f084 (patch)
treef2d60f9f26b16a22400a1feb8cc304ddc83f8f86
parentc4c0647af21b2a05e87f36101d86dc2d35f1f47c (diff)
Added per sink/source API for master control
-rw-r--r--conf.d/project/htdocs/index.html3
-rw-r--r--nbproject/configurations.xml21
-rw-r--r--plugins/alsa/alsa-api-pcm.c12
3 files changed, 23 insertions, 13 deletions
diff --git a/conf.d/project/htdocs/index.html b/conf.d/project/htdocs/index.html
index 59fbbac..df7ec80 100644
--- a/conf.d/project/htdocs/index.html
+++ b/conf.d/project/htdocs/index.html
@@ -22,6 +22,9 @@
<li><button onclick="callbinder('MyMixer', 'info', {ramps: true});">Ramps List</button></li>
<li><button onclick="callbinder('MyMixer', 'info', {zones: true});">Zones List</button></li>
<br>
+ <li><button onclick="callbinder('MyMixer', '8CH-USB/playback', {volume: '+10'});">Master 8CH-USB vol=+10</button></li>
+ <li><button onclick="callbinder('MyMixer', '8CH-USB/playback', {volume: '-10'});">Master 8CH-USB vol=-10</button></li>
+ <br>
<li><button onclick="callbinder('MyMixer', 'multimedia', {toggle: true});">Stream Multimedia pause/resume</button></li>
<li><button onclick="callbinder('MyMixer', 'navigation', {toggle: true});">Stream Navigation pause/resume</button></li>
<br>
diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml
index 7acd6c9..9ad6e97 100644
--- a/nbproject/configurations.xml
+++ b/nbproject/configurations.xml
@@ -384,22 +384,22 @@
<item path="plugins/alsa/alsa-api-pcm.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
- <pElem>app-controller-submodule/ctl-lib</pElem>
- <pElem>build/app-controller-submodule/ctl-lib</pElem>
- <pElem>/usr/include</pElem>
<pElem>/usr/include/json-c</pElem>
- <pElem>/usr/include/alsa</pElem>
<pElem>../../../opt/include</pElem>
<pElem>/usr/include/p11-kit-1</pElem>
<pElem>/usr/include/uuid</pElem>
<pElem>../../../opt/include/alsa</pElem>
+ <pElem>/usr/include/lua5.3</pElem>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
<pElem>mixer-binding</pElem>
<pElem>app-afb-helpers-submodule</pElem>
<pElem>build/plugins/alsa</pElem>
- <pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
- <Elem>alsa_router_EXPORTS</Elem>
+ <Elem>CONTROL_CONFIG_PATH="/home/fulup/Workspace/Audio-4a/4a-softmixer/conf.d/project/etc:/home/fulup/Workspace/Audio-4a/4a-softmixer/build/package/etc:/home/fulup/opt/4a-smixer/etc"</Elem>
+ <Elem>CONTROL_LUA_PATH="/home/fulup/Workspace/Audio-4a/4a-softmixer/conf.d/project/lua.d:/home/fulup/opt/4a-smixer/var"</Elem>
+ <Elem>CONTROL_PLUGIN_PATH="/home/fulup/Workspace/Audio-4a/4a-softmixer/build/package/lib/plugins:/home/fulup/opt/4a-smixer/lib/plugins"</Elem>
+ <Elem>alsa_softmixer_EXPORTS</Elem>
</preprocessorList>
</cTool>
</item>
@@ -586,19 +586,22 @@
</preprocessorList>
</cTool>
</item>
- <item path="plugins/alsa/alsa-effect-ramp.c" ex="false" tool="0" flavor2="0">
+ <item path="plugins/alsa/alsa-effect-ramp.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>build/app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/include</pElem>
<pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/alsa</pElem>
<pElem>../../../opt/include</pElem>
<pElem>/usr/include/p11-kit-1</pElem>
<pElem>/usr/include/uuid</pElem>
<pElem>../../../opt/include/alsa</pElem>
- <pElem>/usr/include/lua5.3</pElem>
- <pElem>app-controller-submodule/ctl-lib</pElem>
<pElem>mixer-binding</pElem>
<pElem>app-afb-helpers-submodule</pElem>
<pElem>build/plugins/alsa</pElem>
+ <pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
<Elem>CONTROL_CONFIG_PATH="/home/fulup/Workspace/Audio-4a/4a-softmixer/conf.d/project/etc:/home/fulup/Workspace/Audio-4a/4a-softmixer/build/package/etc:/home/fulup/opt/4a-smixer/etc"</Elem>
diff --git a/plugins/alsa/alsa-api-pcm.c b/plugins/alsa/alsa-api-pcm.c
index de9ed0c..5bd6dca 100644
--- a/plugins/alsa/alsa-api-pcm.c
+++ b/plugins/alsa/alsa-api-pcm.c
@@ -177,7 +177,7 @@ STATIC int PcmSetControl(SoftMixerT *mixer, AlsaSndCtlT *sndcard, AlsaSndControl
}
error = CtlElemIdGetLong(mixer, sndcard, elemId, &curval);
- if (!error) {
+ if (error) {
AFB_ApiError(mixer->api, "PcmSetControl sndard=%s fail to read control numid=%d", sndcard->cid.cardid, control->numid);
goto OnErrorExit;
}
@@ -199,10 +199,14 @@ STATIC int PcmSetControl(SoftMixerT *mixer, AlsaSndCtlT *sndcard, AlsaSndControl
value = CONVERT_PERCENT(curval, control->min, control->max) - value;
break;
default:
- value= CONVERT_VOLUME(value, control->min, control->max);
+ value= value;
}
- error = CtlElemIdSetLong(mixer, sndcard, elemId, (int)value);
+ error = CtlElemIdSetLong(mixer, sndcard, elemId, CONVERT_VOLUME(value, control->min, control->max));
+ if (error) {
+ AFB_ApiError(mixer->api, "PcmSetControl sndard=%s fail to write control numid=%d value=%d", sndcard->cid.cardid, control->numid, value);
+ goto OnErrorExit;
+ }
break;
default:
@@ -474,7 +478,7 @@ PUBLIC AlsaSndPcmT * ApiPcmAttachOne(SoftMixerT *mixer, const char *uid, snd_pcm
(void) asprintf(&apiVerb, "%s/playback", pcm->uid);
(void) asprintf(&apiInfo, "HAL:%s SND_PCM_STREAM_PLAYBACK", uid);
} else {
- (void) asprintf(&apiVerb, "%s/playback", pcm->uid);
+ (void) asprintf(&apiVerb, "%s/capture", pcm->uid);
(void) asprintf(&apiInfo, "HAL:%s SND_PCM_STREAM_PLAYBACK", uid);
}
apiVerbHandleT *handle = calloc(1, sizeof (apiVerbHandleT));