blib/lib/Audio/Mixer.pm

filter: Statementstmt 70.4% 31 / 44 Branchbran 31.2% 5 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 6 / 9 Podpod 0.0% 0 / 3 totaltotal 58.3% 42 / 72 CC 9 SCAR 20.6
CC
9
Cov
60%
AUTOLOAD
21.4
get_cval
3.1
set_cval
3.0
CRAP 7.9
↑ Summary blib/lib/Audio/volume.pl »
1 package Audio::Mixer;
2  
3 #
4 # Library to query / set various sound mixer parameters.
5 # See POD documentation below for more info.
6 #
7 # Copyright (c) 2000 Sergey Gribov <sergey@sergey.com>
8 # This is free software with ABSOLUTELY NO WARRANTY.
9 # You can redistribute and modify it freely, but please leave
10 # this message attached to this file.
11 #
12 # Subject to terms of GNU General Public License (www.gnu.org)
13 #
14 # Last update: $Date: 2002/04/30 00:48:21 $ by $Author: sergey $
15 # Revision: $Revision: 1.4 $
16  
17 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD);
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 require Exporter;
22 1 require DynaLoader;
23 1 require AutoLoader;
24  
25 1 @ISA = qw(Exporter DynaLoader);
26 # Items to export into callers namespace by default. Note: do not export
27 # names by default without a very good reason. Use EXPORT_OK instead.
28 # Do not simply export all your public functions/methods/constants.
29 1 @EXPORT = qw();
30 1 @EXPORT_OK = qw(
31 MIXER
32 );
33 1 $VERSION = '0.7';
34  
35 0 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: not called CC=5 SCAR=30.7
36 # This AUTOLOAD is used to 'autoload' constants from the constant()
37 # XS function. If a constant is not found then control is passed
38 # to the AUTOLOAD in AutoLoader.
39  
40 0 my $constname;
41 0 ($constname = $AUTOLOAD) =~ s/.*:://;
42 0 ▶ croak "& not defined" if $constname eq 'constant';
Branch: 1 branch
BranchTrueFalseTotal
if $constname eq "constant" 0 0 0
43 0 ▶ my $val = constant($constname, @_ ? $_[0] : 0);
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
44 0 ▶ if ($! != 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($! != 0) 0 0 0
45 0 ▶ if ($! =~ /Invalid/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($! =~ /Invalid/) { } 0 0 0
46 0 $AutoLoader::AUTOLOAD = $AUTOLOAD;
47 0 goto &AutoLoader::AUTOLOAD;
48 }
49 else {
50 0 croak "Your vendor has not defined Audio::Mixer macro $constname";
51 }
52 }
53 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
54 0 ▶ *$AUTOLOAD = sub () { $val };
Subroutine __ANON__: not called CC=1 SCAR=6.9
55 0 goto &$AUTOLOAD;
56 }
57  
58 1 bootstrap Audio::Mixer $VERSION;
59  
60 # Preloaded methods go here.
61  
62 # Autoload methods go after =cut, and are processed by the autosplit program.
63  
64  
65 3 ▶sub get_cval {
Subroutine get_cval: called CC=3 SCAR=11.2
Pod undocumented
66 3 my $channel = shift;
67 3 my ($val, $lcval, $rcval);
68 3 $val = get_param_val($channel);
69 3 $lcval = $val & 0xff;
70 3 ▶ $rcval = $val & 0x10000 ? ($val & 0xff00) >> 8 : $lcval;
Branch: 1 branch
BranchTrueFalseTotal
$val & 65536 ? : 3 0 3
71 3 ▶ return wantarray ? ($lcval, $rcval) : $val;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 3 0 3
72 }
73  
74 2 ▶sub set_cval {
Subroutine set_cval: called CC=3 SCAR=11.0
Pod undocumented
75 2 my ($channel, $lcval, $rcval) = @_;
76 2 ▶ $lcval = 0 unless $lcval;
Branch: 1 branch
BranchTrueFalseTotal
unless $lcval 0 2 2
77 2 ▶ $rcval = $lcval unless $rcval;
Branch: 1 branch
BranchTrueFalseTotal
unless $rcval 1 1 2
78 2 return set_param_val($channel, $lcval, $rcval);
79 }
80  
81 0 ▶sub get_mixer_params {
Subroutine get_mixer_params: not called CC=1 SCAR=6.9
Pod undocumented
82 0 return(split(/ /, get_params_list()));
83 }
84  
85 1 1;
86 __END__
↑ Summary blib/lib/Audio/volume.pl »