-# Mixer.pm
+#!/usr/bin/env perl
+#
+# Mixer.pm
+#
+# Copyright (C) 2005 David J. Goehrig <dgoehrig@cpan.org>
+#
+# ------------------------------------------------------------------------------
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# ------------------------------------------------------------------------------
+#
+# Please feel free to send questions, suggestions or improvements to:
+#
+# David J. Goehrig
+# dgoehrig@cpan.org
#
-# a SDL module for manipulating the SDL_mixer lib.
-#
-# Copyright (C) 2000,2002 David J. Goehrig
-# Copyright (C) 2009 Kartik Thakore
package SDL::Mixer;
+
use strict;
+use warnings;
+use Carp;
+
use SDL;
use SDL::Sound;
use SDL::Music;
my $size = $options{-size} || 4096;
unless ( $SDL::Mixer::initialized ) {
SDL::MixOpenAudio($frequency,$format,$channels,$size ) &&
- die SDL::GetError();
+ croak SDL::GetError();
$SDL::Mixer::initialized = 1;
} else {
++$SDL::Mixer::initialized;
return SDL::MixVolumeMusic($volume);
}
-
sub halt_channel ($$) {
my ($self,$channel) = @_;
return SDL::MixHaltChannel($channel);
return SDL::MixPlaying($channel);
}
-sub mix_volume_chunk($$$) {
- my ($self, $chunk, $volume) = @_;
- return SDL::MixVolumeChunk($chunk, $volume);
-}
-
sub playing_music () {
return SDL::MixPlayingMusic();
}