Commit | Line | Data |
8fde61e3 |
1 | # |
2 | # Sound.pm |
3 | # |
4 | # a SDL_mixer data module |
5 | # |
6 | # Copyright (C) 2000,2002 David J. Goehrig |
7 | |
8 | package SDL::Sound; |
9 | use strict; |
10 | |
11 | sub new { |
12 | my $proto = shift; |
13 | my $class = ref($proto) || $proto; |
14 | my $filename = shift; |
15 | my $self = \SDL::MixLoadWAV($filename); |
16 | bless $self,$class; |
17 | return $self; |
18 | } |
19 | |
20 | sub DESTROY { |
21 | my $self = shift; |
22 | SDL::MixFreeChunk($$self); |
23 | } |
24 | |
25 | sub volume { |
26 | my $self = shift; |
27 | my $volume = shift; |
28 | return SDL::MixVolumeChunk($$self,$volume); |
29 | } |
30 | |
31 | 1; |
32 | |
33 | __END__; |
34 | |
35 | =pod |
36 | |
37 | |
38 | |
39 | =head1 NAME |
40 | |
41 | SDL::Sound - a perl extension |
42 | |
43 | =head1 DESCRIPTION |
44 | |
45 | L<SDL::Sound> is a module for loading WAV files for sound effects. |
46 | The file can be loaded by creating a new L<SDL::Sound> object by |
47 | passing the filename to the constructor; |
48 | |
49 | my $sound = new SDL::Sound 'my_sfx.wav'; |
50 | |
51 | =head1 METHODS |
52 | |
53 | =head2 volume ( value ) |
54 | |
55 | Sets the volume of the sample. |
56 | |
57 | =head1 AUTHOR |
58 | |
59 | David J. Goehrig |
60 | |
61 | =head1 SEE ALSO |
62 | |
63 | L<perl> L<SDL::Mixer> |
64 | |
65 | =cut |