Brought all packages under eye of strict, warnings and love of Carp, For
[sdlgit/SDL_perl.git] / lib / SDL / Sound.pm
CommitLineData
8fde61e3 1#
2# Sound.pm
3#
4# a SDL_mixer data module
5#
6# Copyright (C) 2000,2002 David J. Goehrig
7
8package SDL::Sound;
9use strict;
084b921f 10use warnings;
11use Carp;
8fde61e3 12sub 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
21sub DESTROY {
22 my $self = shift;
23 SDL::MixFreeChunk($$self);
24}
25
26sub volume {
27 my $self = shift;
28 my $volume = shift;
29 return SDL::MixVolumeChunk($$self,$volume);
30}
31
321;
33
34__END__;
35
36=pod
37
38
39
40=head1 NAME
41
42SDL::Sound - a perl extension
43
44=head1 DESCRIPTION
45
46L<SDL::Sound> is a module for loading WAV files for sound effects.
47The file can be loaded by creating a new L<SDL::Sound> object by
48passing 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
56Sets the volume of the sample.
57
58=head1 AUTHOR
59
60David J. Goehrig
61
62=head1 SEE ALSO
63
64L<perl> L<SDL::Mixer>
65
66=cut