aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfulup <fulup.arfoll@iot.bzh>2018-06-10 00:49:02 +0200
committerfulup <fulup.arfoll@iot.bzh>2018-06-10 00:49:02 +0200
commitfe8135a9a769f9df7e7e0d0eeacdd8497661a8c4 (patch)
tree8dbbc2d1eb0c4f011b6b683be2401a6b4829027f
parent5247b9daa560a7fc2833578a3b8280d00e00c8e0 (diff)
Cleanup and added return of previous volume when setting new value
m---------app-afb-helpers-submodule0
m---------app-controller-submodule0
-rw-r--r--conf.d/project/etc/smixer-test-config.json43
-rw-r--r--conf.d/project/htdocs/index.html25
-rw-r--r--conf.d/project/lua.d/smixer-test-usb_ch8.lua65
-rw-r--r--mixer-binding/mixer-binding.c2
-rw-r--r--nbproject/configurations.xml317
-rw-r--r--plugins/alsa/alsa-api-loop.c12
-rw-r--r--plugins/alsa/alsa-api-mixer.c262
-rw-r--r--plugins/alsa/alsa-api-pcm.c91
-rw-r--r--plugins/alsa/alsa-api-ramp.c6
-rw-r--r--plugins/alsa/alsa-api-sink.c6
-rw-r--r--plugins/alsa/alsa-api-source.c6
-rw-r--r--plugins/alsa/alsa-api-streams.c102
-rw-r--r--plugins/alsa/alsa-api-zones.c6
-rw-r--r--plugins/alsa/alsa-core-pcm.c4
-rw-r--r--plugins/alsa/alsa-plug-rate.c2
-rw-r--r--plugins/alsa/alsa-plug-route.c2
-rw-r--r--plugins/alsa/alsa-plug-vol.c2
-rw-r--r--plugins/alsa/alsa-softmixer.h9
-rw-r--r--plugins/alsa/alsa-utils-bypath.c1
21 files changed, 498 insertions, 465 deletions
diff --git a/app-afb-helpers-submodule b/app-afb-helpers-submodule
-Subproject 9685413c5e155e22f72d0b5d36edad889a5f524
+Subproject c7cd527a8350f736b8013f65db6f5a52b8cb05d
diff --git a/app-controller-submodule b/app-controller-submodule
-Subproject bcd9efc10d60e5f83218378fdd0a3ee847fb9c7
+Subproject 690bdeee06f414fa149f5a9b62de7b215c3a80c
diff --git a/conf.d/project/etc/smixer-test-config.json b/conf.d/project/etc/smixer-test-config.json
index 3916d76..42f9e65 100644
--- a/conf.d/project/etc/smixer-test-config.json
+++ b/conf.d/project/etc/smixer-test-config.json
@@ -11,20 +11,49 @@
"uid": "softmixer",
"info": "Map alsa-loop subdevices to 4A HAL streams",
"spath": "./package/lib/plugins:./package/var:./lib/plugins:./var",
- "libs": ["alsa-softmixer.ctlso", "smixer-test-radio_8ch.lua"],
+ "libs": ["alsa-softmixer.ctlso", "smixer-test-usb_ch8.lua"],
}
],
-
"onload": [
{
- "uid": "create-soft-mixer",
+ "uid": "mixer-create-api",
"info": "Create Audio Router",
- "action": "plugin://softmixer#CreateMixer",
- "args": {"uid":"Simple_Test_Mixer"}
+ "action": "plugin://softmixer#MixerCreate",
+ "args": {
+ "uid":"Alsa-Mixer",
+ "max_loop": 1,
+ "max_sink": 8,
+ "max_source": 8,
+ "max_zone": 8,
+ "max_stream": 8,
+ "max_ramp": 4,
+ }
},
{
- "uid": "attach-soft-mixer",
- "info": "Attach Stream to Audio Router",
+ "uid": "mixer-attach-loop",
+ "info": "Create Audio Router",
+ "action": "plugin://softmixer#MixerAttach",
+ "args": {
+ "loops" : {
+ "uid":"Alsa-Loopback",
+ "path": "/dev/snd/by-path/platform-snd_aloop.0",
+ "devices" : {"playback":0, "capture":1},
+ "subdevs" : [
+ {"subdev": 0, "numid": 51, "uid": "loop-legacy"},
+ {"subdev": 1, "numid": 57, "uid": "loop-multimedia"},
+ {"subdev": 2, "numid": 63},
+ {"subdev": 3, "numid": 69},
+ {"subdev": 4, "numid": 75},
+ {"subdev": 5, "numid": 81},
+ {"subdev": 6, "numid": 87},
+ {"subdev": 7, "numid": 93}
+ ]
+ }
+ }
+ },
+ {
+ "uid": "lua-test-attach",
+ "info": "For testing purpose attach stream & zone directly from LUA script to simulate HAL",
"action": "lua://softmixer#_mixer_simple_test_"
}
]
diff --git a/conf.d/project/htdocs/index.html b/conf.d/project/htdocs/index.html
index c667dde..53c7054 100644
--- a/conf.d/project/htdocs/index.html
+++ b/conf.d/project/htdocs/index.html
@@ -13,26 +13,29 @@
<h1>Simple Mixer Test</h1>
<button id="connected" onclick="init()">Binder WS Fail</button>
- <button id="mnitoring" onclick="window.open('/monitoring/monitor.html', '_monitor_ctl')">Debug/Monitoring</a></button>
+ <button id="monitoring" onclick="window.open('/monitoring/monitor.html', '_monitor_ctl')">Debug/Monitoring</a></button>
<br><br>
<h2>V3 API CALL</h2>
<ol>
- <li><button onclick="callbinder('smixer', 'info', {streams: true});">Streams List</button></li>
- <li><button onclick="callbinder('smixer', 'info', {ramps: true});">Ramps List</button></li>
+ <li><button onclick="callbinder('smixer', 'info', {streams: true, verbose:true});">Streams All List</button></li>
+ <li><button onclick="callbinder('smixer', 'info', {streams: 'multimedia'});">Streams Multimedia</button></li>
+ <li><button onclick="callbinder('smixer', 'info', {ramps: true, verbose:true});">Ramps List</button></li>
<li><button onclick="callbinder('smixer', 'info', {zones: true});">Zones List</button></li>
<br>
- <li><button onclick="callbinder('smixer', '8CH-USB/playback', {volume: '+10'});">Master 8CH-USB vol=+10</button></li>
- <li><button onclick="callbinder('smixer', '8CH-USB/playback', {volume: '-10'});">Master 8CH-USB vol=-10</button></li>
+ <li><button onclick="callbinder('smixer', '8CH-USB:playback', {volume: '+10', verbose:true});">Master default vol=+10</button></li>
+ <li><button onclick="callbinder('smixer', '8CH-USB:playback', {volume: '-10', verbose:true});">Master default vol=-10</button></li>
<br>
- <li><button onclick="callbinder('smixer', 'multimedia', {toggle: true});">Stream Multimedia pause/resume</button></li>
- <li><button onclick="callbinder('smixer', 'navigation', {toggle: true});">Stream Navigation pause/resume</button></li>
+ <li><button onclick="callbinder('smixer', 'default:multimedia', {toggle: true, verbose:true});">Stream Multimedia pause/resume</button></li>
+ <li><button onclick="callbinder('smixer', 'default:navigation', {toggle: true, verbose:true});">Stream Navigation pause/resume</button></li>
<br>
- <li><button onclick="callbinder('smixer', 'multimedia', {volume: '+10'});">Stream Multimedia volume=+10"</button></li>
- <li><button onclick="callbinder('smixer', 'multimedia', {volume: '-10'});">Stream Multimedia volume=-10"</button></li>
+ <li><button onclick="callbinder('smixer', 'default:multimedia', {volume: '+10', verbose:true});">Stream Multimedia volume=+10"</button></li>
+ <li><button onclick="callbinder('smixer', 'default:multimedia', {volume: '-10', verbose:true});">Stream Multimedia volume=-10"</button></li>
<br>
- <li><button onclick="callbinder('smixer', 'multimedia', {ramp: {uid:'ramp-slow', volume:30}});">Stream Multimedia ramp-slow=30"</button></li>
- <li><button onclick="callbinder('smixer', 'multimedia', {ramp: {uid:'ramp-fast', volume:80}});">Stream Multimedia ramp-fast=80"</button></li>
+ <li><button onclick="callbinder('smixer', 'default:multimedia', {ramp: {uid:'ramp-slow', volume:30}, verbose:true});">Stream Multimedia ramp-slow=30"</button></li>
+ <li><button onclick="callbinder('smixer', 'default:multimedia', {ramp: {uid:'ramp-fast', volume:80}, verbose:true});">Stream Multimedia ramp-fast=80"</button></li>
+ <br>
+ <li><button onclick="callbinder('smixer', 'default:multimedia', {info: true});">Stream Multimedia get info"</button></li>
</ol>
<div id="main" style="visibility:hidden">
diff --git a/conf.d/project/lua.d/smixer-test-usb_ch8.lua b/conf.d/project/lua.d/smixer-test-usb_ch8.lua
index 98df824..2b804b6 100644
--- a/conf.d/project/lua.d/smixer-test-usb_ch8.lua
+++ b/conf.d/project/lua.d/smixer-test-usb_ch8.lua
@@ -53,29 +53,11 @@ function _mixer_simple_test_ (source, args)
{["uid"]="ramp-normal", ["delay"]= 100, ["up"]=06,["down"]=2},
}
- -- ======================= Loop PCM ===========================
- local snd_aloop = {
- ["uid"] = "Alsa-Loop",
- ["path"]= "/dev/snd/by-path/platform-snd_aloop.0",
- ["devices"] = {["playback"]=0,["capture"]=1},
- ["subdevs"] = {
- {["subdev"]= 0, ["numid"]= 51, ["uid"]= "loop-legacy"},
- {["subdev"]= 1, ["numid"]= 57, ["uid"]= "loop-multimedia"},
- {["subdev"]= 2, ["numid"]= 63},
- {["subdev"]= 3, ["numid"]= 69},
- {["subdev"]= 4, ["numid"]= 75},
- {["subdev"]= 5, ["numid"]= 81},
- {["subdev"]= 6, ["numid"]= 87},
- {["subdev"]= 7, ["numid"]= 93},
- },
- }
-
-
-- ============================= Backend (Sound Cards) ===================
local snd_usb_8ch= {
["uid"]= "8CH-USB",
- ["cardid"]= "USB",
+ ["path"]= "/dev/snd/by-id/usb-0d8c_USB_Sound_Device-00",
["params"] = audio_params.default,
["sink"] = {
["controls"]= {
@@ -143,21 +125,12 @@ function _mixer_simple_test_ (source, args)
}
}
- local zone_driver= {
- ["uid"] = "driver-seat",
- ["source"] = {
- {["target"]="mic-right",["channel"]=0},
- },
- ["sink"] = {
- {["target"]="front-right",["channel"]=0},
- }
- }
-- =================== Audio Streams ============================
local stream_music= {
["uid"] = "stream-multimedia",
+ ["verb"] = "multimedia",
["zone"]= "full-stereo",
- ["source"]= "loop-multimedia",
["volume"]= 80,
["mute"] = false,
["params"]= audio_params.standard,
@@ -165,6 +138,7 @@ function _mixer_simple_test_ (source, args)
local stream_navigation= {
["uid"] = "stream-navigation",
+ ["verb"] = "navigation",
["zone"]= "front-seats",
["volume"]= 80,
["mute"] = false,
@@ -172,22 +146,16 @@ function _mixer_simple_test_ (source, args)
local stream_emergency= {
["uid"] = "stream-emergency",
- ["zone"] = "driver-seat",
+ ["verb"] = "emergency",
+ ["zone"] = "front-seats",
["volume"]= 80,
["mute"] = false,
- --["params"]= audio_params.basic,
}
-
- local stream_radio= {
- ["uid"] = "stream-radio",
- ["zone"] = "full-stereo",
- ["source"]= "radio",
- ["volume"]= 80,
- ["mute"] = false,
- }
-
+
+ -- Force Pulse to attach a well known Loop subdev to get a fix Alsa cardid
local stream_pulse= {
["uid"] = "stream-pulseaudio",
+ ["verb"] = "legacy",
["zone"] = "back-seats",
["source"]= "loop-legacy",
["volume"]= 80,
@@ -196,22 +164,21 @@ function _mixer_simple_test_ (source, args)
--- ================ Create Mixer =========================
local MyTestHal= {
- ["uid"] = "MyMixer",
+ ["uid"] = "HAL-LUA-8CH-USB",
+ ["prefix"] = "default",
["ramps"] = volume_ramps,
["playbacks"]= {snd_usb_8ch },
["captures"] = {snd_usb_8ch },
- ["loops"] = {snd_aloop},
- ["zones"] = {zone_stereo, zone_front, zone_back, zone_middle, zone_driver},
- ["streams"] = {stream_pulse, stream_music, stream_navigation, stream_radio },
+ ["zones"] = {zone_stereo, zone_front, zone_back, zone_middle},
+ ["streams"] = {stream_pulse, stream_music, stream_navigation, stream_emergency },
}
error,result= AFB:servsync(source, "smixer", "attach", MyTestHal)
-
if (error) then
- AFB:error (source, "--InLua-- API MyMixer/attach fail error=%d", error)
+ AFB:error (source, "--InLua-- API smixer/attach fail error=%d %s", error, Dump_Table(result))
goto OnErrorExit
else
- AFB:notice (source, "--InLua-- MyMixer/attach done result=%s\n", Dump_Table(result))
+ AFB:notice (source, "--InLua-- smixer/attach done result=%s\n", Dump_Table(result))
end
-- ================== Happy End =============================
@@ -221,9 +188,9 @@ function _mixer_simple_test_ (source, args)
-- ================= Unhappy End ============================
::OnErrorExit::
local response=result["request"]
- printf ("--InLua-- ------------STATUS= %s --------------", result["status"])
+ printf ("--InLua-- ------------STATUS= %s --------------", response["status"])
printf ("--InLua-- ++ INFO= %s", Dump_Table(response["info"]))
- printf ("--InLua-- ----------TEST %s-------------", result["status"])
+ printf ("--InLua-- ----------TEST %s-------------", response["status"])
AFB:error (source, "--InLua-- Test Fail")
return 1 -- unhappy end --
diff --git a/mixer-binding/mixer-binding.c b/mixer-binding/mixer-binding.c
index ab61baa..20d4651 100644
--- a/mixer-binding/mixer-binding.c
+++ b/mixer-binding/mixer-binding.c
@@ -40,7 +40,7 @@ STATIC void ctrlapi_ping (AFB_ReqT request) {
count++;
AFB_ReqNotice (request, "Controller:ping count=%d", count);
- AFB_ReqSucess(request,json_object_new_int(count), NULL);
+ AFB_ReqSuccess(request,json_object_new_int(count), NULL);
return;
}
diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml
index c6d3673..115cebe 100644
--- a/nbproject/configurations.xml
+++ b/nbproject/configurations.xml
@@ -99,8 +99,6 @@
flavor2="2">
<cTool flags="0">
<incDir>
- <pElem>app-controller-submodule/ctl-lib</pElem>
- <pElem>build/app-controller-submodule/ctl-lib</pElem>
<pElem>/usr/include/json-c</pElem>
<pElem>../../../opt/include</pElem>
<pElem>/usr/include/p11-kit-1</pElem>
@@ -112,9 +110,9 @@
</incDir>
<preprocessorList>
<Elem>AFB_BINDING_VERSION=dyn</Elem>
- <Elem>CONTROL_CONFIG_PATH="/home/fulup/opt/4a-softmixer/etc:/home/fulup/Workspace/Audio-4a/4a-softmixer/build/package/etc"</Elem>
- <Elem>CONTROL_LUA_PATH="/home/fulup/Workspace/Audio-4a/4a-softmixer/conf.d/project/lua.d:/home/fulup/opt/4a-softmixer/data"</Elem>
- <Elem>CONTROL_PLUGIN_PATH="/home/fulup/opt/4a-softmixer/lib/plugins:/home/fulup/Workspace/Audio-4a/4a-softmixer/build/package/lib/plugins"</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/smixer/etc"</Elem>
+ <Elem>CONTROL_LUA_PATH="/home/fulup/Workspace/Audio-4a/4a-softmixer/conf.d/project/lua.d:/home/fulup/opt/smixer/var"</Elem>
+ <Elem>CONTROL_PLUGIN_PATH="/home/fulup/Workspace/Audio-4a/4a-softmixer/build/package/lib/plugins:/home/fulup/opt/smixer/lib/plugins"</Elem>
<Elem>CTL_PLUGIN_MAGIC=987456123</Elem>
<Elem>USE_API_DYN=1</Elem>
</preprocessorList>
@@ -123,8 +121,6 @@
<item path="app-afb-helpers-submodule/escape.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/json-c</pElem>
<pElem>../../../opt/include</pElem>
<pElem>/usr/include/p11-kit-1</pElem>
@@ -136,9 +132,9 @@
</incDir>
<preprocessorList>
<Elem>AFB_BINDING_VERSION=dyn</Elem>
- <Elem>CONTROL_CONFIG_PATH="/home/fulup/opt/4a-softmixer/etc:/home/fulup/Workspace/Audio-4a/4a-softmixer/build/package/etc"</Elem>
- <Elem>CONTROL_LUA_PATH="/home/fulup/Workspace/Audio-4a/4a-softmixer/conf.d/project/lua.d:/home/fulup/opt/4a-softmixer/data"</Elem>
- <Elem>CONTROL_PLUGIN_PATH="/home/fulup/opt/4a-softmixer/lib/plugins:/home/fulup/Workspace/Audio-4a/4a-softmixer/build/package/lib/plugins"</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/smixer/etc"</Elem>
+ <Elem>CONTROL_LUA_PATH="/home/fulup/Workspace/Audio-4a/4a-softmixer/conf.d/project/lua.d:/home/fulup/opt/smixer/var"</Elem>
+ <Elem>CONTROL_PLUGIN_PATH="/home/fulup/Workspace/Audio-4a/4a-softmixer/build/package/lib/plugins:/home/fulup/opt/smixer/lib/plugins"</Elem>
<Elem>CTL_PLUGIN_MAGIC=987456123</Elem>
<Elem>USE_API_DYN=1</Elem>
</preprocessorList>
@@ -152,6 +148,7 @@
<incDir>
<pElem>../../../opt/include/afb</pElem>
<pElem>app-afb-helpers-submodule</pElem>
+ <pElem>/usr/lib64/gcc/x86_64-suse-linux/7/include</pElem>
<pElem>../../../opt/include</pElem>
<pElem>build/app-afb-helpers-submodule</pElem>
</incDir>
@@ -164,6 +161,7 @@
<cTool flags="1">
<incDir>
<pElem>app-afb-helpers-submodule</pElem>
+ <pElem>/usr/lib64/gcc/x86_64-suse-linux/7/include</pElem>
<pElem>build/app-afb-helpers-submodule</pElem>
</incDir>
</cTool>
@@ -174,6 +172,10 @@
flavor2="3">
<cTool flags="1">
<incDir>
+ <pElem>../../../opt/include/afb</pElem>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/lib64/gcc/x86_64-suse-linux/7/include</pElem>
+ <pElem>/usr/include/lua5.3</pElem>
<pElem>app-afb-helpers-submodule</pElem>
<pElem>../../../opt/include</pElem>
<pElem>build/app-controller-submodule/ctl-lib</pElem>
@@ -186,7 +188,11 @@
flavor2="3">
<cTool flags="1">
<incDir>
+ <pElem>../../../opt/include/afb</pElem>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/lib64/gcc/x86_64-suse-linux/7/include</pElem>
<pElem>app-afb-helpers-submodule</pElem>
+ <pElem>/usr/include/lua5.3</pElem>
<pElem>../../../opt/include</pElem>
<pElem>build/app-controller-submodule/ctl-lib</pElem>
</incDir>
@@ -196,12 +202,27 @@
ex="false"
tool="0"
flavor2="3">
- <cTool flags="1">
+ <cTool flags="0">
<incDir>
- <pElem>app-afb-helpers-submodule</pElem>
+ <pElem>/usr/include/json-c</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>app-afb-helpers-submodule</pElem>
<pElem>build/app-controller-submodule/ctl-lib</pElem>
</incDir>
+ <preprocessorList>
+ <Elem>AFB_BINDING_VERSION=dyn</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/smixer/etc"</Elem>
+ <Elem>CONTROL_LUA_PATH="/home/fulup/Workspace/Audio-4a/4a-softmixer/conf.d/project/lua.d:/home/fulup/opt/smixer/var"</Elem>
+ <Elem>CONTROL_PLUGIN_PATH="/home/fulup/Workspace/Audio-4a/4a-softmixer/build/package/lib/plugins:/home/fulup/opt/smixer/lib/plugins"</Elem>
+ <Elem>CONTROL_SUPPORT_LUA</Elem>
+ <Elem>CTL_PLUGIN_MAGIC=987456123</Elem>
+ <Elem>USE_API_DYN=1</Elem>
+ </preprocessorList>
</cTool>
</item>
<item path="app-controller-submodule/ctl-lib/ctl-event.c"
@@ -210,6 +231,10 @@
flavor2="3">
<cTool flags="1">
<incDir>
+ <pElem>../../../opt/include/afb</pElem>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/lib64/gcc/x86_64-suse-linux/7/include</pElem>
+ <pElem>/usr/include/lua5.3</pElem>
<pElem>app-afb-helpers-submodule</pElem>
<pElem>../../../opt/include</pElem>
<pElem>build/app-controller-submodule/ctl-lib</pElem>
@@ -222,6 +247,7 @@
flavor2="3">
<cTool flags="1">
<incDir>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
<pElem>build/app-controller-submodule/ctl-lib</pElem>
</incDir>
</cTool>
@@ -232,6 +258,10 @@
flavor2="3">
<cTool flags="1">
<incDir>
+ <pElem>../../../opt/include/afb</pElem>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/lib64/gcc/x86_64-suse-linux/7/include</pElem>
+ <pElem>/usr/include/lua5.3</pElem>
<pElem>app-afb-helpers-submodule</pElem>
<pElem>../../../opt/include</pElem>
<pElem>build/app-controller-submodule/ctl-lib</pElem>
@@ -244,6 +274,10 @@
flavor2="3">
<cTool flags="1">
<incDir>
+ <pElem>../../../opt/include/afb</pElem>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/lib64/gcc/x86_64-suse-linux/7/include</pElem>
+ <pElem>/usr/include/lua5.3</pElem>
<pElem>app-afb-helpers-submodule</pElem>
<pElem>../../../opt/include</pElem>
<pElem>build/app-controller-submodule/ctl-lib</pElem>
@@ -256,6 +290,10 @@
flavor2="3">
<cTool flags="1">
<incDir>
+ <pElem>../../../opt/include/afb</pElem>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/lib64/gcc/x86_64-suse-linux/7/include</pElem>
+ <pElem>/usr/include/lua5.3</pElem>
<pElem>app-afb-helpers-submodule</pElem>
<pElem>../../../opt/include</pElem>
<pElem>build/app-controller-submodule/ctl-lib</pElem>
@@ -268,6 +306,10 @@
flavor2="3">
<cTool flags="1">
<incDir>
+ <pElem>../../../opt/include/afb</pElem>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/lib64/gcc/x86_64-suse-linux/7/include</pElem>
+ <pElem>/usr/include/lua5.3</pElem>
<pElem>app-afb-helpers-submodule</pElem>
<pElem>../../../opt/include</pElem>
<pElem>build/app-controller-submodule/ctl-lib</pElem>
@@ -277,17 +319,18 @@
<folder path="0/app-controller-submodule">
<cTool>
<incDir>
- <pElem>../../../opt/include/afb</pElem>
+ <pElem>/usr/include/json-c</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>app-afb-helpers-submodule</pElem>
+ <pElem>build/app-controller-submodule/ctl-lib</pElem>
</incDir>
<preprocessorList>
- <Elem>AFB_BINDING_VERSION=dyn</Elem>
- <Elem>CONTROL_CONFIG_PATH="/home/fulup/opt/4a-softmixer/etc:/home/fulup/Workspace/Audio-4a/4a-softmixer/build/package/etc"</Elem>
- <Elem>CONTROL_LUA_PATH="/home/fulup/Workspace/Audio-4a/4a-softmixer/conf.d/project/lua.d:/home/fulup/opt/4a-softmixer/data"</Elem>
- <Elem>CONTROL_PLUGIN_PATH="/home/fulup/opt/4a-softmixer/lib/plugins:/home/fulup/Workspace/Audio-4a/4a-softmixer/build/package/lib/plugins"</Elem>
<Elem>CONTROL_SUPPORT_LUA</Elem>
- <Elem>CTL_PLUGIN_MAGIC=987456123</Elem>
- <Elem>USE_API_DYN=1</Elem>
</preprocessorList>
</cTool>
</folder>
@@ -296,6 +339,7 @@
<incDir>
<pElem>../../../opt/include/afb</pElem>
<pElem>mixer-binding</pElem>
+ <pElem>/usr/lib64/gcc/x86_64-suse-linux/7/include</pElem>
<pElem>../../../opt/include/alsa</pElem>
<pElem>app-afb-helpers-submodule</pElem>
<pElem>app-controller-submodule/ctl-lib</pElem>
@@ -322,10 +366,11 @@
</incDir>
<preprocessorList>
<Elem>AFB_BINDING_VERSION=dyn</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>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/smixer/etc"</Elem>
+ <Elem>CONTROL_LUA_PATH="/home/fulup/Workspace/Audio-4a/4a-softmixer/conf.d/project/lua.d:/home/fulup/opt/smixer/var"</Elem>
+ <Elem>CONTROL_PLUGIN_PATH="/home/fulup/Workspace/Audio-4a/4a-softmixer/build/package/lib/plugins:/home/fulup/opt/smixer/lib/plugins"</Elem>
<Elem>CTL_PLUGIN_MAGIC=987456123</Elem>
+ <Elem>NATIVE_LINUX</Elem>
<Elem>USE_API_DYN=1</Elem>
</preprocessorList>
</cTool>
@@ -337,18 +382,6 @@
<item path="plugins/alsa/alsa-api-loop.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>mixer-binding</pElem>
- <pElem>app-afb-helpers-submodule</pElem>
- <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -359,18 +392,6 @@
<item path="plugins/alsa/alsa-api-mixer.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>mixer-binding</pElem>
- <pElem>app-afb-helpers-submodule</pElem>
- <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -381,18 +402,6 @@
<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>mixer-binding</pElem>
- <pElem>app-afb-helpers-submodule</pElem>
- <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -403,18 +412,6 @@
<item path="plugins/alsa/alsa-api-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>mixer-binding</pElem>
- <pElem>app-afb-helpers-submodule</pElem>
- <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -425,18 +422,6 @@
<item path="plugins/alsa/alsa-api-sink.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>mixer-binding</pElem>
- <pElem>app-afb-helpers-submodule</pElem>
- <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -447,18 +432,6 @@
<item path="plugins/alsa/alsa-api-source.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>mixer-binding</pElem>
- <pElem>app-afb-helpers-submodule</pElem>
- <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -469,16 +442,7 @@
<item path="plugins/alsa/alsa-api-streams.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
- <pElem>/usr/include/json-c</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>
</incDir>
<preprocessorList>
<Elem>alsa_softmixer_EXPORTS</Elem>
@@ -488,18 +452,6 @@
<item path="plugins/alsa/alsa-api-zones.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>mixer-binding</pElem>
- <pElem>app-afb-helpers-submodule</pElem>
- <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -509,25 +461,10 @@
</item>
<item path="plugins/alsa/alsa-capture.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>mixer-binding</pElem>
- <pElem>app-afb-helpers-submodule</pElem>
- <pElem>build/plugins/alsa</pElem>
- </incDir>
<preprocessorList>
<Elem>CONTROL_CONFIG_PATH="/home/fulup/opt/4a-softmixer/etc:/home/fulup/Workspace/Audio-4a/4a-softmixer/build/package/etc"</Elem>
<Elem>CONTROL_LUA_PATH="/home/fulup/opt/4a-softmixer/data:/home/fulup/Workspace/Audio-4a/4a-softmixer/conf.d/project/lua.d"</Elem>
<Elem>CONTROL_PLUGIN_PATH="/home/fulup/opt/4a-softmixer/lib/plugins:/home/fulup/Workspace/Audio-4a/4a-softmixer/build/package/lib/plugins"</Elem>
- <Elem>NATIVE_LINUX</Elem>
<Elem>alsa_router_EXPORTS</Elem>
</preprocessorList>
</cTool>
@@ -535,18 +472,6 @@
<item path="plugins/alsa/alsa-core-ctl.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>mixer-binding</pElem>
- <pElem>app-afb-helpers-submodule</pElem>
- <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -557,18 +482,6 @@
<item path="plugins/alsa/alsa-core-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>mixer-binding</pElem>
- <pElem>app-afb-helpers-submodule</pElem>
- <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -579,18 +492,6 @@
<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>mixer-binding</pElem>
- <pElem>app-afb-helpers-submodule</pElem>
- <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -601,18 +502,6 @@
<item path="plugins/alsa/alsa-plug-dmix.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>mixer-binding</pElem>
- <pElem>app-afb-helpers-submodule</pElem>
- <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -623,18 +512,6 @@
<item path="plugins/alsa/alsa-plug-rate.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>mixer-binding</pElem>
- <pElem>app-afb-helpers-submodule</pElem>
- <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -645,18 +522,6 @@
<item path="plugins/alsa/alsa-plug-route.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>mixer-binding</pElem>
- <pElem>app-afb-helpers-submodule</pElem>
- <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -667,18 +532,6 @@
<item path="plugins/alsa/alsa-plug-vol.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>mixer-binding</pElem>
- <pElem>app-afb-helpers-submodule</pElem>
- <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -689,18 +542,6 @@
<item path="plugins/alsa/alsa-softmixer.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>mixer-binding</pElem>
- <pElem>app-afb-helpers-submodule</pElem>
- <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -711,18 +552,6 @@
<item path="plugins/alsa/alsa-utils-bypath.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>mixer-binding</pElem>
- <pElem>app-afb-helpers-submodule</pElem>
- <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -733,18 +562,6 @@
<item path="plugins/alsa/alsa-utils-dump.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>mixer-binding</pElem>
- <pElem>app-afb-helpers-submodule</pElem>
- <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
diff --git a/plugins/alsa/alsa-api-loop.c b/plugins/alsa/alsa-api-loop.c
index 16fe9fc..6995e25 100644
--- a/plugins/alsa/alsa-api-loop.c
+++ b/plugins/alsa/alsa-api-loop.c
@@ -161,7 +161,7 @@ PUBLIC int ApiLoopAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, j
}
if (index == mixer->max.loops) {
- AFB_ReqFailF(request, "too-small", "mixer=%s hal=%s max loop=%d argsJ= %s", mixer->uid, uid, mixer->max.loops, json_object_get_string(argsJ));
+ AFB_IfReqFailF(mixer, request, "too-small", "mixer=%s hal=%s max loop=%d", mixer->uid, uid, mixer->max.loops);
goto OnErrorExit;
}
@@ -171,15 +171,15 @@ PUBLIC int ApiLoopAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, j
case json_type_object:
mixer->loops[index] = AttachOneLoop(mixer, uid, argsJ);
if (!mixer->loops[index]) {
- AFB_ReqFailF(request, "invalid-syntax", "mixer=%s hal=%s invalid loop= %s", mixer->uid, uid, json_object_get_string(argsJ));
+ AFB_IfReqFailF(mixer, request, "invalid-syntax", "mixer=%s hal=%s invalid loop= %s", mixer->uid, uid, json_object_get_string(argsJ));
goto OnErrorExit;
}
break;
case json_type_array:
count = json_object_array_length(argsJ);
- if (count > (mixer->max.loops - count)) {
- AFB_ReqFailF(request, "too-small", "mixer=%s hal=%s max loop=%d argsJ= %s", mixer->uid, uid, mixer->max.loops, json_object_get_string(argsJ));
+ if (count > (mixer->max.loops - index)) {
+ AFB_IfReqFailF(mixer, request, "too-small", "mixer=%s hal=%s max loop=%d", mixer->uid, uid, mixer->max.loops);
goto OnErrorExit;
}
@@ -188,13 +188,13 @@ PUBLIC int ApiLoopAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, j
json_object *loopJ = json_object_array_get_idx(argsJ, idx);
mixer->loops[index + idx] = AttachOneLoop(mixer, uid, loopJ);
if (!mixer->loops[index + idx]) {
- AFB_ReqFailF(request, "invalid-syntax", "mixer=%s hal=%s invalid loop= %s", mixer->uid, uid, json_object_get_string(loopJ));
+ AFB_IfReqFailF(mixer, request, "invalid-syntax", "mixer=%s hal=%s invalid loop= %s", mixer->uid, uid, json_object_get_string(loopJ));
goto OnErrorExit;
}
}
break;
default:
- AFB_ReqFailF(request, "invalid-syntax", "mixer=%s hal=%s loops invalid argsJ= %s", mixer->uid, uid, json_object_get_string(argsJ));
+ AFB_IfReqFailF(mixer, request, "invalid-syntax", "mixer=%s hal=%s loops invalid argsJ= %s", mixer->uid, uid, json_object_get_string(argsJ));
goto OnErrorExit;
}
diff --git a/plugins/alsa/alsa-api-mixer.c b/plugins/alsa/alsa-api-mixer.c
index 8616384..ca90649 100644
--- a/plugins/alsa/alsa-api-mixer.c
+++ b/plugins/alsa/alsa-api-mixer.c
@@ -62,7 +62,7 @@ static void MixerRemoveVerb(AFB_ReqT request) {
// finally free mixer handle
free(mixer);
- AFB_ReqSucess(request, NULL, "Fulup: delete might not clean everything properly");
+ AFB_ReqSuccess(request, NULL, "Fulup: delete might not clean everything properly");
return;
@@ -70,21 +70,124 @@ OnErrorExit:
AFB_ReqFail(request, "internal-error", "fail to delete mixer");
}
-STATIC void MixerInfoAction(AFB_ReqT request, json_object *argsJ) {
+STATIC json_object * MixerInfoStreams(SoftMixerT *mixer, json_object *streamsJ, int verbose) {
+ const char * key;
+ json_object *valueJ;
+ json_object *responseJ = json_object_new_array();
+ AlsaStreamAudioT **streams = mixer->streams;
+
+ switch (json_object_get_type(streamsJ)) {
+
+ case json_type_null:
+ case json_type_boolean:
+
+ for (int idx = 0; streams[idx]; idx++) {
+ json_object *alsaJ;
+
+ if (!verbose) {
+ wrap_json_pack(&alsaJ, "{ss}", "alsa", streams[idx]->source);
+ json_object_array_add(responseJ, alsaJ);
+ } else {
+
+ wrap_json_pack(&alsaJ, "{ss,si,si}"
+ , "cardid", streams[idx]->source
+ , "volume", streams[idx]->volume
+ , "mute", streams[idx]->mute
+ );
+ wrap_json_pack(&valueJ, "{ss,ss,so}"
+ , "uid", streams[idx]->uid
+ , "verb", streams[idx]->verb
+ , "alsa", alsaJ
+ );
+ json_object_array_add(responseJ, valueJ);
+ }
+ }
+ break;
+
+ case json_type_string:
+
+ key = json_object_get_string(streamsJ);
+ for (int idx = 0; streams[idx]; idx++) {
+ json_object *alsaJ;
+
+ if (!strcasestr(streams[idx]->uid, key)) continue;
+
+ if (!verbose) {
+ wrap_json_pack(&alsaJ, "{ss}", "alsa", streams[idx]->source);
+ json_object_array_add(responseJ, alsaJ);
+ } else {
+
+ wrap_json_pack(&alsaJ, "{ss,si,si}"
+ , "cardid", streams[idx]->source
+ , "volume", streams[idx]->volume
+ , "mute", streams[idx]->mute
+ );
+ wrap_json_pack(&valueJ, "{ss,ss,so}"
+ , "uid", streams[idx]->uid
+ , "verb", streams[idx]->verb
+ , "alsa", alsaJ
+ );
+ json_object_array_add(responseJ, valueJ);
+ }
+ }
+ break;
+
+ case json_type_array:
+
+ for (int idx=0; idx < json_object_array_length(streamsJ); idx++) {
+ json_object *streamJ = json_object_array_get_idx(streamsJ, idx);
+ valueJ= MixerInfoStreams (mixer, streamJ, verbose);
+ json_object_array_add(responseJ, valueJ);
+ }
+
+ default:
+ goto OnErrorExit;
+ }
+ return (responseJ);
+
+OnErrorExit:
+ return NULL;
+}
+
+STATIC json_object * MixerInfoRamps(SoftMixerT *mixer, int verbose) {
+
+ json_object *rampsJ = json_object_new_array();
+ json_object *valueJ;
+
+ AlsaVolRampT **ramps = mixer->ramps;
+ for (int idx = 0; ramps[idx]; idx++) {
+ if (!verbose) {
+ json_object_array_add(rampsJ, json_object_new_string(ramps[idx]->uid));
+ } else {
+ wrap_json_pack(&valueJ, "{ss,si,si,si}"
+ , "uid", ramps[idx]->uid
+ , "delay", ramps[idx]->delay
+ , "step_down", ramps[idx]->stepDown
+ , "step_up", ramps[idx]->stepUp
+ );
+ json_object_array_add(rampsJ, valueJ);
+ }
+ }
+
+ return (rampsJ);
+}
+
+STATIC void MixerInfoAction(AFB_ReqT request, json_object * argsJ) {
SoftMixerT *mixer = (SoftMixerT*) afb_request_get_vcbdata(request);
- int error, streams = 0, quiet = 0, ramps = 0, zones = 0, captures = 0, playbacks = 0;
+ int error, verbose = 0, ramps = 0, zones = 0, captures = 0, playbacks = 0;
+ json_object *streamsJ = NULL;
if (json_object_get_type(argsJ) == json_type_null) {
- streams = 1;
+ streamsJ = json_object_new_boolean(1);
ramps = 1;
zones = 0;
captures = 0;
playbacks = 0;
} else {
- error = wrap_json_unpack(argsJ, "{s?b,s?b,s?b,s?b,s?b,s?b !}"
- , "quiet", &quiet
- , "streams", &streams
+ error = wrap_json_unpack(argsJ, "{s?b,s?o,s?b,s?b,s?b,s?b !}"
+ , "verbose", &verbose
+ , "streams", &streamsJ
, "ramps", &ramps
, "captures", &captures
, "playbacks", &playbacks
@@ -97,48 +200,17 @@ STATIC void MixerInfoAction(AFB_ReqT request, json_object *argsJ) {
}
json_object *responseJ = json_object_new_object();
- if (streams) {
- json_object *streamsJ = json_object_new_array();
- json_object *valueJ;
-
- AlsaStreamAudioT **streams = mixer->streams;
- for (int idx = 0; streams[idx]; idx++) {
- if (quiet) {
- json_object_array_add(streamsJ, json_object_new_string(streams[idx]->uid));
- } else {
- wrap_json_pack(&valueJ, "{ss,ss?,s{si,si}}"
- , "uid", streams[idx]->uid
- , "alsa", streams[idx]->source
- , "numid"
- , "volume", streams[idx]->volume
- , "mute", streams[idx]->mute
- );
- json_object_array_add(streamsJ, valueJ);
- }
-
+ if (streamsJ) {
+ json_object *resultJ = MixerInfoStreams(mixer, streamsJ, verbose);
+ if (!resultJ) {
+ AFB_ReqFailF(request, "invalid-object", "streams should be boolean or string argsJ=%s", json_object_get_string(streamsJ));
+ goto OnErrorExit;
}
- json_object_object_add(responseJ, "streams", streamsJ);
+ json_object_object_add(responseJ, "streams", resultJ);
}
if (ramps) {
- json_object *rampsJ = json_object_new_array();
- json_object *valueJ;
-
- AlsaVolRampT **ramps = mixer->ramps;
- for (int idx = 0; ramps[idx]; idx++) {
- if (quiet) {
- json_object_array_add(rampsJ, json_object_new_string(ramps[idx]->uid));
- } else {
- wrap_json_pack(&valueJ, "{ss,si,si,si}"
- , "uid", ramps[idx]->uid
- , "delay", ramps[idx]->delay
- , "step_down", ramps[idx]->stepDown
- , "step_up", ramps[idx]->stepUp
- );
- json_object_array_add(rampsJ, valueJ);
- }
-
- }
+ json_object *rampsJ = MixerInfoRamps (mixer, verbose);
json_object_object_add(responseJ, "ramps", rampsJ);
}
@@ -147,7 +219,7 @@ STATIC void MixerInfoAction(AFB_ReqT request, json_object *argsJ) {
AlsaSndZoneT **zones = mixer->zones;
for (int idx = 0; zones[idx]; idx++) {
- if (quiet) {
+ if (!verbose) {
json_object_array_add(zonesJ, json_object_new_string(zones[idx]->uid));
} else {
json_object *zoneJ = json_object_new_object();
@@ -198,7 +270,7 @@ STATIC void MixerInfoAction(AFB_ReqT request, json_object *argsJ) {
goto OnErrorExit;
}
- AFB_ReqSucess(request, responseJ, NULL);
+ AFB_ReqSuccess(request, responseJ, NULL);
return;
OnErrorExit:
@@ -206,19 +278,21 @@ OnErrorExit:
}
STATIC void MixerInfoVerb(AFB_ReqT request) {
- json_object *argsJ = afb_request_json(request);
- MixerInfoAction (request, argsJ);
+ json_object *argsJ = afb_request_json(request);
+ MixerInfoAction(request, argsJ);
}
STATIC void MixerAttachVerb(AFB_ReqT request) {
SoftMixerT *mixer = (SoftMixerT*) afb_request_get_vcbdata(request);
- const char *uid = NULL;
+ const char *uid = NULL, *prefix = NULL;
json_object *playbackJ = NULL, *captureJ = NULL, *zonesJ = NULL, *streamsJ = NULL, *rampsJ = NULL, *loopsJ = NULL;
json_object *argsJ = afb_request_json(request);
+ json_object *responseJ = json_object_new_object();
int error;
- error = wrap_json_unpack(argsJ, "{ss,s?o,s?o,s?o,s?o,s?o,s?o !}"
+ error = wrap_json_unpack(argsJ, "{ss,s?s,s?o,s?o,s?o,s?o,s?o,s?o !}"
, "uid", &uid
+ , "prefix", &prefix
, "ramps", &rampsJ
, "playbacks", &playbackJ
, "captures", &captureJ
@@ -227,7 +301,6 @@ STATIC void MixerAttachVerb(AFB_ReqT request) {
, "streams", &streamsJ
);
if (error) {
- AFB_ApiError(mixer->api, "MixerAttachVerb: invalid-syntax mixer=%s error=%s args=%s", mixer->uid, wrap_json_get_error_string(error), json_object_get_string(argsJ));
AFB_ReqFailF(request, "invalid-syntax", "mixer=%s missing 'uid|ramps|playbacks|captures|zones|streams' error=%s args=%s", mixer->uid, wrap_json_get_error_string(error), json_object_get_string(argsJ));
goto OnErrorExit;
}
@@ -255,15 +328,22 @@ STATIC void MixerAttachVerb(AFB_ReqT request) {
if (rampsJ) {
error = ApiRampAttach(mixer, request, uid, rampsJ);
if (error) goto OnErrorExit;
+
+ json_object *resultJ = MixerInfoStreams(mixer, streamsJ, 0);
+ json_object_object_add(responseJ, "ramps", resultJ);
}
if (streamsJ) {
- error = ApiStreamAttach(mixer, request, uid, streamsJ);
+ error = ApiStreamAttach(mixer, request, uid, prefix, streamsJ);
if (error) goto OnErrorExit;
+
+ json_object *resultJ = MixerInfoStreams(mixer, streamsJ, 0);
+ json_object_object_add(responseJ, "streams", resultJ);
}
- // return mixer info data after attach
- return (MixerInfoAction(request,NULL));
+ AFB_ReqSuccess(request, responseJ, NULL);
+
+ return;
OnErrorExit:
return;
@@ -273,7 +353,7 @@ STATIC void MixerPingVerb(AFB_ReqT request) {
static int count = 0;
count++;
AFB_ReqNotice(request, "Controller:ping count=%d", count);
- AFB_ReqSucess(request, json_object_new_int(count), NULL);
+ AFB_ReqSuccess(request, json_object_new_int(count), NULL);
return;
}
@@ -289,7 +369,7 @@ STATIC AFB_ApiVerbs CtrlApiVerbs[] = {
{ .verb = NULL} /* marker for end of the array */
};
-STATIC int LoadStaticVerbs(SoftMixerT *mixer, AFB_ApiVerbs *verbs) {
+STATIC int LoadStaticVerbs(SoftMixerT *mixer, AFB_ApiVerbs * verbs) {
int errcount = 0;
for (int idx = 0; verbs[idx].verb; idx++) {
@@ -299,8 +379,68 @@ STATIC int LoadStaticVerbs(SoftMixerT *mixer, AFB_ApiVerbs *verbs) {
return errcount;
};
-CTLP_CAPI(CreateMixer, source, argsJ, responseJ) {
+CTLP_CAPI(MixerAttach, source, argsJ, responseJ) {
+ SoftMixerT *mixer = source->context;
+ json_object *playbackJ = NULL, *captureJ = NULL, *zonesJ = NULL, *streamsJ = NULL, *rampsJ = NULL, *loopsJ = NULL;
+ const char* uid = source->uid, *prefix = NULL;
+
+ int error;
+
+ error = wrap_json_unpack(argsJ, "{s?s, s?o,s?o,s?o,s?o,s?o,s?o !}"
+ , "prefix", &rampsJ
+ , "ramps", &rampsJ
+ , "playbacks", &playbackJ
+ , "captures", &captureJ
+ , "loops", &loopsJ
+ , "zones", &zonesJ
+ , "streams", &streamsJ
+ );
+ if (error) {
+ AFB_ApiError(mixer->api, "MixerAttachVerb: invalid-syntax mixer=%s error=%s args=%s", mixer->uid, wrap_json_get_error_string(error), json_object_get_string(argsJ));
+ goto OnErrorExit;
+ }
+
+ if (playbackJ) {
+ error = ApiSinkAttach(mixer, NULL, uid, playbackJ);
+ if (error) goto OnErrorExit;
+ }
+
+ if (captureJ) {
+ error = ApiSourceAttach(mixer, NULL, uid, captureJ);
+ if (error) goto OnErrorExit;
+ }
+
+ if (loopsJ) {
+ error = ApiLoopAttach(mixer, NULL, uid, loopsJ);
+ if (error) goto OnErrorExit;
+ }
+
+ if (zonesJ) {
+ error = ApiZoneAttach(mixer, NULL, uid, zonesJ);
+ if (error) goto OnErrorExit;
+ }
+
+ if (rampsJ) {
+ error = ApiRampAttach(mixer, NULL, uid, rampsJ);
+ if (error) goto OnErrorExit;
+ }
+
+ if (streamsJ) {
+ error = ApiStreamAttach(mixer, NULL, uid, prefix, streamsJ);
+ if (error) goto OnErrorExit;
+ }
+
+ // return mixer info data after attach
+ return 0;
+
+OnErrorExit:
+ return -1;
+}
+
+CTLP_CAPI(MixerCreate, source, argsJ, responseJ) {
SoftMixerT *mixer = calloc(1, sizeof (SoftMixerT));
+ source->context = mixer;
+
int error;
mixer->max.loops = SMIXER_DEFLT_RAMPS;
mixer->max.sinks = SMIXER_DEFLT_SINKS;
@@ -339,14 +479,14 @@ CTLP_CAPI(CreateMixer, source, argsJ, responseJ) {
mixer->zones = calloc(mixer->max.zones + 1, sizeof (void*));
mixer->streams = calloc(mixer->max.streams + 1, sizeof (void*));
mixer->ramps = calloc(mixer->max.ramps + 1, sizeof (void*));
-
+
mixer->sdLoop = AFB_GetEventLoop(source->api);
- mixer->api= source->api;
+ mixer->api = source->api;
afb_dynapi_set_userdata(source->api, mixer);
error = LoadStaticVerbs(mixer, CtrlApiVerbs);
if (error) goto OnErrorExit;
-
+
return 0;
OnErrorExit:
diff --git a/plugins/alsa/alsa-api-pcm.c b/plugins/alsa/alsa-api-pcm.c
index 56a1b8b..64b852e 100644
--- a/plugins/alsa/alsa-api-pcm.c
+++ b/plugins/alsa/alsa-api-pcm.c
@@ -33,7 +33,7 @@ STATIC int CONVERT_PERCENT(long val, long min, long max) {
if (range == 0)
return 0;
val -= min;
- tmp = (int)rint((double) val / (double) range * 100);
+ tmp = (int) rint((double) val / (double) range * 100);
return tmp;
}
@@ -149,10 +149,10 @@ OnErrorExit:
return -1;
}
-STATIC int PcmSetControl(SoftMixerT *mixer, AlsaSndCtlT *sndcard, AlsaSndControlT *control, volumeT volType, int value) {
+STATIC int PcmSetControl(SoftMixerT *mixer, AlsaSndCtlT *sndcard, AlsaSndControlT *control, volumeT volType, int *newvol, int *oldval) {
snd_ctl_elem_id_t* elemId = NULL;
snd_ctl_elem_info_t *elemInfo;
- int error;
+ int error, value;
long curval;
assert(control->numid);
@@ -185,7 +185,7 @@ STATIC int PcmSetControl(SoftMixerT *mixer, AlsaSndCtlT *sndcard, AlsaSndControl
switch (snd_ctl_elem_info_get_type(elemInfo)) {
case SND_CTL_ELEM_TYPE_BOOLEAN:
- error = CtlElemIdSetLong(mixer, sndcard, elemId, value);
+ error = CtlElemIdSetLong(mixer, sndcard, elemId, *newvol);
break;
case SND_CTL_ELEM_TYPE_INTEGER:
@@ -193,18 +193,18 @@ STATIC int PcmSetControl(SoftMixerT *mixer, AlsaSndCtlT *sndcard, AlsaSndControl
switch (volType) {
case RVOL_ADD:
- value = CONVERT_PERCENT(curval, control->min, control->max) + value;
+ value = CONVERT_PERCENT(curval, control->min, control->max) + *newvol;
break;
case RVOL_DEL:
- value = CONVERT_PERCENT(curval, control->min, control->max) - value;
+ value = CONVERT_PERCENT(curval, control->min, control->max) - *newvol;
break;
default:
- value= value;
+ value = *newvol;
}
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);
+ AFB_ApiError(mixer->api, "PcmSetControl sndard=%s fail to write control numid=%d value=%d", sndcard->cid.cardid, control->numid, value);
goto OnErrorExit;
}
break;
@@ -219,6 +219,8 @@ STATIC int PcmSetControl(SoftMixerT *mixer, AlsaSndCtlT *sndcard, AlsaSndControl
goto OnErrorExit;
}
+ *oldval = CONVERT_PERCENT(curval, control->min, control->max);
+ *newvol = value;
free(elemId);
return 0;
@@ -229,17 +231,18 @@ OnErrorExit:
STATIC void ApiPcmVerbCB(AFB_ReqT request) {
apiVerbHandleT *handle = (apiVerbHandleT*) afb_request_get_vcbdata(request);
- int error, doQuiet = 0, doToggle = 0, doMute = -1;
+ int error, verbose = 0, doInfo = 0, doToggle = 0, doMute = -1;
json_object *volumeJ = NULL;
- json_object *responseJ = json_object_new_object();
+ json_object *responseJ = NULL;
json_object *argsJ = afb_request_json(request);
SoftMixerT *mixer = handle->mixer;
AlsaSndCtlT *sndcard = handle->pcm->sndcard;
assert(mixer && sndcard);
- error = wrap_json_unpack(argsJ, "{s?b s?b,s?b,s?o !}"
- , "quiet", &doQuiet
+ error = wrap_json_unpack(argsJ, "{s?b,s?b,s?b,s?b,s?o !}"
+ , "verbose", &verbose
+ , "info", &doInfo
, "mute", &doMute
, "toggle", &doToggle
, "volume", &volumeJ
@@ -249,10 +252,41 @@ STATIC void ApiPcmVerbCB(AFB_ReqT request) {
goto OnErrorExit;
}
+ if (verbose) responseJ=json_object_new_object();
+
+ if (doMute != -1) {
+ int mute = (int) doMute;
+
+ error += AlsaCtlNumidSetLong(mixer, sndcard, handle->pcm->mute.numid, mute);
+ if (error) {
+ AFB_ReqFailF(request, "invalid-numid", "Fail to set pause numid=%d", handle->pcm->mute.numid);
+ goto OnErrorExit;
+ }
+
+ if (verbose) {
+ json_object_object_add(responseJ, "mute", json_object_new_boolean((json_bool) mute));
+ }
+ }
+
+ if (doToggle) {
+ long mute;
+
+ error += AlsaCtlNumidGetLong(mixer, handle->pcm->sndcard, handle->pcm->mute.numid, &mute);
+ error += AlsaCtlNumidSetLong(mixer, handle->pcm->sndcard, handle->pcm->mute.numid, !mute);
+ if (error) {
+ AFB_ReqFailF(request, "invalid-numid", "Fail to toogle pause numid=%d", handle->pcm->mute.numid);
+ goto OnErrorExit;
+ }
+
+ if (verbose) {
+ json_object_object_add(responseJ, "mute", json_object_new_boolean((json_bool)!mute));
+ }
+ }
+
if (volumeJ) {
volumeT volType;
- int newvol;
+ int newvol, oldvol;
const char*volString;
switch (json_object_get_type(volumeJ)) {
@@ -287,19 +321,20 @@ STATIC void ApiPcmVerbCB(AFB_ReqT request) {
}
- error = PcmSetControl(mixer, handle->pcm->sndcard, &handle->pcm->volume, volType, newvol);
+ error = PcmSetControl(mixer, handle->pcm->sndcard, &handle->pcm->volume, volType, &newvol, &oldvol);
if (error) {
AFB_ReqFailF(request, "invalid-ctl", "Fail to set volume hal=%s card=%s numid=%d name=%s value=%d"
, handle->uid, handle->pcm->sndcard->cid.cardid, handle->pcm->volume.numid, handle->pcm->volume.name, newvol);
goto OnErrorExit;
}
-
- if (!doQuiet) {
- json_object_object_add(responseJ, "volume", json_object_new_int(newvol));
+
+ if (verbose) {
+ json_object_object_add(responseJ, "volnew", json_object_new_int(newvol));
+ json_object_object_add(responseJ, "volold", json_object_new_int(oldvol));
}
}
- AFB_ReqSucess(request, responseJ, handle->uid);
+ AFB_ReqSuccess(request, responseJ, handle->uid);
return;
OnErrorExit:
@@ -352,26 +387,26 @@ PUBLIC AlsaPcmHwInfoT * ApiPcmSetParams(SoftMixerT *mixer, const char *uid, json
goto OnErrorExit;
check_access:
- AFB_ApiNotice(mixer->api, "ApiPcmSetParams:%s format set to SND_PCM_FORMAT_%s",uid, params->formatS);
+ AFB_ApiNotice(mixer->api, "ApiPcmSetParams:%s format set to SND_PCM_FORMAT_%s", uid, params->formatS);
#define ACCESS_CHECK(arg) if (!strcmp(access,#arg)) { params->access = SND_PCM_ACCESS_##arg; goto success;}
- if (!access) {
+ if (!access) {
params->access = SND_PCM_ACCESS_RW_INTERLEAVED;
goto success;
}
- ACCESS_CHECK(MMAP_INTERLEAVED);
- ACCESS_CHECK(MMAP_NONINTERLEAVED);
- ACCESS_CHECK(MMAP_COMPLEX);
- ACCESS_CHECK(RW_INTERLEAVED);
- ACCESS_CHECK(RW_NONINTERLEAVED);
+ ACCESS_CHECK(MMAP_INTERLEAVED);
+ ACCESS_CHECK(MMAP_NONINTERLEAVED);
+ ACCESS_CHECK(MMAP_COMPLEX);
+ ACCESS_CHECK(RW_INTERLEAVED);
+ ACCESS_CHECK(RW_NONINTERLEAVED);
AFB_ApiNotice(mixer->api, "ApiPcmSetParams:%s(params) unsupported access 'RW_INTERLEAVED|MMAP_INTERLEAVED|MMAP_COMPLEX' access=%s", uid, access);
goto OnErrorExit;
success:
- AFB_ApiNotice(mixer->api, "ApiPcmSetParams:%s access set to %s", uid, access);
+ AFB_ApiNotice(mixer->api, "ApiPcmSetParams:%s access set to %s", uid, access);
return params;
OnErrorExit:
@@ -485,10 +520,10 @@ PUBLIC AlsaSndPcmT * ApiPcmAttachOne(SoftMixerT *mixer, const char *uid, snd_pcm
// create master control for this sink
char *apiVerb, *apiInfo;
if (direction == SND_PCM_STREAM_PLAYBACK) {
- (void) asprintf(&apiVerb, "%s/playback", pcm->uid);
+ (void) asprintf(&apiVerb, "%s:playback", pcm->uid);
(void) asprintf(&apiInfo, "HAL:%s SND_PCM_STREAM_PLAYBACK", uid);
} else {
- (void) asprintf(&apiVerb, "%s/capture", 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));
diff --git a/plugins/alsa/alsa-api-ramp.c b/plugins/alsa/alsa-api-ramp.c
index 002aec0..56f4c31 100644
--- a/plugins/alsa/alsa-api-ramp.c
+++ b/plugins/alsa/alsa-api-ramp.c
@@ -71,7 +71,7 @@ PUBLIC int ApiRampAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, j
}
if (index == mixer->max.ramps) {
- AFB_ReqFailF(request, "too-small", "mixer=%s hal=%s max ramp=%d argsJ= %s", mixer->uid, uid, mixer->max.ramps, json_object_get_string(argsJ));
+ AFB_ReqFailF(request, "too-small", "mixer=%s hal=%s max ramp=%d", mixer->uid, uid, mixer->max.ramps);
goto OnErrorExit;
}
@@ -88,8 +88,8 @@ PUBLIC int ApiRampAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, j
case json_type_array:
count = json_object_array_length(argsJ);
- if (count > (mixer->max.ramps - count)) {
- AFB_ReqFailF(request, "too-small", "mixer=%s hal=%s max ramp=%d argsJ= %s", mixer->uid, uid, mixer->max.ramps, json_object_get_string(argsJ));
+ if (count > (mixer->max.ramps - index)) {
+ AFB_ReqFailF(request, "too-small", "mixer=%s hal=%s max ramp=%d", mixer->uid, uid, mixer->max.ramps);
goto OnErrorExit;
}
diff --git a/plugins/alsa/alsa-api-sink.c b/plugins/alsa/alsa-api-sink.c
index ab32276..02322de 100644
--- a/plugins/alsa/alsa-api-sink.c
+++ b/plugins/alsa/alsa-api-sink.c
@@ -47,7 +47,7 @@ PUBLIC int ApiSinkAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, j
}
if (index == mixer->max.sinks) {
- AFB_ReqFailF(request, "too-small", "mixer=%s max sink=%d argsJ= %s", mixer->uid, mixer->max.sinks, json_object_get_string(argsJ));
+ AFB_ReqFailF(request, "too-small", "mixer=%s max sink=%d", mixer->uid, mixer->max.sinks);
goto OnErrorExit;
}
@@ -76,8 +76,8 @@ PUBLIC int ApiSinkAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, j
case json_type_array:
count = json_object_array_length(argsJ);
- if (count > (mixer->max.sinks - count)) {
- AFB_ReqFailF(request, "too-small", "mixer=%s max sink=%d argsJ= %s", mixer->uid, mixer->max.sinks, json_object_get_string(argsJ));
+ if (count > (mixer->max.sinks - index)) {
+ AFB_ReqFailF(request, "too-small", "mixer=%s max sink=%d", mixer->uid, mixer->max.sinks);
goto OnErrorExit;
}
diff --git a/plugins/alsa/alsa-api-source.c b/plugins/alsa/alsa-api-source.c
index 6315a14..b6e1390 100644
--- a/plugins/alsa/alsa-api-source.c
+++ b/plugins/alsa/alsa-api-source.c
@@ -40,7 +40,7 @@ PUBLIC int ApiSourceAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid,
}
if (index == mixer->max.sources) {
- AFB_ReqFailF(request, "too-small", "mixer=%s max source=%d argsJ= %s", mixer->uid, mixer->max.sources, json_object_get_string(argsJ));
+ AFB_ReqFailF(request, "too-small", "mixer=%s max source=%d", mixer->uid, mixer->max.sources);
goto OnErrorExit;
}
@@ -57,8 +57,8 @@ PUBLIC int ApiSourceAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid,
case json_type_array:
count = json_object_array_length(argsJ);
- if (count > (mixer->max.sources - count)) {
- AFB_ReqFailF(request, "too-small", "mixer=%s max source=%d argsJ= %s", mixer->uid, mixer->max.sources, json_object_get_string(argsJ));
+ if (count > (mixer->max.sources - index)) {
+ AFB_ReqFailF(request, "too-small", "mixer=%s max source=%d", mixer->uid, mixer->max.sources);
goto OnErrorExit;
}
diff --git a/plugins/alsa/alsa-api-streams.c b/plugins/alsa/alsa-api-streams.c
index 876162d..0f9786a 100644
--- a/plugins/alsa/alsa-api-streams.c
+++ b/plugins/alsa/alsa-api-streams.c
@@ -39,27 +39,30 @@ typedef struct {
STATIC void StreamApiVerbCB(AFB_ReqT request) {
apiHandleT *handle = (apiHandleT*) afb_request_get_vcbdata(request);
- int error, doClose = 0, doQuiet = 0, doToggle = 0, doMute = -1;
- long mute, volume;
- json_object *responseJ, *volumeJ = NULL, *rampJ = NULL, *argsJ = afb_request_json(request);
-
+ int error, verbose = 0, doClose = 0, doToggle = 0, doMute = -1, doInfo = 0;
+ long mute, volume, curvol;
+ json_object *volumeJ = NULL, *rampJ = NULL, *argsJ = afb_request_json(request);
+ json_object *responseJ = NULL;
SoftMixerT *mixer = handle->mixer;
AlsaSndCtlT *sndcard = handle->sndcard;
assert(mixer && sndcard);
- error = wrap_json_unpack(argsJ, "{s?b s?b,s?b,s?b,s?o,s?o !}"
- , "quiet", &doQuiet
+ error = wrap_json_unpack(argsJ, "{s?b s?b,s?b,s?b,s?b,s?o,s?o !}"
, "close", &doClose
, "mute", &doMute
, "toggle", &doToggle
+ , "info", &doInfo
+ , "verbose", &verbose
, "volume", &volumeJ
, "ramp", &rampJ
);
if (error) {
- AFB_ReqFailF(request, "syntax-error", "Missing 'close|mute|volume|quiet' args=%s", json_object_get_string(argsJ));
+ AFB_ReqFailF(request, "syntax-error", "Missing 'close|mute|volume|verbose' args=%s", json_object_get_string(argsJ));
goto OnErrorExit;
}
+ if (verbose) responseJ = json_object_new_object();
+
if (doClose) {
AFB_ReqFailF(request, "internal-error", "(Fulup) Close action still to be done mixer=%s stream=%s", mixer->uid, handle->stream->uid);
goto OnErrorExit;
@@ -68,10 +71,31 @@ STATIC void StreamApiVerbCB(AFB_ReqT request) {
if (doToggle) {
error += AlsaCtlNumidGetLong(mixer, sndcard, handle->stream->mute, &mute);
error += AlsaCtlNumidSetLong(mixer, sndcard, handle->stream->mute, !mute);
+ if (error) {
+ AFB_ReqFailF(request, "invalid-numid", "Fail to set/get pause numid=%d", handle->stream->mute);
+ goto OnErrorExit;
+ }
+
+ if (verbose) {
+ json_object_object_add(responseJ, "mute", json_object_new_boolean(!mute));
+ }
+ }
+
+ if (doMute != -1) {
+ error = AlsaCtlNumidSetLong(mixer, handle->sndcard, handle->stream->mute, !mute);
+ if (error) {
+ AFB_ReqFailF(request, "StreamApiVerbCB", "Fail to set stream volume numid=%d value=%d", handle->stream->volume, !mute);
+ goto OnErrorExit;
+ }
+
+ if (verbose) {
+ error += AlsaCtlNumidGetLong(mixer, handle->sndcard, handle->stream->mute, &mute);
+ json_object_object_add(responseJ, "mute", json_object_new_boolean((json_bool) mute));
+ }
}
if (volumeJ) {
- long curvol, newvol;
+ long newvol;
const char*volString;
error = AlsaCtlNumidGetLong(mixer, handle->sndcard, handle->stream->volume, &curvol);
@@ -116,27 +140,29 @@ STATIC void StreamApiVerbCB(AFB_ReqT request) {
AFB_ReqFailF(request, "StreamApiVerbCB", "Fail to set stream volume numid=%d value=%ld", handle->stream->volume, newvol);
goto OnErrorExit;
}
+
+ if (verbose) {
+ json_object_object_add(responseJ, "volnew", json_object_new_int((int) newvol));
+ json_object_object_add(responseJ, "volold", json_object_new_int((int) curvol));
+ }
}
if (rampJ) {
- error = AlsaVolRampApply(mixer, handle->sndcard, handle->stream, rampJ);
- if (error) {
- AFB_ReqFailF(request, "StreamApiVerbCB", "Fail to set stream volram numid=%d value=%s", handle->stream->volume, json_object_get_string(rampJ));
- goto OnErrorExit;
+ if (verbose) {
+ error = AlsaCtlNumidGetLong(mixer, handle->sndcard, handle->stream->volume, &curvol);
+ json_object_object_add(responseJ, "volold", json_object_new_int((int) curvol));
}
- }
- if (doMute != -1) {
- error = AlsaCtlNumidSetLong(mixer, handle->sndcard, handle->stream->mute, !mute);
+ error += AlsaVolRampApply(mixer, handle->sndcard, handle->stream, rampJ);
if (error) {
- AFB_ReqFailF(request, "StreamApiVerbCB", "Fail to set stream volume numid=%d value=%d", handle->stream->volume, !mute);
+ AFB_ReqFailF(request, "StreamApiVerbCB", "Fail to set stream volram numid=%d value=%s", handle->stream->volume, json_object_get_string(rampJ));
goto OnErrorExit;
}
}
- // if not in quiet mode return effective selected control values
- if (doQuiet) responseJ = NULL;
- else {
+
+ if (doInfo) {
+ json_object_put(responseJ); // free default response.
error += AlsaCtlNumidGetLong(mixer, handle->sndcard, handle->stream->volume, &volume);
error += AlsaCtlNumidGetLong(mixer, handle->sndcard, handle->stream->mute, &mute);
if (error) {
@@ -146,14 +172,15 @@ STATIC void StreamApiVerbCB(AFB_ReqT request) {
wrap_json_pack(&responseJ, "{si,sb}", "volume", volume, "mute", !mute);
}
- AFB_ReqSucess(request, responseJ, NULL);
+
+ AFB_ReqSuccess(request, responseJ, NULL);
return;
OnErrorExit:
return;
}
-PUBLIC int CreateOneStream(SoftMixerT *mixer, AlsaStreamAudioT *stream) {
+STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT * stream) {
int error;
long value;
AlsaSndLoopT *loop = NULL;
@@ -272,9 +299,9 @@ PUBLIC int CreateOneStream(SoftMixerT *mixer, AlsaStreamAudioT *stream) {
}
if (loop) {
- (void) asprintf((char**)&stream->source, "hw:%d,%d,%d", captureDev->cardidx, loop->playback, capturePcm->cid.subdev);
+ (void) asprintf((char**) &stream->source, "hw:%d,%d,%d", captureDev->cardidx, loop->playback, capturePcm->cid.subdev);
} else {
- (void) asprintf((char**)&stream->source, "hw:%d,%d,%d", captureDev->cardidx, captureDev->device, captureDev->subdev);
+ (void) asprintf((char**) &stream->source, "hw:%d,%d,%d", captureDev->cardidx, captureDev->device, captureDev->subdev);
}
// create a dedicated verb for this stream
@@ -289,7 +316,7 @@ PUBLIC int CreateOneStream(SoftMixerT *mixer, AlsaStreamAudioT *stream) {
stream->volume = volNumid;
stream->mute = pauseNumid;
- error = afb_dynapi_add_verb(mixer->api, stream->uid, stream->info, StreamApiVerbCB, apiHandle, NULL, 0);
+ error = afb_dynapi_add_verb(mixer->api, stream->verb, stream->info, StreamApiVerbCB, apiHandle, NULL, 0);
if (error) {
AFB_ApiError(mixer->api, "CreateOneStream mixer=%s fail to Register API verb stream=%s", mixer->uid, stream->uid);
goto OnErrorExit;
@@ -307,7 +334,7 @@ OnErrorExit:
return -1;
}
-STATIC AlsaStreamAudioT * AttachOneStream(SoftMixerT *mixer, const char *uid, json_object *streamJ) {
+STATIC AlsaStreamAudioT * AttachOneStream(SoftMixerT *mixer, const char *uid, const char *prefix, json_object * streamJ) {
AlsaStreamAudioT *stream = calloc(1, sizeof (AlsaStreamAudioT));
int error;
json_object *paramsJ = NULL;
@@ -317,8 +344,9 @@ STATIC AlsaStreamAudioT * AttachOneStream(SoftMixerT *mixer, const char *uid, js
stream->mute = 0;
stream->info = NULL;
- error = wrap_json_unpack(streamJ, "{ss,s?s,ss,s?s,s?i,s?b,s?o,s?s !}"
+ error = wrap_json_unpack(streamJ, "{ss,s?s,s?s,ss,s?s,s?i,s?b,s?o,s?s !}"
, "uid", &stream->uid
+ , "verb", &stream->verb
, "info", &stream->info
, "zone", &stream->sink
, "source", &stream->source
@@ -344,8 +372,16 @@ STATIC AlsaStreamAudioT * AttachOneStream(SoftMixerT *mixer, const char *uid, js
if (stream->sink)stream->sink = strdup(stream->sink);
if (stream->source)stream->source = strdup(stream->source);
+ // Prefix verb with uid|prefix
+ if (prefix) {
+ if (stream->verb) asprintf((char**) &stream->verb, "%s:%s", prefix, stream->verb);
+ else asprintf((char**) &stream->verb, "%s:%s", prefix, stream->uid);
+ } else {
+ if (!stream->verb) asprintf((char**) &stream->verb, stream->uid);
+ }
+
// implement stream PCM with corresponding thread and controls
- error = CreateOneStream(mixer, stream);
+ error = CreateOneStream(mixer, uid, stream);
if (error) goto OnErrorExit;
return stream;
@@ -355,7 +391,7 @@ OnErrorExit:
return NULL;
}
-PUBLIC int ApiStreamAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, json_object * argsJ) {
+PUBLIC int ApiStreamAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, const char *prefix, json_object * argsJ) {
if (!mixer->loops) {
AFB_ApiError(mixer->api, "StreamsAttach: mixer=%s No Loop found [should Registry snd_loop first]", mixer->uid);
@@ -368,7 +404,7 @@ PUBLIC int ApiStreamAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid,
}
if (index == mixer->max.streams) {
- AFB_ReqFailF(request, "too-small", "mixer=%s max stream=%d argsJ= %s", mixer->uid, mixer->max.streams, json_object_get_string(argsJ));
+ AFB_ReqFailF(request, "too-small", "mixer=%s max stream=%d", mixer->uid, mixer->max.streams);
goto OnErrorExit;
}
@@ -376,7 +412,7 @@ PUBLIC int ApiStreamAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid,
long count;
case json_type_object:
- mixer->streams[index] = AttachOneStream(mixer, uid, argsJ);
+ mixer->streams[index] = AttachOneStream(mixer, uid, prefix, argsJ);
if (!mixer->streams[index]) {
AFB_ReqFailF(request, "invalid-syntax", "mixer=%s invalid stream= %s", mixer->uid, json_object_get_string(argsJ));
goto OnErrorExit;
@@ -386,14 +422,14 @@ PUBLIC int ApiStreamAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid,
case json_type_array:
count = json_object_array_length(argsJ);
- if (count > (mixer->max.streams - count)) {
- AFB_ReqFailF(request, "too-small", "mixer=%s max stream=%d argsJ= %s", mixer->uid, mixer->max.streams, json_object_get_string(argsJ));
+ if (count > (mixer->max.streams - index)) {
+ AFB_ReqFailF(request, "too-small", "mixer=%s max stream=%d", mixer->uid, mixer->max.streams);
goto OnErrorExit;
}
for (int idx = 0; idx < count; idx++) {
json_object *streamJ = json_object_array_get_idx(argsJ, idx);
- mixer->streams[index + idx] = AttachOneStream(mixer, uid, streamJ);
+ mixer->streams[index + idx] = AttachOneStream(mixer, uid, prefix, streamJ);
if (!mixer->streams[index + idx]) {
AFB_ReqFailF(request, "invalid-syntax", "mixer=%s invalid stream= %s", mixer->uid, json_object_get_string(streamJ));
goto OnErrorExit;
diff --git a/plugins/alsa/alsa-api-zones.c b/plugins/alsa/alsa-api-zones.c
index 40c36a7..cf5e995 100644
--- a/plugins/alsa/alsa-api-zones.c
+++ b/plugins/alsa/alsa-api-zones.c
@@ -135,7 +135,7 @@ PUBLIC int ApiZoneAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, j
}
if (index == mixer->max.zones) {
- AFB_ReqFailF(request, "too-small", "mixer=%s max zone=%d argsJ= %s", mixer->uid, mixer->max.zones, json_object_get_string(argsJ));
+ AFB_ReqFailF(request, "too-small", "mixer=%s max zone=%d", mixer->uid, mixer->max.zones);
goto OnErrorExit;
}
@@ -159,8 +159,8 @@ PUBLIC int ApiZoneAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, j
case json_type_array:
count = json_object_array_length(argsJ);
- if (count > (mixer->max.zones - count)) {
- AFB_ReqFailF(request, "too-small", "mixer=%s max zone=%d argsJ= %s", mixer->uid, mixer->max.zones, json_object_get_string(argsJ));
+ if (count > (mixer->max.zones - index)) {
+ AFB_ReqFailF(request, "too-small", "mixer=%s max zone=%d", mixer->uid, mixer->max.zones);
goto OnErrorExit;
}
diff --git a/plugins/alsa/alsa-core-pcm.c b/plugins/alsa/alsa-core-pcm.c
index e4936e5..aed5f22 100644
--- a/plugins/alsa/alsa-core-pcm.c
+++ b/plugins/alsa/alsa-core-pcm.c
@@ -277,8 +277,8 @@ PUBLIC int AlsaPcmCopy(SoftMixerT *mixer, AlsaStreamAudioT *stream, AlsaPcmCtlT
// Fulup need to check https://www.alsa-project.org/alsa-doc/alsa-lib/group___p_c_m___direct.html
- AlsaDumpPcmInfo(mixer,"PcmIn",pcmIn->handle);
- AlsaDumpPcmInfo(mixer,"PcmOut",pcmOut->handle);
+ //AlsaDumpPcmInfo(mixer,"PcmIn",pcmIn->handle);
+ //AlsaDumpPcmInfo(mixer,"PcmOut",pcmOut->handle);
// prepare PCM for capture and replay
error = AlsaPcmConf(mixer, pcmIn, opts);
diff --git a/plugins/alsa/alsa-plug-rate.c b/plugins/alsa/alsa-plug-rate.c
index 4c83c7f..daa8cf3 100644
--- a/plugins/alsa/alsa-plug-rate.c
+++ b/plugins/alsa/alsa-plug-rate.c
@@ -70,7 +70,7 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRate(SoftMixerT *mixer, const char* pcmName, AlsaP
}
// Debug config & pcm
- AlsaDumpCtlConfig(mixer, "plug-rate", pcmConfig, 1);
+ //AlsaDumpCtlConfig(mixer, "plug-rate", pcmConfig, 1);
//AlsaDumpCtlConfig (mixer, "plug-rate", rateConfig, 1);
AFB_ApiNotice(mixer->api, "AlsaCreateRate: %s done\n", pcmPlug->cid.cardid);
return pcmPlug;
diff --git a/plugins/alsa/alsa-plug-route.c b/plugins/alsa/alsa-plug-route.c
index ac3aa1c..306ddeb 100644
--- a/plugins/alsa/alsa-plug-route.c
+++ b/plugins/alsa/alsa-plug-route.c
@@ -172,7 +172,7 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int o
// Debug config & pcm
AFB_ApiNotice(mixer->api, "AlsaCreateRoute:zone(%s) done", zone->uid);
- AlsaDumpCtlConfig(mixer, "plug-route", routeConfig, 1);
+ //AlsaDumpCtlConfig(mixer, "plug-route", routeConfig, 1);
return pcmRoute;
OnErrorExit:
diff --git a/plugins/alsa/alsa-plug-vol.c b/plugins/alsa/alsa-plug-vol.c
index 25e382f..879901f 100644
--- a/plugins/alsa/alsa-plug-vol.c
+++ b/plugins/alsa/alsa-plug-vol.c
@@ -91,7 +91,7 @@ PUBLIC AlsaPcmCtlT *AlsaCreateSoftvol(SoftMixerT *mixer, AlsaStreamAudioT *strea
return pcmVol;
OnErrorExit:
- AlsaDumpCtlConfig (mixer, "plug-config", pcmConfig, 1);
+ //AlsaDumpCtlConfig (mixer, "plug-config", pcmConfig, 1);
AlsaDumpCtlConfig(mixer, "plug-softvol", streamConfig, 1);
AFB_ApiNotice(mixer->api, "AlsaCreateSoftvol:%s(stream) OnErrorExit\n", stream->uid);
return NULL;
diff --git a/plugins/alsa/alsa-softmixer.h b/plugins/alsa/alsa-softmixer.h
index 8572996..77d9982 100644
--- a/plugins/alsa/alsa-softmixer.h
+++ b/plugins/alsa/alsa-softmixer.h
@@ -59,6 +59,11 @@
#define ALSA_PLUG_PROTO(plugin) \
int _snd_pcm_ ## plugin ## _open(snd_pcm_t **pcmp, const char *name, snd_config_t *root, snd_config_t *conf, snd_pcm_stream_t stream, int mode)
+// auto switch from Log to API request depending on request presence.
+#define AFB_IfReqFailF(mixer, request, status, format, ...) \
+ if (request) AFB_ReqFailF(request, status, format, __VA_ARGS__); \
+ else AFB_ApiError(mixer->api, format, __VA_ARGS__);
+
#ifndef PUBLIC
#define PUBLIC
#endif
@@ -184,6 +189,7 @@ typedef struct {
typedef struct {
const char *uid;
+ const char *verb;
const char *info;
const char *sink;
const char *source;
@@ -274,8 +280,7 @@ PUBLIC AlsaPcmHwInfoT *ApiSinkGetParamsByZone(SoftMixerT *mixer, const char *tar
PUBLIC int ApiSinkAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, json_object * argsJ);
PUBLIC AlsaSndCtlT *ApiSourceFindSubdev(SoftMixerT *mixer, const char *target);
PUBLIC int ApiSourceAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, json_object * argsJ);
-PUBLIC int CreateOneStream(SoftMixerT *mixer, AlsaStreamAudioT *stream);
-PUBLIC int ApiStreamAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, json_object * argsJ);
+PUBLIC int ApiStreamAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, const char *prefix, json_object * argsJ);
PUBLIC AlsaSndZoneT *ApiZoneGetByUid(SoftMixerT *mixer, const char *target);
PUBLIC int ApiZoneAttach(SoftMixerT *mixer, AFB_ReqT request, const char *uid, json_object * argsJ);
diff --git a/plugins/alsa/alsa-utils-bypath.c b/plugins/alsa/alsa-utils-bypath.c
index f950129..c5c80ce 100644
--- a/plugins/alsa/alsa-utils-bypath.c
+++ b/plugins/alsa/alsa-utils-bypath.c
@@ -78,6 +78,7 @@ PUBLIC AlsaPcmCtlT *AlsaByPathOpenPcm(SoftMixerT *mixer, AlsaDevInfoT *pcmDev, s
pcmCtl->cid.name=NULL;
pcmCtl->cid.longname=NULL;
+ //error = snd_pcm_open(&pcmCtl->handle, pcmCtl->cid.cardid, direction, SND_PCM_NONBLOCK);
error = snd_pcm_open(&pcmCtl->handle, pcmCtl->cid.cardid, direction, SND_PCM_NONBLOCK);
if (error) {
AFB_ApiError(mixer->api, "AlsaByPathOpenPcm: fail openpcm cardid=%s error=%s", pcmCtl->cid.cardid, snd_strerror(error));