SDL::Mixer - a SDL perl extension
$mixer = new SDL::Mixer -frequency => MIX_DEFAULT_FREQUENCY, -format => MIX_DEFAULT_FORMAT, -channels => MIX_DEFAULT_CHANNELS, -size => 4096;
SDL::Mixer allows you access to the SDL mixer library, enablig sound and music volume setting, playing, pausing and resuming, as well as fading the sound and music in and out.
$mixer = SDL::Mixer->new( -frequency => MIX_DEFAULT_FREQUENCY, -format => MIX_DEFAULT_FORMAT, -channels => MIX_DEFAULT_CHANNELS, -size => 4096);
Creates a new SDL::Mixer object. $size is the buffer size in bytes.
$size
my $specs = SDL::Mixer::query_spec();
Returns a hash reference, containing the following keys and their respective values:
-status -frequency -channels -format
$mixer->reserve_channels(4);
Reserve so many channels.
$mixer->reserve_channels(2);
Allocate so many channels.
Group the channel number $channel into group $group.
$channel
$group
Groups a range of channels
Return true when the group is available.
Returns the number of channels in the group
Play $music $loop times.
$music
$loop
Fades a channel in
Fades the music in over a number of ms, looping as it does
Sets the volume for a single channel
Set the volume for the music.
Stops a specific channel
Stops a group of channels
Stops the music
Ignores the channel after ticks has expired
ticks
Fade the channel number $channel in $ms ms out.
$ms
Fade the channel group $group in $ms ms out.
Fade the music in $ms ms out.
Return true when the music is currently fading in or out.
Return true when the channel number $channel is currently fading in or out.
Pause the channel $channel.
Resume the channel $channel.
Return true when the channel is currently paused.
Pause the music play.
Resume the music play.
Resets the music file to the beginning
Return true when the music is currently paused.
Return true when the channel is currently playing.
Return true when the music is currently playing.
David J. Goehrig, basic doc added by Tels <http://bloodgate.com>.
perl, SDL::Music and SDL::Sound.
To install SDL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SDL
CPAN shell
perl -MCPAN -e shell install SDL
For more information on module installation, please visit the detailed CPAN module installation guide.