ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/kgsueme/kgsueme/sound.pl
Revision: 1.3
Committed: Wed Jul 30 00:32:42 2003 UTC (20 years, 10 months ago) by pcg
Content type: text/plain
Branch: MAIN
Changes since 1.2: +6 -3 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 package sound;
2
3 use KGS::Constants;
4
5 #my $audioserver = new Audio::Play(0);
6 my %sound;
7 $SIG{CHLD} = 'IGNORE';
8
9 for (map +(KGS::Constants::findfile "KGS/kgsueme/sounds/$_"),
10 qw(alarm warning move pass ring connect user_unknown gamestart resign)) {
11 local $/;
12 open my $snd, "<", $_
13 or die "$_: $!";
14 binmode $snd;
15
16 $sound{$_} = new Audio::Data;
17 $sound{$_}->Load($snd);
18 }
19
20 sub play {
21 my ($annoyancy, $sound) = @_;
22 # annoyany 1 => important, annoyance 2 => useful, annoyancy 3 => not useful
23 if (fork == 0) {
24 if (my $audioserver = new Audio::Play(1)) {
25 $audioserver->play ($sound{$sound});
26 }
27 use POSIX ();
28 POSIX::_exit(0);
29 }
30 }
31
32 1;