Open lpil opened 6 years ago
#!/usr/bin/perl
use strict;
use warnings;
use feature qw(say);
my @devices = (
'hw:RMX90DVS,0',
'plughw:RMX90DVS,0',
);
my @rates = (
'44100',
'48000',
);
my @formats = (
# 'S8',
# 'U8',
# 'S16_LE',
# 'S16_BE',
# 'U16_LE',
# 'U16_BE',
# 'S24_LE',
# 'S24_BE',
# 'U24_LE',
# 'U24_BE',
'S32_LE',
# 'S32_BE',
# 'U32_LE',
# 'U32_BE',
# 'FLOAT_LE',
# 'FLOAT_BE',
# 'FLOAT64_LE',
# 'FLOAT64_BE',
# 'IEC958_SUBFRAME_LE',
# 'IEC958_SUBFRAME_BE',
# 'MU_LAW',
# 'A_LAW',
# 'IMA_ADPCM',
# 'MPEG',
# 'GSM',
# 'SPECIAL',
# 'S24_3LE',
# 'S24_3BE',
# 'U24_3LE',
# 'U24_3BE',
# 'S20_3LE',
# 'S20_3BE',
# 'U20_3LE',
# 'U20_3BE',
# 'S18_3LE',
# 'S18_3BE',
# 'U18_3LE',
# 'U18_3BE',
# 'G723_24',
# 'G723_24_1B',
# 'G723_40',
# 'G723_40_1B',
# 'DSD_U8',
# 'DSD_U16_LE',
);
sub test {
my $device = shift();
my $rate = shift();
my $format = shift();
my $cmd = "aplay";
$cmd .= " --duration=1";
$cmd .= " --channels=8";
$cmd .= " --device=$device";
$cmd .= " --rate=$rate";
$cmd .= " --format=$format";
# $cmd .= " --disable-format";
$cmd .= " --quiet";
$cmd .= " /dev/zero";
$cmd .= " 2>&1";
my $data = `$cmd`;
return $data
}
foreach my $device (@devices) {
foreach my $rate (@rates) {
foreach my $format (@formats) {
my $lines = test(
$device,
$rate,
$format
);
my @lines = split(/\n/, $lines);
my $result = 'PASS';
if(@lines > 0) {
$result = 'FAIL';
print("$result device='$device' rate='$rate' format='$format' $lines[0]\n");
#foreach my $line (@lines) {
#print("$line\n");
#}
} else {
print("$result device='$device' rate='$rate' format='$format'\n");
}
}
}
}