NAME

SDL::Mixer - a SDL perl extension

SYNOPSIS

  $mixer = new SDL::Mixer 	-frequency => MIX_DEFAULT_FREQUENCY,
				-format => MIX_DEFAULT_FORMAT,
				-channels => MIX_DEFAULT_CHANNELS,
				-size => 4096;

EXPORTS

SDL::Mixer exports the following symbols by default:

MIX_MAX_VOLUME
MIX_DEFAULT_FREQUENCY
MIX_DEFAULT_FORMAT
MIX_DEFAULT_CHANNELS
MIX_NO_FADING
MIX_FADING_OUT
MIX_FADING_IN
AUDIO_U8
AUDIO_S8
AUDIO_U16
AUDIO_S16
AUDIO_U16MSB
AUDIO_S16MSB

DESCRIPTION

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.

METHODS

new()

$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.

query_spec()

my $specs = SDL::Mixer::query_spec();

Returns a hash reference, containing the following keys and their respective values:

-status
-frequency
-channels
-format

reserve_channels

$mixer->reserve_channels(4);

Reserve so many channels.

allocate_channels()

$mixer->reserve_channels(2);

Allocate so many channels.

group_channel()

$mixer->group_channel($channel,$group);

Group the channel number $channel into group $group.

group_channels()

$mixer->group_channels ($from, $to, $group);

group_available()

$mixer->group_available($group);

Return true when the group is available.

group_count

$mixer = $self->group_count($group);

group_oldest()

$mixer->group_oldest($group);

group_newer()

$mixer->group_newer($group);

play_channel()

$mixer->play_channel($channel,$chunk,$loops,$ticks);

play_music()

$mixer->play_music($music,$loops);

Play $music $loop times.

fade_in_channel()

$mixer->fade_in_channel($channel,$chunk,$loops,$ms,$ticks);

fade_in_music()

$mixer->fade_in_music($music,$loops,$ms);

channel_volume()

$mixer->channel_volume($channel,$volume);

mucis_volume()

$mixer->music_volume($volume);

Set the volume for the music.

halt_channel()

$mixer->halt_channel($channel);

halt_group()

$mixer->halt_group($group);

halt_music()

$mixer->halt_music();

channel_expire()

$mixer->channel_expire($channel,$ticks);

fade_out_channel()

$mixer->fade_out_channel($channel,$ms);

Fade the channel number $channel in $ms ms out.

fade_out_group()

$mixer->fade_out_group($group,$ms);

Fade the channel group $group in $ms ms out.

fade_out_music()

$mixer->fade_out_music($ms);

Fade the music in $ms ms out.

fading_music()

if ($mixer->fading_music())
  {
  ...
  }

Return true when the music is currently fading in or out.

fading_channel()

if ($mixer->fading_channel($channel))
  {
  ...
  }

Return true when the channel number $channel is currently fading in or out.

pause()

$mixer->pause($channel);

Pause the channel $channel.

resume()

$mixer->resume($channel);

Resume the channel $channel.

paused()

if ($mixer->paused($channel))
  {
  ...
  }

Return true when the channel is currently paused.

pause_music()

$mixer->pause_music();

Pause the music play.

resume_music()

$mixer->resume_music();

Resume the music play.

rewind_music()

$mixer->rewind_music();

music_paused()

if ($mixer->music_paused())
  {
  ...
  }

Return true when the music is currently paused.

playing()

$mixer->playing($channel);

Return true when the channel is currently playing.

playing_music ()

$mixer->playing_music();

Return true when the music is currently playing.

AUTHORS

David J. Goehrig, basic doc added by Tels <http://bloodgate.com>.

SEE ALSO

perl(1), SDL::Music and SDL::Sound.