Brought all packages under eye of strict, warnings and love of Carp, For
[sdlgit/SDL_perl.git] / lib / SDL / Sound.pm
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 use warnings;
11 use Carp;
12 sub new {
13         my $proto = shift;      
14         my $class = ref($proto) || $proto;
15         my $filename = shift;
16         my $self = \SDL::MixLoadWAV($filename);
17         bless $self,$class;
18         return $self;
19 }
20
21 sub DESTROY {
22         my $self = shift;
23         SDL::MixFreeChunk($$self);
24 }
25
26 sub volume {
27         my $self = shift;
28         my $volume = shift;
29         return SDL::MixVolumeChunk($$self,$volume);
30 }
31
32 1;
33
34 __END__;
35
36 =pod
37
38
39
40 =head1 NAME
41
42 SDL::Sound - a perl extension
43
44 =head1 DESCRIPTION
45
46 L<SDL::Sound> is a module for loading WAV files for sound effects.
47 The file can be loaded by creating a new L<SDL::Sound> object by
48 passing the filename to the constructor;
49
50         my $sound = new SDL::Sound 'my_sfx.wav';
51
52 =head1 METHODS
53
54 =head2 volume ( value )
55
56 Sets the volume of the sample.
57
58 =head1 AUTHOR
59
60 David J. Goehrig
61
62 =head1 SEE ALSO
63
64 L<perl> L<SDL::Mixer>
65
66 =cut