summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO9
-rwxr-xr-xbin/4a-api23
-rw-r--r--bin/4a-get_roles1
-rwxr-xr-xbin/4a-gst3
-rw-r--r--bin/4a-play1
-rw-r--r--bin/4a-speaker-test1
-rwxr-xr-xbin/4a-status51
7 files changed, 84 insertions, 5 deletions
diff --git a/TODO b/TODO
index 56d4ec2..436b8b3 100644
--- a/TODO
+++ b/TODO
@@ -1,6 +1,7 @@
* push OGG file
-* push WAV file
-* add script for basic aplay on output card
-* add script for basic aplay through loopback (softmixer)
-* add script to play mp3 or ogg using gstreamer (gst-launch-1.0 ...)
+* finish script 4a-api (calls to AHL/Hal-manager)
+* add script for basic aplay on role or device
+* add script for basic gst-launch on role or device
+* add script for speaker test on role or device
* add script to play with mediaplayer api: list / play / stop / next / prev ...
+* add script to play with radio api
diff --git a/bin/4a-api b/bin/4a-api
new file mode 100755
index 0000000..4a26121
--- /dev/null
+++ b/bin/4a-api
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+WS4A=unix:/run/user/0/apis/ws/ahl-4a
+
+afb-client-demo -H -d $WS4A get_roles ""
+
+# commandes HAL manager:
+# 4a-hal-manager loaded
+# 4a-hal-manager loaded { "verbose": true } <= +metadata
+# 4a-hal-manager loaded { "all": true } <= hals avec un json
+# 4a-hal-manager loaded { "all": true, "verbose":true }
+
+# open/close multimedia
+#afb-client-demo -H -d $WS4A << EOF
+#multimedia { "action":"open" }
+#multimedia { "action":"close" }
+#EOF
+
+# volume multimedia
+#afb-client-demo -H -d $WS4A << EOF
+#multimedia { "action":"open" }
+#multimedia { "action":"close" }
+#EOF
diff --git a/bin/4a-get_roles b/bin/4a-get_roles
deleted file mode 100644
index fc7f2d0..0000000
--- a/bin/4a-get_roles
+++ /dev/null
@@ -1 +0,0 @@
-afb-client-demo -d unix:/run/user/0/apis/ws/ahl-4a get_roles ""
diff --git a/bin/4a-gst b/bin/4a-gst
new file mode 100755
index 0000000..9a06c83
--- /dev/null
+++ b/bin/4a-gst
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+gst-launch-1.0 -v uridecodebin uri=file:///media/OrchestralBackgroundMusic.mp3 ! audioconvert ! audioresample ! alsasink device=hw:Loopback,0,2
diff --git a/bin/4a-play b/bin/4a-play
new file mode 100644
index 0000000..894ab7f
--- /dev/null
+++ b/bin/4a-play
@@ -0,0 +1 @@
+# TODO: play using aplay
diff --git a/bin/4a-speaker-test b/bin/4a-speaker-test
new file mode 100644
index 0000000..770ddfd
--- /dev/null
+++ b/bin/4a-speaker-test
@@ -0,0 +1 @@
+# TODO: run speaker test
diff --git a/bin/4a-status b/bin/4a-status
new file mode 100755
index 0000000..519f470
--- /dev/null
+++ b/bin/4a-status
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+set -o pipefail
+
+ERR="\\e[31mERROR\\e[0m"
+WRN="\\e[33mWARNING\\e[0m"
+SUC="\\e[32mSUCCESS\\e[0m"
+
+function cout {
+ echo -e "$*"
+}
+
+EXIT_CODE=0
+
+SOUND_CARDS=$( LANG="C" aplay -l | grep -oEe "^card\\s+[^\\[]+" | cut -d':' -f2 | uniq )
+
+cout " -- Is snd-aloop is available?"
+if zcat /proc/config.gz | grep "CONFIG_SND_ALOOP=y" > /dev/null; then
+ cout " -- $SUC: Built into the kernel"
+else
+ cout " -- $WRN: Not built into the kernel, devices order can randomly change!"
+ if zcat /proc/config.gz | grep "CONFIG_SND_ALOOP=m" > /dev/null; then
+ cout " -- $SUC: snd-aloop is provided!"
+ if lsmod | grep "snd_aloop" > /dev/null; then
+ cout " -- $SUC: snd-aloop is loaded!"
+ else
+ cout " -- $ERR: snd-aloop is not loaded! 4a-softmixer can't work, please load it using: modprobe snd-aloop"
+ fi
+ else
+ cout " -- $ERR: snd-aloop is not provided at all, 4a-softmixer can't work!"
+ EXIT_CODE=1
+ fi
+fi
+
+cout " -- Is 4a running?"
+if ps x | grep "service-audio-4a" | grep -v "grep" > /dev/null; then
+ cout " -- $SUC: Service is currently running!"
+else
+ cout " -- $WRN: Service is not currently running!"
+fi
+
+
+#SERVICE_FILE=$( basename "$( ls "/var/local/lib/systemd/system/afm-service-agl-service-audio-4a--"* )" )
+
+cout
+cout "Found audio cards:"
+for card in $SOUND_CARDS; do
+ cout " - $card"
+done
+
+exit $EXIT_CODE