Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use feature qw(say);
- my @devices = (
- 'hw:0,0',
- );
- my @rates = (
- '48000',
- '96000',
- );
- my @formats = (
- 'S16_LE',
- );
- sub test {
- my $device = shift();
- my $rate = shift();
- my $format = shift();
- my $cmd = "aplay";
- $cmd .= " --duration=1";
- $cmd .= " --channels=2";
- $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");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement