Skip to content

Commit 7ff3b0e

Browse files
committed
check-alsabat.sh: add a new option '-N' to specify the channel number for playback
Before the channel number of playback was hard coded to 2. since sof playback PCMs only support 2 channels. But we now we have Bluetooth offload with nocodec topology which support both 1 channel and 2 channels. So replace this hard coding to optional. Signed-off-by: Keqiao Zhang <keqiao.zhang@intel.com>
1 parent 84dcefd commit 7ff3b0e

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

test-case/check-alsabat.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ OPT_HAS_ARG['p']=1 OPT_VAL['p']=''
3636
OPT_NAME['C']='channel_c' OPT_DESC['C']='channel number for capture.'
3737
OPT_HAS_ARG['C']=1 OPT_VAL['C']='1'
3838

39+
OPT_NAME['N']='channel_p' OPT_DESC['N']='channel number for playback.'
40+
OPT_HAS_ARG['N']=1 OPT_VAL['N']='2'
41+
3942
OPT_NAME['r']='rate' OPT_DESC['r']='sample rate'
4043
OPT_HAS_ARG['r']=1 OPT_VAL['r']=48000
4144

@@ -64,6 +67,7 @@ pcm_p=${OPT_VAL['p']}
6467
pcm_c=${OPT_VAL['c']}
6568
rate=${OPT_VAL['r']}
6669
channel_c=${OPT_VAL['C']}
70+
channel_p=${OPT_VAL['N']}
6771
format=${OPT_VAL['f']}
6872
frequency=${OPT_VAL['F']}
6973
sigmak=${OPT_VAL['k']}
@@ -110,9 +114,9 @@ aplay -Dplug$pcm_p -d 1 /dev/zero -q || die "Failed to play on PCM: $pcm_p"
110114
arecord -Dplug$pcm_c -d 1 /dev/null -q || die "Failed to capture on PCM: $pcm_c"
111115

112116
# alsabat test
113-
# hardcode the channel number of playback to 2, as sof doesnot support mono wav.
114-
dlogc "alsabat -P$pcm_p --standalone -n $frames -r $rate -c 2 -f $format -F $frequency -k $sigmak"
115-
alsabat -P$pcm_p --standalone -n $frames -c 2 -r $rate -f $format -F $frequency -k $sigmak & playPID=$!
117+
# BT offload PCMs also support mono playback.
118+
dlogc "alsabat -P$pcm_p --standalone -n $frames -r $rate -c $channel_p -f $format -F $frequency -k $sigmak"
119+
alsabat -P$pcm_p --standalone -n $frames -c $channel_p -r $rate -f $format -F $frequency -k $sigmak & playPID=$!
116120

117121
# playback may have low latency, add one second delay to aviod recording zero at beginning.
118122
sleep 1

0 commit comments

Comments
 (0)