From 9c88fd2aaf454b4ab5d4cfcb5e510196da3b74b4 Mon Sep 17 00:00:00 2001 From: fulup Date: Sun, 10 Jun 2018 22:44:07 +0200 Subject: Autorize direct zone to point on sndcard --- conf.d/project/etc/fiberdyme_hal_sample.json | 287 --------------------------- conf.d/project/etc/smixer-test-config.json | 4 +- conf.d/project/lua.d/smixer-test-usb_2ch.lua | 157 +++------------ conf.d/project/lua.d/smixer-test-usb_8ch.lua | 200 +++++++++++++++++++ conf.d/project/lua.d/smixer-test-usb_ch8.lua | 197 ------------------ 5 files changed, 232 insertions(+), 613 deletions(-) delete mode 100644 conf.d/project/etc/fiberdyme_hal_sample.json create mode 100644 conf.d/project/lua.d/smixer-test-usb_8ch.lua delete mode 100644 conf.d/project/lua.d/smixer-test-usb_ch8.lua (limited to 'conf.d') diff --git a/conf.d/project/etc/fiberdyme_hal_sample.json b/conf.d/project/etc/fiberdyme_hal_sample.json deleted file mode 100644 index 2614163..0000000 --- a/conf.d/project/etc/fiberdyme_hal_sample.json +++ /dev/null @@ -1,287 +0,0 @@ -{ - "$schema": "ToBeDone", - "metadata": { - "api": "fd-dsp", - "uid": "fiberdyne_dsp", - "info": "Fiberdyne DSP HAL for Xtensa HiFi2", - "version": "1.0", - "require": "alsacore" - }, - "plugins": [ - { - "uid": "fd-dsp-hifi2", - "info": "Fiberdyne DSP client library for HiFi2", - "basename": "fd-dsp-hifi2", - "ldpath": "./fd-dsp-hifi2" - } - ], - "comment": "These are per-stream, could look at alsa byte stream?", - "control": [ - { - "uid": "Volume", - "alsa": { - "name": "PCM Playback Volume", - "value": 50 - } - }, - { - "uid": "Mute", - "alsa": { - "name": "PCM Playback Switch", - "value": false - } - }, - { - "uid": "Bass", - "alsa": { - "name": "PCM Playback Bass", - "value": 50 - } - }, - { - "uid": "Mid", - "alsa": { - "name": "PCM Playback Mid", - "value": 50 - } - }, - { - "uid": "Treble", - "alsa": { - "name": "PCM Playback Treble", - "value": 50 - } - }, - { - "uid": "Balance", - "alsa": { - "name": "PCM Playback Balance", - "value": 50 - } - }, - { - "uid": "Fade", - "alsa": { - "name": "PCM Playback Fade", - "value": 50 - } - } - ], - "eqpoint": { - "action": [ - { - "uid": "eq-add-point", - "function": "plugin://fd-dsp-hifi2/eq_add_point" - }, - { - "uid": "eq-remove-point", - "function": "plugin://fd-dsp-hifi2/eq_remove_point" - } - ] - }, - "filter": { - "plugin": "fd-dsp-hifi2", - "action": [ - { - "uid": "filter-hip", - "function": "plugin://fd-dsp-hifi2/filter_hip" - } - ] - }, - "cards": { - "uid": "A", - "alsa": "xf-dsp-alsa:0,1", - "desc": "Xtensa R-Car HiFi2 DSP", - "action": { - "uid": "init-snd-card", - "function": "plugin://fd-dsp-hifi2/init-stereo" - }, - "channels": { - "sink": [ - { - "type": "FrontLeftFullRange", - "port": 0 - }, - { - "type": "FrontRightFullRange", - "port": 1 - }, - { - "type": "RearLeftFullRange", - "port": 2 - }, - { - "type": "FrontRightFullRange", - "port": 3 - }, - { - "type": "Center", - "port": 4 - }, - { - "type": "LFE", - "port": 5 - } - ], - "source": [ - { - "uid": "FrontRightMic", - "type": "Directional", - "port": 0 - } - ] - } - }, - "info": "This is totally an abstraction", - "zone": [ - { - "uid": "FrontSeat", - "type": "sink", - "mapping": [ - [ - "FrontRightMain", - "FrontRightHigh" - ], - [ - "FrontLeftMain", - "FrontLeftHigh" - ] - ] - }, - { - "uid": "RearSeat", - "type": "sink", - "mapping": [ - [ - "RearRightMain", - "RearRightHigh" - ], - [ - "RearLeftMain", - "RearLeftHigh" - ] - ] - }, - { - "uid": "DriverMic", - "type": "source", - "mapping": [ - [ - "FrontRightMic" - ] - ] - }, - { - "uid": "FullMicSetup", - "type":"source", - "mapping": - [ - [ "FrontLeftMic"], - [ "FrontRightMic"], - [ "RearLeftMic"], - [ "RearLeftMic"] - ] - } - { - "uid": "FiveOne", - "type": "sink", - "mapping": [ - [ - "FrontRightMain", - "FrontRightHigh" - ], - [ - "FrontLeftMain", - "FrontLeftHigh" - ], - [ - "RearRightMain", - "RearRightHigh" - ], - [ - "RearLeftMain", - "RearLeftHigh" - ], - [ - "Center" - ], - [ - "LFE" - ] - ] - }, - { - "uid": "StereoFour", - "type": "sink", - "mapping": [ - [ - "FrontRightMain", - "FrontRightHigh", - "RearRightMain", - "RearRightHigh" - ], - [ - "FrontLeftMain", - "FrontLeftHigh", - "RearLeftMain", - "RearLeftHigh" - ] - ] - } - ], - "streams": [ - { - "name": "speech-engine", - "profile": "profile-speech", - "source": { - "zone":"DriverMic", - "defaultconfig":{ - "mute": true - } - }, - "sink": { - "zone": "FrontSeat", - "defaultconfig": { - "volume": 50, - "mute": false, - "bass": 50, - "mid": 50, - "treble": 50, - "balance": 50, - "fade": 50 - } - } - }, - { - "name": "phone", - "profile": "test", - "source": { - "channels": 1, - "zone": "DriverMic", - "defaultconfig":{ - "volume":"25" - } - }, - "sink": { - "channels": 2, - "zone": "FrontSeat" - } - }, - { - "name": "stereo", - "profile": "profile-dynamic", - "sink": { - "channels": 2, - "zone": "StereoFour" - } - }, - { - "name": "5_1", - "profile": "profile-dynamic", - "sink": { - "channels": 6, - "zone": "FiveOne" - } - } - ] -} \ No newline at end of file diff --git a/conf.d/project/etc/smixer-test-config.json b/conf.d/project/etc/smixer-test-config.json index 42f9e65..8643175 100644 --- a/conf.d/project/etc/smixer-test-config.json +++ b/conf.d/project/etc/smixer-test-config.json @@ -11,7 +11,7 @@ "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-usb_ch8.lua"], + "libs": ["alsa-softmixer.ctlso", "smixer-test-usb_8ch.lua"] } ], "onload": [ @@ -26,7 +26,7 @@ "max_source": 8, "max_zone": 8, "max_stream": 8, - "max_ramp": 4, + "max_ramp": 4 } }, { diff --git a/conf.d/project/lua.d/smixer-test-usb_2ch.lua b/conf.d/project/lua.d/smixer-test-usb_2ch.lua index 99893c1..fbe466c 100644 --- a/conf.d/project/lua.d/smixer-test-usb_2ch.lua +++ b/conf.d/project/lua.d/smixer-test-usb_2ch.lua @@ -44,7 +44,7 @@ function _mixer_simple_test_ (source, args) local audio_params ={ defaults = { ["rate"] = 48000 }, standard = { ["rate"] = 44100 }, - basic= { ["rate"] = 8000 }, + basic = { ["rate"] = 8000 }, } local volume_ramps = { @@ -53,66 +53,19 @@ 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_yamaha = { - ["uid"]= "YAMAHA-APU70", - ["path"]= "/dev/snd/by-id/usb-YAMAHA_Corporation_YAMAHA_AP-U70_USB_Audio_00-00", - ["params"]= audio_params.default, - ["sink"] = { - ["channels"] = { - {["uid"]= "front-right", ["port"]= 0}, - {["uid"]= "front-left", ["port"]= 1}, - }, - } - } - - local snd_usb_8ch= { - ["uid"]= "8CH-USB", - ["path"]= "/dev/snd/by-id/usb-0d8c_USB_Sound_Device-00", - ["params"] = audio_params.default, + local snd_usb_2ch= { + ["uid"]= "STEREO-USB", + ["path"]= "/dev/snd/by-id/usb-0b0e_Jabra_SOLEMATE_v1.34.0-00", ["sink"] = { ["controls"]= { - ["volume"] = {["name"]= "Speaker Playback Volume", ["value"]=80}, - ["mute"] = {["name"]= "Speaker Playback Switch"}, + ["volume"] = {["name"]= "Playback Volume", ["value"]=80}, + ["mute"] = {["name"]= "Playback Switch"}, }, ["channels"] = { {["uid"]= "front-right", ["port"]= 0}, {["uid"]= "front-left" , ["port"]= 1}, - {["uid"]= "middle-right", ["port"]= 2}, - {["uid"]= "middle-left" , ["port"]= 3}, - {["uid"]= "back-right", ["port"]= 4}, - {["uid"]= "back-left" , ["port"]= 5}, - {["uid"]= "centre-left" , ["port"]= 6}, - {["uid"]= "centre-left" , ["port"]= 7}, - }, - }, - ["source"] = { - ["controls"]= { - ["volume"] = {["name"]= "Capture Volume"}, - ["mute"] = {["name"]= "Capture Switch"}, - }, - ["channels"] = { - {["uid"]= "mic-right", ["port"]= 0}, - {["uid"]= "mic-left" , ["port"]= 1}, }, } } @@ -121,86 +74,42 @@ function _mixer_simple_test_ (source, args) -- ============================= Zones =================== local zone_stereo={ ["uid"] = "full-stereo", - ["sink"] = { - {["target"]="front-right",["channel"]=0}, - {["target"]="front-left" ,["channel"]=1}, - {["target"]="middle-right",["channel"]=0}, - {["target"]="middle-left" ,["channel"]=1}, - {["target"]="back-right",["channel"]=0}, - {["target"]="back-left" ,["channel"]=1}, - } - } - - local zone_front= { - ["uid"] = "front-seats", ["sink"] = { {["target"]="front-right",["channel"]=0}, {["target"]="front-left" ,["channel"]=1}, } } - local zone_middle= { - ["uid"] = "middle-seats", - ["sink"] = { - {["target"]="middle-right",["channel"]=0}, - {["target"]="middle-left" ,["channel"]=1}, - } - } - - local zone_back= { - ["uid"] = "back-seats", - ["sink"] = { - {["target"]="back-right",["channel"]=0}, - {["target"]="back-left" ,["channel"]=1}, - } - } - - local zone_driver= { - ["uid"] = "driver-seat", - ["source"] = { - {["target"]="mic-right",["channel"]=0}, - }, - ["sink"] = { - {["target"]="front-right",["channel"]=0}, - } - } - - -- =================== Audio Stream ============================ + -- =================== Audio Streams ============================ local stream_music= { - ["uid"] = "multimedia", - ["zone"]= "full-stereo", - ["source"]= "loop-multimedia", + ["uid"] = "stream-multimedia", + ["verb"] = "multimedia", + ["zone"]= "JABRA-USB", ["volume"]= 80, ["mute"] = false, - ["params"]= audio_params.standard, } local stream_navigation= { - ["uid"] = "navigation", - ["zone"]= "front-seats", + ["uid"] = "stream-navigation", + ["verb"] = "navigation", + ["zone"]= "JABRA-USB", ["volume"]= 80, ["mute"] = false, } local stream_emergency= { - ["uid"] = "emergency", - ["zone"] = "driver-seat", - ["volume"]= 80, - ["mute"] = false, - --["params"]= audio_params.basic, - } - - local stream_radio= { - ["uid"] = "radio", - ["zone"] = "full-stereo", - --["source"]= snd_usb_8ch.uid, + ["uid"] = "stream-emergency", + ["verb"] = "emergency", + ["zone"] = "JABRA-USB", ["volume"]= 80, ["mute"] = false, } - + + -- Force Pulse to attach a well known Loop subdev to get a fix Alsa cardid local stream_pulse= { - ["uid"] = "pulseaudio", - ["zone"] = "back-seats", + ["uid"] = "stream-pulseaudio", + ["verb"] = "legacy", + ["zone"] = "JABRA-USB", ["source"]= "loop-legacy", ["volume"]= 80, ["mute"] = false, @@ -208,25 +117,19 @@ function _mixer_simple_test_ (source, args) --- ================ Create Mixer ========================= local MyTestHal= { - ["uid"]= "MyMixer", - ["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 }, - -- ["streams"] = {stream_pulse, stream_music, stream_navigation, stream_emergency, stream_radio }, - + ["uid"] = "HAL-LUA-2CH-USB", + ["prefix"] = "default", + ["ramps"] = volume_ramps, + ["playbacks"]= {snd_usb_2ch }, + ["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 ============================= @@ -236,9 +139,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/conf.d/project/lua.d/smixer-test-usb_8ch.lua b/conf.d/project/lua.d/smixer-test-usb_8ch.lua new file mode 100644 index 0000000..68b50fa --- /dev/null +++ b/conf.d/project/lua.d/smixer-test-usb_8ch.lua @@ -0,0 +1,200 @@ +--[[ + Copyright (C) 2016 "IoT.bzh" + Author Fulup Ar Foll + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + NOTE: strict mode: every global variables should be prefixed by '_' +--]] + +-- Static variables should be prefixed with _ +_EventHandle={} + + +-- make variable visible from ::OnExitError:: +local error +local result + + +local printf = function(s,...) + io.write(s:format(...)) + io.write("\n") + return +end + +-- Display receive arguments and echo them to caller +function _mixer_simple_test_ (source, args) + do + + -- Mixer UID is used as API name + + -- ==================== Default rate =========================== + + local audio_params ={ + R48000 = { ["rate"] = 48000 }, + R44100 = { ["rate"] = 44100 }, + R8000 = { ["rate"] = 8000 }, + } + + local volume_ramps = { + {["uid"]="ramp-fast", ["delay"]= 050, ["up"]=10,["down"]=3}, + {["uid"]="ramp-slow", ["delay"]= 250, ["up"]=03,["down"]=1}, + {["uid"]="ramp-normal", ["delay"]= 100, ["up"]=06,["down"]=2}, + } + + -- ============================= Backend (Sound Cards) =================== + + local snd_usb_8ch= { + ["uid"]= "8CH-USB", + ["path"]= "/dev/snd/by-id/usb-0d8c_USB_Sound_Device-00", + ["params"] = audio_params.R48000, + ["sink"] = { + ["controls"]= { + ["volume"] = {["name"]= "Speaker Playback Volume", ["value"]=80}, + ["mute"] = {["name"]= "Speaker Playback Switch"}, + }, + ["channels"] = { + {["uid"]= "front-right", ["port"]= 0}, + {["uid"]= "front-left" , ["port"]= 1}, + {["uid"]= "middle-right", ["port"]= 2}, + {["uid"]= "middle-left" , ["port"]= 3}, + {["uid"]= "back-right", ["port"]= 4}, + {["uid"]= "back-left" , ["port"]= 5}, + {["uid"]= "centre-left" , ["port"]= 6}, + {["uid"]= "centre-left" , ["port"]= 7}, + }, + }, + ["source"] = { + ["controls"]= { + ["volume"] = {["name"]= "Capture Volume"}, + ["mute"] = {["name"]= "Capture Switch"}, + }, + ["channels"] = { + {["uid"]= "mic-right", ["port"]= 0}, + {["uid"]= "mic-left" , ["port"]= 1}, + }, + } + } + + + -- ============================= Zones =================== + local zone_stereo={ + ["uid"] = "full-stereo", + ["sink"] = { + {["target"]="front-right",["channel"]=0}, + {["target"]="front-left" ,["channel"]=1}, + {["target"]="middle-right",["channel"]=0}, + {["target"]="middle-left" ,["channel"]=1}, + {["target"]="back-right",["channel"]=0}, + {["target"]="back-left" ,["channel"]=1}, + } + } + + local zone_front= { + ["uid"] = "front-seats", + ["sink"] = { + {["target"]="front-right",["channel"]=0}, + {["target"]="front-left" ,["channel"]=1}, + } + } + + local zone_middle= { + ["uid"] = "middle-seats", + ["sink"] = { + {["target"]="middle-right",["channel"]=0}, + {["target"]="middle-left" ,["channel"]=1}, + } + } + + local zone_back= { + ["uid"] = "back-seats", + ["sink"] = { + {["target"]="back-right",["channel"]=0}, + {["target"]="back-left" ,["channel"]=1}, + } + } + + + -- =================== Audio Streams ============================ + local stream_music= { + ["uid"] = "stream-multimedia", + ["verb"] = "multimedia", + ["zone"] = "full-stereo", + ["volume"]= 80, + ["mute"] = false, + ["params"] = audio_params.R48000, + } + + local stream_navigation= { + ["uid"] = "stream-navigation", + ["verb"] = "navigation", + ["zone"] = "front-seats", + ["volume"]= 80, + ["mute"] = false, + ["params"] = audio_params.R48000, + } + + local stream_emergency= { + ["uid"] = "stream-emergency", + ["verb"] = "emergency", + ["zone"] = "front-seats", + ["volume"]= 80, + ["mute"] = false, + ["params"] = audio_params.R48000, + } + + -- 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, + ["mute"] = false, + ["params"] = audio_params.R48000, + } + + --- ================ Create Mixer ========================= + local MyTestHal= { + ["uid"] = "HAL-LUA-8CH-USB", + ["prefix"] = "default", + ["ramps"] = volume_ramps, + ["playbacks"]= {snd_usb_8ch }, + ["captures"] = {snd_usb_8ch }, + ["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 smixer/attach fail error=%d %s", error, Dump_Table(result)) + goto OnErrorExit + else + AFB:notice (source, "--InLua-- smixer/attach done result=%s\n", Dump_Table(result)) + end + + -- ================== Happy End ============================= + AFB:notice (source, "--InLua-- Test success") + return 0 end + + -- ================= Unhappy End ============================ + ::OnErrorExit:: + local response=result["request"] + printf ("--InLua-- ------------STATUS= %s --------------", response["status"]) + printf ("--InLua-- ++ INFO= %s", Dump_Table(response["info"])) + printf ("--InLua-- ----------TEST %s-------------", response["status"]) + + AFB:error (source, "--InLua-- Test Fail") + return 1 -- unhappy end -- +end diff --git a/conf.d/project/lua.d/smixer-test-usb_ch8.lua b/conf.d/project/lua.d/smixer-test-usb_ch8.lua deleted file mode 100644 index 2b804b6..0000000 --- a/conf.d/project/lua.d/smixer-test-usb_ch8.lua +++ /dev/null @@ -1,197 +0,0 @@ ---[[ - Copyright (C) 2016 "IoT.bzh" - Author Fulup Ar Foll - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - NOTE: strict mode: every global variables should be prefixed by '_' ---]] - --- Static variables should be prefixed with _ -_EventHandle={} - - --- make variable visible from ::OnExitError:: -local error -local result - - -local printf = function(s,...) - io.write(s:format(...)) - io.write("\n") - return -end - --- Display receive arguments and echo them to caller -function _mixer_simple_test_ (source, args) - do - - -- Mixer UID is used as API name - - -- ==================== Default rate =========================== - - local audio_params ={ - defaults = { ["rate"] = 48000 }, - standard = { ["rate"] = 44100 }, - basic = { ["rate"] = 8000 }, - } - - local volume_ramps = { - {["uid"]="ramp-fast", ["delay"]= 050, ["up"]=10,["down"]=3}, - {["uid"]="ramp-slow", ["delay"]= 250, ["up"]=03,["down"]=1}, - {["uid"]="ramp-normal", ["delay"]= 100, ["up"]=06,["down"]=2}, - } - - -- ============================= Backend (Sound Cards) =================== - - local snd_usb_8ch= { - ["uid"]= "8CH-USB", - ["path"]= "/dev/snd/by-id/usb-0d8c_USB_Sound_Device-00", - ["params"] = audio_params.default, - ["sink"] = { - ["controls"]= { - ["volume"] = {["name"]= "Speaker Playback Volume", ["value"]=80}, - ["mute"] = {["name"]= "Speaker Playback Switch"}, - }, - ["channels"] = { - {["uid"]= "front-right", ["port"]= 0}, - {["uid"]= "front-left" , ["port"]= 1}, - {["uid"]= "middle-right", ["port"]= 2}, - {["uid"]= "middle-left" , ["port"]= 3}, - {["uid"]= "back-right", ["port"]= 4}, - {["uid"]= "back-left" , ["port"]= 5}, - {["uid"]= "centre-left" , ["port"]= 6}, - {["uid"]= "centre-left" , ["port"]= 7}, - }, - }, - ["source"] = { - ["controls"]= { - ["volume"] = {["name"]= "Capture Volume"}, - ["mute"] = {["name"]= "Capture Switch"}, - }, - ["channels"] = { - {["uid"]= "mic-right", ["port"]= 0}, - {["uid"]= "mic-left" , ["port"]= 1}, - }, - } - } - - - -- ============================= Zones =================== - local zone_stereo={ - ["uid"] = "full-stereo", - ["sink"] = { - {["target"]="front-right",["channel"]=0}, - {["target"]="front-left" ,["channel"]=1}, - {["target"]="middle-right",["channel"]=0}, - {["target"]="middle-left" ,["channel"]=1}, - {["target"]="back-right",["channel"]=0}, - {["target"]="back-left" ,["channel"]=1}, - } - } - - local zone_front= { - ["uid"] = "front-seats", - ["sink"] = { - {["target"]="front-right",["channel"]=0}, - {["target"]="front-left" ,["channel"]=1}, - } - } - - local zone_middle= { - ["uid"] = "middle-seats", - ["sink"] = { - {["target"]="middle-right",["channel"]=0}, - {["target"]="middle-left" ,["channel"]=1}, - } - } - - local zone_back= { - ["uid"] = "back-seats", - ["sink"] = { - {["target"]="back-right",["channel"]=0}, - {["target"]="back-left" ,["channel"]=1}, - } - } - - - -- =================== Audio Streams ============================ - local stream_music= { - ["uid"] = "stream-multimedia", - ["verb"] = "multimedia", - ["zone"]= "full-stereo", - ["volume"]= 80, - ["mute"] = false, - ["params"]= audio_params.standard, - } - - local stream_navigation= { - ["uid"] = "stream-navigation", - ["verb"] = "navigation", - ["zone"]= "front-seats", - ["volume"]= 80, - ["mute"] = false, - } - - local stream_emergency= { - ["uid"] = "stream-emergency", - ["verb"] = "emergency", - ["zone"] = "front-seats", - ["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, - ["mute"] = false, - } - - --- ================ Create Mixer ========================= - local MyTestHal= { - ["uid"] = "HAL-LUA-8CH-USB", - ["prefix"] = "default", - ["ramps"] = volume_ramps, - ["playbacks"]= {snd_usb_8ch }, - ["captures"] = {snd_usb_8ch }, - ["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 smixer/attach fail error=%d %s", error, Dump_Table(result)) - goto OnErrorExit - else - AFB:notice (source, "--InLua-- smixer/attach done result=%s\n", Dump_Table(result)) - end - - -- ================== Happy End ============================= - AFB:notice (source, "--InLua-- Test success") - return 0 end - - -- ================= Unhappy End ============================ - ::OnErrorExit:: - local response=result["request"] - printf ("--InLua-- ------------STATUS= %s --------------", response["status"]) - printf ("--InLua-- ++ INFO= %s", Dump_Table(response["info"])) - printf ("--InLua-- ----------TEST %s-------------", response["status"]) - - AFB:error (source, "--InLua-- Test Fail") - return 1 -- unhappy end -- -end -- cgit 1.2.3-korg