From 534c6d7633a566d117ec3a8cd4563283e85b1a77 Mon Sep 17 00:00:00 2001
From: Ronan Le Martret <ronan.lemartret@iot.bzh>
Date: Wed, 18 Jul 2018 13:52:48 +0200
Subject: Add Make file

Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
---
 media/OrchestralBackgroundMusic.mp3 | Bin 0 -> 2149250 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 media/OrchestralBackgroundMusic.mp3

(limited to 'media')

diff --git a/media/OrchestralBackgroundMusic.mp3 b/media/OrchestralBackgroundMusic.mp3
new file mode 100644
index 0000000..0507784
Binary files /dev/null and b/media/OrchestralBackgroundMusic.mp3 differ
-- 
cgit 1.2.3-korg


From 15f0344df8bfbd8daf7a383bfccfa0d3cd7d75b9 Mon Sep 17 00:00:00 2001
From: Loïc Collignon <loic.collignon@iot.bzh>
Date: Fri, 20 Jul 2018 11:12:39 +0200
Subject: Added some tone wav to test audio
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

A 440Hz tone, encoded in 16, 24 and 32 bits, using a rate of 24Kz,
44.1Kzh and 48Kzh.

Change-Id: I21b1ea2ace014df559c4c5f37ac9d8de3da49c01
Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
---
 media/tone-440-mono-24000-16bits.wav | Bin 0 -> 480044 bytes
 media/tone-440-mono-24000-24bits.wav | Bin 0 -> 720044 bytes
 media/tone-440-mono-24000-32bits.wav | Bin 0 -> 960080 bytes
 media/tone-440-mono-44100-16bits.wav | Bin 0 -> 882044 bytes
 media/tone-440-mono-44100-24bits.wav | Bin 0 -> 1323044 bytes
 media/tone-440-mono-44100-32bits.wav | Bin 0 -> 1764080 bytes
 media/tone-440-mono-48000-16bits.wav | Bin 0 -> 960044 bytes
 media/tone-440-mono-48000-24bits.wav | Bin 0 -> 1440044 bytes
 media/tone-440-mono-48000-32bits.wav | Bin 0 -> 1920080 bytes
 9 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 media/tone-440-mono-24000-16bits.wav
 create mode 100644 media/tone-440-mono-24000-24bits.wav
 create mode 100644 media/tone-440-mono-24000-32bits.wav
 create mode 100644 media/tone-440-mono-44100-16bits.wav
 create mode 100644 media/tone-440-mono-44100-24bits.wav
 create mode 100644 media/tone-440-mono-44100-32bits.wav
 create mode 100644 media/tone-440-mono-48000-16bits.wav
 create mode 100644 media/tone-440-mono-48000-24bits.wav
 create mode 100644 media/tone-440-mono-48000-32bits.wav

(limited to 'media')

diff --git a/media/tone-440-mono-24000-16bits.wav b/media/tone-440-mono-24000-16bits.wav
new file mode 100644
index 0000000..ce57beb
Binary files /dev/null and b/media/tone-440-mono-24000-16bits.wav differ
diff --git a/media/tone-440-mono-24000-24bits.wav b/media/tone-440-mono-24000-24bits.wav
new file mode 100644
index 0000000..54d88b0
Binary files /dev/null and b/media/tone-440-mono-24000-24bits.wav differ
diff --git a/media/tone-440-mono-24000-32bits.wav b/media/tone-440-mono-24000-32bits.wav
new file mode 100644
index 0000000..6b6f5a5
Binary files /dev/null and b/media/tone-440-mono-24000-32bits.wav differ
diff --git a/media/tone-440-mono-44100-16bits.wav b/media/tone-440-mono-44100-16bits.wav
new file mode 100644
index 0000000..facb5d3
Binary files /dev/null and b/media/tone-440-mono-44100-16bits.wav differ
diff --git a/media/tone-440-mono-44100-24bits.wav b/media/tone-440-mono-44100-24bits.wav
new file mode 100644
index 0000000..ecb8475
Binary files /dev/null and b/media/tone-440-mono-44100-24bits.wav differ
diff --git a/media/tone-440-mono-44100-32bits.wav b/media/tone-440-mono-44100-32bits.wav
new file mode 100644
index 0000000..4237d49
Binary files /dev/null and b/media/tone-440-mono-44100-32bits.wav differ
diff --git a/media/tone-440-mono-48000-16bits.wav b/media/tone-440-mono-48000-16bits.wav
new file mode 100644
index 0000000..1baebde
Binary files /dev/null and b/media/tone-440-mono-48000-16bits.wav differ
diff --git a/media/tone-440-mono-48000-24bits.wav b/media/tone-440-mono-48000-24bits.wav
new file mode 100644
index 0000000..abd6772
Binary files /dev/null and b/media/tone-440-mono-48000-24bits.wav differ
diff --git a/media/tone-440-mono-48000-32bits.wav b/media/tone-440-mono-48000-32bits.wav
new file mode 100644
index 0000000..1b262db
Binary files /dev/null and b/media/tone-440-mono-48000-32bits.wav differ
-- 
cgit 1.2.3-korg


From f1d27f1cc790a80ec37b5faf20681c8bd8039351 Mon Sep 17 00:00:00 2001
From: Stephane Desneux <stephane.desneux@iot.bzh>
Date: Sat, 21 Jul 2018 02:17:40 +0200
Subject: Add sample OGG file

Change-Id: I2bf85dce7a78be2980f4f487f8024cdb4f1ba26f
Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
---
 media/Happy_MBB_75.ogg | Bin 0 -> 3635015 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 media/Happy_MBB_75.ogg

(limited to 'media')

diff --git a/media/Happy_MBB_75.ogg b/media/Happy_MBB_75.ogg
new file mode 100644
index 0000000..331cba9
Binary files /dev/null and b/media/Happy_MBB_75.ogg differ
-- 
cgit 1.2.3-korg


From f43f3cb73ff3f8f9c20e8e9efe533ff19e9d3fc6 Mon Sep 17 00:00:00 2001
From: Loïc Collignon <loic.collignon@iot.bzh>
Date: Mon, 23 Jul 2018 00:48:19 +0200
Subject: Fix issue with the unit file detection
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fix a bug introduced by the commit e4e0b9b, due to the wildcard in the
unit file.

Change-Id: Iddc47378207a0ced207861433cd0ec02a52bc1a5
Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
---
 TODO                                   |   7 -----
 bin/4a-gst                             |   3 --
 bin/4a-play                            |  56 ++++++++++++++++++++++++++++-----
 bin/4a-speaker-test                    |   1 -
 bin/gst-play                           |  56 ---------------------------------
 bin/lib4a-tools.sh                     |   3 +-
 media/tone-440-mono-24000-16bits.wav   | Bin 480044 -> 0 bytes
 media/tone-440-mono-24000-24bits.wav   | Bin 720044 -> 0 bytes
 media/tone-440-mono-24000-32bits.wav   | Bin 960080 -> 0 bytes
 media/tone-440-mono-44100-32bits.wav   | Bin 1764080 -> 0 bytes
 media/tone-440-mono-48000-32bits.wav   | Bin 1920080 -> 0 bytes
 media/tone-440-stereo-44100-16bits.wav | Bin 0 -> 1764044 bytes
 media/tone-440-stereo-44100-24bits.wav | Bin 0 -> 2646044 bytes
 media/tone-440-stereo-48000-16bits.wav | Bin 0 -> 1920044 bytes
 media/tone-440-stereo-48000-24bits.wav | Bin 0 -> 2880044 bytes
 15 files changed, 50 insertions(+), 76 deletions(-)
 delete mode 100644 TODO
 delete mode 100755 bin/4a-gst
 delete mode 100755 bin/4a-speaker-test
 delete mode 100755 bin/gst-play
 delete mode 100644 media/tone-440-mono-24000-16bits.wav
 delete mode 100644 media/tone-440-mono-24000-24bits.wav
 delete mode 100644 media/tone-440-mono-24000-32bits.wav
 delete mode 100644 media/tone-440-mono-44100-32bits.wav
 delete mode 100644 media/tone-440-mono-48000-32bits.wav
 create mode 100644 media/tone-440-stereo-44100-16bits.wav
 create mode 100644 media/tone-440-stereo-44100-24bits.wav
 create mode 100644 media/tone-440-stereo-48000-16bits.wav
 create mode 100644 media/tone-440-stereo-48000-24bits.wav

(limited to 'media')

diff --git a/TODO b/TODO
deleted file mode 100644
index 436b8b3..0000000
--- a/TODO
+++ /dev/null
@@ -1,7 +0,0 @@
-* push OGG file
-* 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-gst b/bin/4a-gst
deleted file mode 100755
index 9a06c83..0000000
--- a/bin/4a-gst
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/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
index 483b892..620f311 100755
--- a/bin/4a-play
+++ b/bin/4a-play
@@ -4,14 +4,54 @@
 . $(dirname $BASH_SOURCE)/lib4a-tools.sh
 
 function usage() {
-	log "Usage: $0 <role:file1> [role:file2 ...]"
-	log "Available roles:"
-	exit 1
+	log "$0 <file> [device] [role]"
+	log "    - 'device' can be hw:X where X is a number or the device name."
+	log "      It can also be hw:X,Y,Z, it is used when playing on the loopback card"
+	log "      which is the 4a default sink."
+	log "      Default: hw:Loopback,0,2"
+	log "    - 'role' is the 4a role to use. In future version it will be guessed"
+	log "      based on the device. Use '4a-api roles' to get a list of known roles"
+	log "      Default: multimedia"
 }
 
-[[ $# == 0 ]] && usage
+if [ "$#" == "0" ]; then
+	error "No file to play!"
+	usage
+fi
+
+FILEPATH="$( realpath "$1" )"
+DEVICE=${2:-'hw:Loopback,0,2'}
+ROLE=${3:-'multimedia'}
+
+CARDID=$( echo "$DEVICE" | cut -d':' -f2 | cut -d',' -f1 )
+
+log "Play '$FILEPATH' on '$DEVICE'"
+
+LOOPBACK_CARDID=$( LANG="C" aplay -l | grep -oEe "^card\\s+[0-9]: Loopback" | uniq | grep -oEe "[0-9]+" )
+if [ "$CARDID" == "Loopback" ] || [ "$CARDID" == "$LOOPBACK_CARDID" ]; then
+	IS_4A_DEVICE=1
+else
+	IS_4A_DEVICE=0
+fi
+
+if [ "$IS_4A_DEVICE" == "1" ]; then
+	log "The selected card (hw:$CARDID) is handle by 4a, call open on '$ROLE'"
+	4a-client ahl-4a "$ROLE" '{ "action": "open" }'
+
+	# BUG: afb-client-demo does not exit an exit code different from zero when api return an error
+	#if [ "$?" -ne "0" ]; then
+	#	exit -1
+	#fi
+fi
+
+if [ "$DEBUG" == "1" ]; then
+	gst-launch-1.0 -v uridecodebin uri="file://$FILEPATH" ! audioconvert ! audioresample ! alsasink device="$DEVICE"
+else
+	gst-launch-1.0 -v uridecodebin uri="file://$FILEPATH" ! audioconvert ! audioresample ! alsasink device="$DEVICE" > /dev/null
+fi
+
+if [ "$IS_4A_DEVICE" == "1" ]; then
+	log "The selected card (hw;$CARDID) is handled by 4a, call close on '$ROLE'"
+	4a-client ahl-4a "$ROLE" '{ "action": "close" }'
+fi
 
-for x in "$@"; do
-	log "Playing $x ..."
-	aplay -D Loopback,0,2 $x
-done
diff --git a/bin/4a-speaker-test b/bin/4a-speaker-test
deleted file mode 100755
index 770ddfd..0000000
--- a/bin/4a-speaker-test
+++ /dev/null
@@ -1 +0,0 @@
-# TODO: run speaker test
diff --git a/bin/gst-play b/bin/gst-play
deleted file mode 100755
index 46a6c4a..0000000
--- a/bin/gst-play
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/bash
-
-# load shell lib
-. $(dirname $BASH_SOURCE)/lib4a-tools.sh
-
-function usage() {
-	log "$0 <file> [device] [role]"
-	log "    - 'device' can be hw:X where X is a number or the device name."
-	log "      It can also be hw:X,Y,Z, it is used when playing on the loopback card"
-	log "      which is the 4a default sink."
-	log "      Default: hw:Loopback,0,2"
-	log "    - 'role' is the 4a role to use. In future version it will be guessed"
-	log "      based on the device. Use '4a-api roles' to get a list of known roles"
-	log "      Default: multimedia"
-}
-
-if [ "$#" == "0" ]; then
-	error "No file to play!"
-	usage
-fi
-
-FILEPATH="$( realpath "$1" )"
-DEVICE=${2:-'hw:Loopback,0,2'}
-ROLE=${3:-'multimedia'}
-
-CARDID=$( echo "$DEVICE" | cut -d':' -f2 | cut -d',' -f1 )
-
-log "Play '$FILEPATH' on '$DEVICE'"
-
-LOOPBACK_CARDID=$( LANG="C" aplay -l | grep -oEe "^card\\s+[0-9]: Loopback" | uniq | grep -oEe "[0-9]+" )
-if [ "$CARDID" == "Loopback" ] || [ "$CARDID" == "$LOOPBACK_CARDID" ]; then
-	IS_4A_DEVICE=1
-else
-	IS_4A_DEVICE=0
-fi
-
-if [ "$IS_4A_DEVICE" == "1" ]; then
-	log "The selected card (hw:$CARDID) is handle by 4a, call open on '$ROLE'"
-	4a-client ahl-4a "$ROLE" '{ "action": "open" }'
-
-	# BUG: afb-client-demo does not exit an exit code different from zero when api return an error
-	#if [ "$?" -ne "0" ]; then
-	#	exit -1
-	#fi
-fi
-
-if [ "$DEBUG" == "1" ]; then
-	gst-launch-1.0 -v uridecodebin uri="file://$FILEPATH" ! audioconvert ! audioresample ! alsasink device="$DEVICE"
-else
-	gst-launch-1.0 -v uridecodebin uri="file://$FILEPATH" ! audioconvert ! audioresample ! alsasink device="$DEVICE" > /dev/null
-fi
-
-if [ "$IS_4A_DEVICE" == "1" ]; then
-	log "The selected card (hw;$CARDID) is handled by 4a, call close on '$ROLE'"
-	4a-client ahl-4a "$ROLE" '{ "action": "close" }'
-fi
diff --git a/bin/lib4a-tools.sh b/bin/lib4a-tools.sh
index ab0ee18..776b1c0 100644
--- a/bin/lib4a-tools.sh
+++ b/bin/lib4a-tools.sh
@@ -26,8 +26,9 @@ function 4a-client() {
 	# get port for audio service
 	local port=""
 	local token="HELLO"
+	local unitfile=$( ls /var/local/lib/systemd/system/afm-service-agl-service-audio-4a*.service )
 
-	if [ -f "/var/local/lib/systemd/system/afm-service-agl-service-audio-4a*.service" ]; then
+	if [ -f "$unitfile" ]; then
 		log "Detected systemd unit file!"
 		port=$( grep -sr X-AFM-http /var/local/lib/systemd/system/afm-service-agl-service-audio-4a*.service | cut -f2 -d'=' )
 		log "Port detected: $port"
diff --git a/media/tone-440-mono-24000-16bits.wav b/media/tone-440-mono-24000-16bits.wav
deleted file mode 100644
index ce57beb..0000000
Binary files a/media/tone-440-mono-24000-16bits.wav and /dev/null differ
diff --git a/media/tone-440-mono-24000-24bits.wav b/media/tone-440-mono-24000-24bits.wav
deleted file mode 100644
index 54d88b0..0000000
Binary files a/media/tone-440-mono-24000-24bits.wav and /dev/null differ
diff --git a/media/tone-440-mono-24000-32bits.wav b/media/tone-440-mono-24000-32bits.wav
deleted file mode 100644
index 6b6f5a5..0000000
Binary files a/media/tone-440-mono-24000-32bits.wav and /dev/null differ
diff --git a/media/tone-440-mono-44100-32bits.wav b/media/tone-440-mono-44100-32bits.wav
deleted file mode 100644
index 4237d49..0000000
Binary files a/media/tone-440-mono-44100-32bits.wav and /dev/null differ
diff --git a/media/tone-440-mono-48000-32bits.wav b/media/tone-440-mono-48000-32bits.wav
deleted file mode 100644
index 1b262db..0000000
Binary files a/media/tone-440-mono-48000-32bits.wav and /dev/null differ
diff --git a/media/tone-440-stereo-44100-16bits.wav b/media/tone-440-stereo-44100-16bits.wav
new file mode 100644
index 0000000..d5c685f
Binary files /dev/null and b/media/tone-440-stereo-44100-16bits.wav differ
diff --git a/media/tone-440-stereo-44100-24bits.wav b/media/tone-440-stereo-44100-24bits.wav
new file mode 100644
index 0000000..e800d37
Binary files /dev/null and b/media/tone-440-stereo-44100-24bits.wav differ
diff --git a/media/tone-440-stereo-48000-16bits.wav b/media/tone-440-stereo-48000-16bits.wav
new file mode 100644
index 0000000..9c5d8c9
Binary files /dev/null and b/media/tone-440-stereo-48000-16bits.wav differ
diff --git a/media/tone-440-stereo-48000-24bits.wav b/media/tone-440-stereo-48000-24bits.wav
new file mode 100644
index 0000000..06b448f
Binary files /dev/null and b/media/tone-440-stereo-48000-24bits.wav differ
-- 
cgit 1.2.3-korg