line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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 |
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
|
|
|
1
|
|
681
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
18
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
94
|
|
19
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
288
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
require Exporter; |
22
|
|
|
|
|
|
|
require DynaLoader; |
23
|
|
|
|
|
|
|
require AutoLoader; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
@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
|
|
|
|
|
|
|
@EXPORT = qw(); |
30
|
|
|
|
|
|
|
@EXPORT_OK = qw( |
31
|
|
|
|
|
|
|
MIXER |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
$VERSION = '0.7'; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub AUTOLOAD { |
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
|
|
|
0
|
|
0
|
my $constname; |
41
|
0
|
|
|
|
|
0
|
($constname = $AUTOLOAD) =~ s/.*:://; |
42
|
0
|
0
|
|
|
|
0
|
croak "& not defined" if $constname eq 'constant'; |
43
|
0
|
0
|
|
|
|
0
|
my $val = constant($constname, @_ ? $_[0] : 0); |
44
|
0
|
0
|
|
|
|
0
|
if ($! != 0) { |
45
|
0
|
0
|
|
|
|
0
|
if ($! =~ /Invalid/) { |
46
|
0
|
|
|
|
|
0
|
$AutoLoader::AUTOLOAD = $AUTOLOAD; |
47
|
0
|
|
|
|
|
0
|
goto &AutoLoader::AUTOLOAD; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
else { |
50
|
0
|
|
|
|
|
0
|
croak "Your vendor has not defined Audio::Mixer macro $constname"; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
310
|
|
54
|
0
|
|
|
0
|
|
0
|
*$AUTOLOAD = sub () { $val }; |
|
0
|
|
|
|
|
0
|
|
55
|
0
|
|
|
|
|
0
|
goto &$AUTOLOAD; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
sub get_cval { |
66
|
3
|
|
|
3
|
0
|
173
|
my $channel = shift; |
67
|
3
|
|
|
|
|
4
|
my ($val, $lcval, $rcval); |
68
|
3
|
|
|
|
|
75
|
$val = get_param_val($channel); |
69
|
3
|
|
|
|
|
6
|
$lcval = $val & 0xff; |
70
|
3
|
50
|
|
|
|
8
|
$rcval = $val & 0x10000 ? ($val & 0xff00) >> 8 : $lcval; |
71
|
3
|
50
|
|
|
|
14
|
return wantarray ? ($lcval, $rcval) : $val; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub set_cval { |
75
|
2
|
|
|
2
|
0
|
66
|
my ($channel, $lcval, $rcval) = @_; |
76
|
2
|
50
|
|
|
|
6
|
$lcval = 0 unless $lcval; |
77
|
2
|
100
|
|
|
|
7
|
$rcval = $lcval unless $rcval; |
78
|
2
|
|
|
|
|
53
|
return set_param_val($channel, $lcval, $rcval); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub get_mixer_params { |
82
|
0
|
|
|
0
|
0
|
|
return(split(/ /, get_params_list())); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
__END__ |