@@ -51,27 +51,63 @@ func_pipeline_export "$tplg" "type:any"
5151aplay_num=0
5252arecord_num=0
5353
54- for idx in $( seq 0 $(( PIPELINE_COUNT - 1 )) )
55- do
56- channel=$( func_pipeline_parse_value " $idx " channel)
57- rate=$( func_pipeline_parse_value " $idx " rate)
58- dev=$( func_pipeline_parse_value " $idx " dev)
59- pcm=$( func_pipeline_parse_value " $idx " pcm)
60- type=$( func_pipeline_parse_value " $idx " type)
61-
62- # Currently, copier will convert bit depth to S32_LE despite what bit depth
63- # is used in aplay, so make S32_LE as base bit depth for performance analysis.
64- fmt=S32_LE
65-
66- dlogi " Running (PCM: $pcm [$dev ]<$type >) in background"
67- if [ " $type " == " playback" ]; then
68- aplay_opts -D " $dev " -c " $channel " -r " $rate " -f " $fmt " -d " $duration " /dev/zero -q &
69- aplay_num=$(( aplay_num+ 1 ))
70- else
71- arecord_opts -D " $dev " -c " $channel " -r " $rate " -f " $fmt " -d " $duration " /dev/null -q &
72- arecord_num=$(( arecord_num+ 1 ))
54+ if [ " $TEST_WITH_PIPEWIRE " == true ]; then
55+
56+ # aplay's for sinks
57+ pw_outputs_list=(" Speaker" " Headphones" " HDMI" )
58+
59+ for sink_type in " ${pw_outputs_list[@]} "
60+ do
61+ sink_id=$( wpctl status | grep -A6 " Sinks" | grep -A3 -i " $sink_type " | tr -d ' *' | awk ' {print $2}' | tr -d ' .' | head -n 1)
62+ if [ -z " $sink_id " ]; then
63+ echo " No $sink_type found, skipping to the next one"
64+ continue # skip if that device type isn't available
7365 fi
74- done
66+ echo " Setting default sink to $sink_id : $sink_type "
67+ wpctl set-default " $sink_id "
68+ aplay_opts -Ddefault /dev/zero -q &
69+ aplay_num=$(( aplay_num+ 1 ))
70+ done
71+
72+ # arecord's for sources
73+ pw_inputs_list=(" Digital Microphone" " Headset Microphone" " SoundWire microphones" )
74+
75+ for source_type in " ${pw_inputs_list[@]} "
76+ do
77+ source_id=$( wpctl status | grep -A6 " Sources" | grep -A3 -i " $source_type " | tr -d ' *' | awk ' {print $2}' | tr -d ' .' | head -n 1)
78+ if [ -z " $source_id " ]; then
79+ continue # skip if that device type isn't available
80+ fi
81+ echo " Setting default source to $source_id : $source_type "
82+ wpctl set-default " $source_id "
83+ arecord_opts -Ddefault /dev/zero -q &
84+ arecord_num=$(( arecord_num+ 1 ))
85+ done
86+
87+ else
88+
89+ for idx in $( seq 0 $(( PIPELINE_COUNT - 1 )) )
90+ do
91+ channel=$( func_pipeline_parse_value " $idx " channel)
92+ rate=$( func_pipeline_parse_value " $idx " rate)
93+ dev=$( func_pipeline_parse_value " $idx " dev)
94+ pcm=$( func_pipeline_parse_value " $idx " pcm)
95+ type=$( func_pipeline_parse_value " $idx " type)
96+
97+ # Currently, copier will convert bit depth to S32_LE despite what bit depth
98+ # is used in aplay, so make S32_LE as base bit depth for performance analysis.
99+ fmt=S32_LE
100+
101+ dlogi " Running (PCM: $pcm [$dev ]<$type >) in background"
102+ if [ " $type " == " playback" ]; then
103+ aplay_opts -D " $dev " -c " $channel " -r " $rate " -f " $fmt " -d " $duration " /dev/zero -q &
104+ aplay_num=$(( aplay_num+ 1 ))
105+ else
106+ arecord_opts -D " $dev " -c " $channel " -r " $rate " -f " $fmt " -d " $duration " /dev/null -q &
107+ arecord_num=$(( arecord_num+ 1 ))
108+ fi
109+ done
110+ fi
75111
76112sleep 1 # waiting stable streaming of aplay/arecord
77113dlogi " Number of aplay/arecord process started: $aplay_num , $arecord_num "
0 commit comments