Skip to content

Commit c36f283

Browse files
committed
TinyAlsa: Add support for testing using tinycap and tinyplay..
The parameter has been added to the lib.sh library, allowing the selection of tinyalsa as the testing tool. Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
1 parent e7c456d commit c36f283

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

case-lib/lib.sh

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -752,17 +752,37 @@ func_lib_check_pa()
752752
# However, 1. arrays would complicate the user interface 2. ALSA does not
753753
# seem to need arguments with whitespace or globbing characters.
754754

755+
channel=$(func_pipeline_parse_value "$idx" channel)
756+
rate=$(func_pipeline_parse_value "$idx" rate)
757+
fmt_elem=$(func_pipeline_parse_value "$idx" fmt_elem)
758+
dev=$(func_pipeline_parse_value "$idx" dev)
759+
duration=$(func_pipeline_parse_value "$idx" duration)
760+
755761
aplay_opts()
756762
{
757-
dlogc "aplay $SOF_ALSA_OPTS $SOF_APLAY_OPTS $*"
758-
# shellcheck disable=SC2086
759-
aplay $SOF_ALSA_OPTS $SOF_APLAY_OPTS "$@"
763+
if [[ $SOF_TINY_ALSA == true ]]; then
764+
card_nr=$(echo "$dev" | cut -d ':' -f2 | cut -d ',' -f1)
765+
dev_nr=$(echo "$dev" | cut -d ',' -f2)
766+
sox -n -r "$rate" -c "$channel" noise.wav synth "$duration" white
767+
tinyplay -D "$card_nr" -d "$dev_nr" -i wav noise.wav
768+
else
769+
dlogc "aplay $SOF_ALSA_OPTS $SOF_APLAY_OPTS $*"
770+
# shellcheck disable=SC2086
771+
aplay $SOF_ALSA_OPTS $SOF_APLAY_OPTS "$@"
772+
fi
760773
}
761774
arecord_opts()
762775
{
763-
dlogc "arecord $SOF_ALSA_OPTS $SOF_ARECORD_OPTS $*"
764-
# shellcheck disable=SC2086
765-
arecord $SOF_ALSA_OPTS $SOF_ARECORD_OPTS "$@"
776+
if [[ $SOF_TINY_ALSA == true ]]; then
777+
card_nr=$(echo "$dev" | cut -d ':' -f2 | cut -d ',' -f1)
778+
dev_nr=$(echo "$dev" | cut -d ',' -f2)
779+
format=$( echo "$fmt_elem" | grep '[0-9]\+' -o)
780+
tinycap "$file" -D "$card_nr" -d "$dev_nr" -c "$channel" -t "$duration" -r "$rate" -b "$format"
781+
else
782+
dlogc "arecord $SOF_ALSA_OPTS $SOF_ARECORD_OPTS $*"
783+
# shellcheck disable=SC2086
784+
arecord $SOF_ALSA_OPTS $SOF_ARECORD_OPTS "$@"
785+
fi
766786
}
767787

768788
die()

0 commit comments

Comments
 (0)