3e154f2bba15501bfafacd4bde139c8c35bd6bdf
[sdlgit/SDL_perl.git] / lib / docs / Mixer.pod
1 =pod
2
3 =head1 NAME
4
5 SDL::Mixer - a SDL perl extension
6
7 =head1 SYNOPSIS
8
9   $mixer = new SDL::Mixer       -frequency => MIX_DEFAULT_FREQUENCY,
10                                 -format => MIX_DEFAULT_FORMAT,
11                                 -channels => MIX_DEFAULT_CHANNELS,
12                                 -size => 4096;
13
14 =head1 DESCRIPTION
15
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.
19
20 =head1 METHODS
21   
22 =head2 new()
23
24         $mixer = SDL::Mixer->new(       -frequency => MIX_DEFAULT_FREQUENCY,
25                                         -format    => MIX_DEFAULT_FORMAT,
26                                         -channels  => MIX_DEFAULT_CHANNELS,
27                                         -size      => 4096);
28
29 Creates a new SDL::Mixer object. C<$size> is the buffer size in bytes.
30
31 =head2 query_spec()
32
33         my $specs = SDL::Mixer::query_spec();
34
35 Returns a hash reference, containing the following keys and their respective
36 values:
37
38         -status
39         -frequency
40         -channels
41         -format
42
43 =head2 reserve_channels
44
45         $mixer->reserve_channels(4);
46
47 Reserve so many channels.
48
49 =head2 allocate_channels()
50
51         $mixer->reserve_channels(2);
52
53 Allocate so many channels.
54
55 =head2 group_channel(channel,group)
56
57 Group the channel number C<$channel> into group C<$group>.
58
59 =head2 group_channels(from,to,group)
60
61 Groups a range of channels
62
63 =head2 group_available(group)
64
65 Return true when the group is available.
66
67 =head2 group_count(group)
68
69 Returns the number of channels in the group
70
71 =head2 group_oldest()
72
73
74 =head2 group_newer()
75
76
77 =head2 play_channel()
78
79
80 =head2 play_music()
81
82 Play C<$music> C<$loop> times.
83
84 =head2 fade_in_channel(channel,chunk,loops,ms,ticks)
85
86 Fades a channel in
87
88 =head2 fade_in_music(music,loops,ms)
89
90 Fades the music in over a number of ms, looping as it does
91
92 =head2 channel_volume(channel,volume)
93
94 Sets the volume for a single channel
95
96 =head2 mucis_volume(volume)
97
98 Set the volume for the music.
99
100 =head2 halt_channel(channel)
101
102 Stops a specific channel
103
104 =head2 halt_group(group)
105
106 Stops a group of channels
107
108 =head2 halt_music()
109
110 Stops the music
111
112 =head2 channel_expire(channel,ticks)
113
114 Ignores the channel after C<ticks> has expired
115
116 =head2 fade_out_channel(channel,ms)
117
118 Fade the channel number C<$channel> in C<$ms> ms out.
119
120 =head2 fade_out_group(group,ms)
121         
122 Fade the channel group C<$group> in C<$ms> ms out.
123
124 =head2 fade_out_music(ms)
125         
126 Fade the music in C<$ms> ms out.
127
128 =head2 fading_music()
129
130 Return true when the music is currently fading in or out.
131
132 =head2 fading_channel()
133
134 Return true when the channel number C<$channel> is currently fading in or out.
135
136 =head2 pause( channel )
137
138 Pause the channel C<$channel>.
139
140 =head2 resume(channel)
141
142 Resume the channel C<$channel>.
143
144 =head2 paused()
145
146 Return true when the channel is currently paused.
147
148 =head2 pause_music()
149
150 Pause the music play.
151
152 =head2 resume_music()
153         
154 Resume the music play.
155
156 =head2 rewind_music()
157
158 Resets the music file to the beginning
159
160 =head2 music_paused()
161
162 Return true when the music is currently paused.
163
164 =head2 playing()
165
166 Return true when the channel is currently playing.
167
168 =head2 playing_music ()
169
170 Return true when the music is currently playing.
171
172 =head1 set_panning($channel, $left, $right)
173
174 Sets the volume for the left or right channels. To do true panning:
175
176   $mixer->set_panning($channel, $left, 254 - $left);
177
178 =head1 AUTHORS 
179
180 David J. Goehrig, basic doc added by Tels <http://bloodgate.com>.
181
182 =head1 SEE ALSO
183
184 L<perl>, L<SDL::Music> and L<SDL::Sound>.
185
186 =cut