5 SDL::Mixer - a SDL perl extension
9 $mixer = new SDL::Mixer -frequency => MIX_DEFAULT_FREQUENCY,
10 -format => MIX_DEFAULT_FORMAT,
11 -channels => MIX_DEFAULT_CHANNELS,
16 SDL::Mixer allows you access to the SDL mixer library, enablig sound and
17 music volume setting, playing, pausing and resuming, as well as fading
18 the sound and music in and out.
24 $mixer = SDL::Mixer->new( -frequency => MIX_DEFAULT_FREQUENCY,
25 -format => MIX_DEFAULT_FORMAT,
26 -channels => MIX_DEFAULT_CHANNELS,
29 Creates a new SDL::Mixer object. C<$size> is the buffer size in bytes.
33 my $specs = SDL::Mixer::query_spec();
35 Returns a hash reference, containing the following keys and their respective
43 =head2 reserve_channels
45 $mixer->reserve_channels(4);
47 Reserve so many channels.
49 =head2 allocate_channels()
51 $mixer->reserve_channels(2);
53 Allocate so many channels.
55 =head2 group_channel(channel,group)
57 Group the channel number C<$channel> into group C<$group>.
59 =head2 group_channels(from,to,group)
61 Groups a range of channels
63 =head2 group_available(group)
65 Return true when the group is available.
67 =head2 group_count(group)
69 Returns the number of channels in the group
82 Play C<$music> C<$loop> times.
84 =head2 fade_in_channel(channel,chunk,loops,ms,ticks)
88 =head2 fade_in_music(music,loops,ms)
90 Fades the music in over a number of ms, looping as it does
92 =head2 channel_volume(channel,volume)
94 Sets the volume for a single channel
96 =head2 mucis_volume(volume)
98 Set the volume for the music.
100 =head2 halt_channel(channel)
102 Stops a specific channel
104 =head2 halt_group(group)
106 Stops a group of channels
112 =head2 channel_expire(channel,ticks)
114 Ignores the channel after C<ticks> has expired
116 =head2 fade_out_channel(channel,ms)
118 Fade the channel number C<$channel> in C<$ms> ms out.
120 =head2 fade_out_group(group,ms)
122 Fade the channel group C<$group> in C<$ms> ms out.
124 =head2 fade_out_music(ms)
126 Fade the music in C<$ms> ms out.
128 =head2 fading_music()
130 Return true when the music is currently fading in or out.
132 =head2 fading_channel()
134 Return true when the channel number C<$channel> is currently fading in or out.
136 =head2 pause( channel )
138 Pause the channel C<$channel>.
140 =head2 resume(channel)
142 Resume the channel C<$channel>.
146 Return true when the channel is currently paused.
150 Pause the music play.
152 =head2 resume_music()
154 Resume the music play.
156 =head2 rewind_music()
158 Resets the music file to the beginning
160 =head2 music_paused()
162 Return true when the music is currently paused.
166 Return true when the channel is currently playing.
168 =head2 playing_music ()
170 Return true when the music is currently playing.
172 =head1 set_panning($channel, $left, $right)
174 Sets the volume for the left or right channels. To do true panning:
176 $mixer->set_panning($channel, $left, 254 - $left);
180 David J. Goehrig, basic doc added by Tels <http://bloodgate.com>.
184 L<perl>, L<SDL::Music> and L<SDL::Sound>.