Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions tools/test/audio/asrc_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,25 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2020 Intel Corporation. All rights reserved.

if [ -z "$6" ]; then
echo "Usage: $0 <bits in> <bits out> <rate in> <rate out> <input> <output>"
echo "Example: $0 16 16 32000 48000 input.raw output.raw"
exit
fi
usage ()
{
echo "Usage: $1 <bits in> <bits out> <rate in> <rate out> <input> <output>"
echo "Example: $1 16 16 32000 48000 input.raw output.raw"
}

COMP=asrc
DIRECTION=playback
main()
{
local COMP DIRECTION

./comp_run.sh $COMP $DIRECTION $1 $2 $3 $4 $5 $6
if [ $# -ne 6 ]; then
usage "$0"
exit
fi

COMP=asrc
DIRECTION=playback

./comp_run.sh $COMP $DIRECTION "$@"
}

main "$@"
2 changes: 1 addition & 1 deletion tools/test/audio/comp_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ TPLGFN=test-${DIRECTION}-ssp5-mclk-0-I2S-${COMP}-${INFMT}-${OUTFMT}-48k-24576k-c
TPLG=${TPLG_DIR}/${TPLGFN}

# If binary test vectors
if [ ${FN_IN: -4} == ".raw" ]; then
if [ "${FN_IN: -4}" == ".raw" ]; then

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean "${FN_IN:-4}" ? If not add a comment explaining why the space is not a typo.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good catch. I wonder it has not failed -- I need to check what happens.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, the space needs to be there, it doesn't work with the space removed. It can be also "${FN_IN:(-4)}". I think it's better that way since it works with () with or without space before -4.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know about negative offsets, sorry. I should have spent more time on https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html

(I also didn't realize offsets were a bashism
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02 - I digress)

I'm actually less comfortable with the (-4) than with the space because while confusing the space is documented extensively in the bash manual above but I couldn't find any sign that (-4) is officially supposed to work. Did you? The manual does mention that the offset can be an "arithmetic expression", so could you try ((-4)) if you like it? Otherwise back to the space with a comment to warn the casual reader that it is an offset and not a default value 4 with a typo.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I'll revert to -4 with space. I saw it in Stack Overflow so it was not proper documentation.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... but still no comment this is not a typo :-) Never mind, not worth holding the rest back.

BINFMT="-b S${BITS_IN}_LE"
else
BINFMT=""
Expand Down
24 changes: 18 additions & 6 deletions tools/test/audio/eqfir_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,25 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2020 Intel Corporation. All rights reserved.

if [ -z "$5" ]; then
usage ()
{
echo "Usage: $0 <bits in> <bits out> <rate> <input> <output>"
echo "Example: $0 16 16 48000 input.raw output.raw"
exit
fi
}

COMP=eq-fir
DIRECTION=playback
main ()
{
local COMP DIRECTION

./comp_run.sh $COMP $DIRECTION $1 $2 $3 $3 $4 $5
if [ $# -ne 5 ]; then
usage "$0"
exit
fi

COMP=eq-fir
DIRECTION=playback

./comp_run.sh $COMP $DIRECTION "$1" "$2" "$3" "$3" "$4" "$5"
}

main "$@"
23 changes: 17 additions & 6 deletions tools/test/audio/eqiir_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,25 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2020 Intel Corporation. All rights reserved.

if [ -z "$5" ]; then
usage ()
{
echo "Usage: $0 <bits in> <bits out> <rate> <input> <output>"
echo "Example: $0 16 16 48000 input.raw output.raw"
exit
fi
}

main ()
{
local COMP DIRECTION

COMP=eq-iir
DIRECTION=playback
if [ $# -ne 5 ]; then
usage "$0"
exit
fi

./comp_run.sh $COMP $DIRECTION $1 $2 $3 $3 $4 $5
COMP=eq-iir
DIRECTION=playback

./comp_run.sh $COMP $DIRECTION "$1" "$2" "$3" "$3" "$4" "$5"
}

main "$@"
28 changes: 20 additions & 8 deletions tools/test/audio/src_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,25 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2018-2020 Intel Corporation. All rights reserved.

if [ -z "$6" ]; then
echo "Usage: $0 <bits in> <bits out> <rate in> <rate out> <input> <output>"
echo "Example: $0 16 16 32000 48000 input.raw output.raw"
exit
fi
usage ()
{
echo "Usage: $1 <bits in> <bits out> <rate in> <rate out> <input> <output>"
echo "Example: $1 16 16 32000 48000 input.raw output.raw"
}

COMP=src
DIRECTION=playback
main()
{
local COMP DIRECTION

./comp_run.sh $COMP $DIRECTION $1 $2 $3 $4 $5 $6
if [ $# -ne 6 ]; then
usage "$0"
exit
fi

COMP=src
DIRECTION=playback

./comp_run.sh $COMP $DIRECTION "$@"
}

main "$@"
23 changes: 17 additions & 6 deletions tools/test/audio/volume_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,25 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2020 Intel Corporation. All rights reserved.

if [ -z "$5" ]; then
usage ()
{
echo "Usage: $0 <bits in> <bits out> <rate> <input> <output>"
echo "Example: $0 16 16 48000 input.raw output.raw"
exit
fi
}

main ()
{
local COMP DIRECTION

COMP=volume
DIRECTION=playback
if [ $# -ne 5 ]; then
usage "$0"
exit
fi

./comp_run.sh $COMP $DIRECTION $1 $2 $3 $3 $4 $5
COMP=volume
DIRECTION=playback

./comp_run.sh $COMP $DIRECTION "$1" "$2" "$3" "$3" "$4" "$5"
}

main "$@"