blib/lib/Audio/volume.pl untested

filter: Statementstmt 0.0% 0 / 28 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 37 CC 2 SCAR 12.8
CC
2
Cov
0%
change_volume
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.6
1 #!/usr/bin/perl
2 # -d:ptkdb
3  
4 #
5 # Volume control application.
6 # It's a very simple application which uses Mixer.pm to control
7 # the sound volume. It's written to be used inside the
8 # FVWM FvwmButtons panel.
9 #
10 # Copyright (c) 2001 Sergey Gribov <sergey@sergey.com>
11 # This is free software with ABSOLUTELY NO WARRANTY.
12 # You can redistribute and modify it freely, but please leave
13 # this message attached to this file.
14 #
15 # Subject to terms of GNU General Public License (www.gnu.org)
16 #
17 # Last update: $Date: 2001/03/20 00:20:50 $ by $Author: sergey $
18 # Revision: $Revision: 1.3 $
19  
20 use Tk;
21 use Audio::Mixer;
22 use strict;
23  
24 $| = 1;
25  
26 my $debug = 0;
27 my $win_h = 69;
28 my $win_w = 62;
29  
30 Audio::Mixer::set_mixer_dev("/dev/mixer");
31  
32 my $ret = Audio::Mixer::init_mixer();
33 die("Can't open sound mixer...") if $ret;
34  
35 my @vol = Audio::Mixer::get_cval('vol');
36 my $volume = ($vol[0] + $vol[1]) / 2;
37  
38 my $main = MainWindow->new;
39 $main->geometry($win_w.'x'.$win_h.'+0-0');
40  
41 my $sb = $main->Scale(-orient => 'vertical', -resolution => 1,
42 -from => 100, -to => 0, -sliderlength => 10,
43 -showvalue => 0, -variable => \$volume,
44 -command => sub{change_volume();}
45 );
46 $sb->pack(-fill => 'y', );
47  
48 MainLoop;
49  
50 print "Should never end up here... :)\n";
51  
52 exit;
53  
54 ###################################################################
55 sub change_volume {
56 print "$volume\n" if $debug;
57 Audio::Mixer::set_cval('vol', $volume);
58 }