|
16
|
1 <html>
|
|
|
2 <title>Channel</title>
|
|
235
|
3 <body bgcolor=#aaeebb text=#000000 link=#331111 vlink=#331111>
|
|
|
4
|
|
16
|
5
|
|
235
|
6 <table cellspacing=3 width=100%><tr><td bgcolor=#00000>
|
|
|
7 <table width=100%><tr><td bgcolor=c2fc20 align=center>
|
|
|
8 <a href=http://www.pygame.org>
|
|
250
|
9 <img src=../pygame_tiny.gif border=0 width=200 height=60></a><br>
|
|
235
|
10 <b>pygame documentation</b>
|
|
|
11 </td><td bgcolor=6aee28 align=center valign=top width=100%>
|
|
16
|
12
|
|
|
13 ||
|
|
178
|
14 <a href=http://www.pygame.org>Home</a> ||
|
|
16
|
15 <a href=../index.html>Help Contents</a> ||
|
|
|
16 <br> <br>
|
|
|
17
|
|
384
|
18 || <a href=pygame.html>pygame</a> ||
|
|
265
|
19 <a href=pygame_cdrom.html>cdrom</a> ||
|
|
|
20 <a href=pygame_constants.html>constants</a> ||
|
|
|
21 <a href=pygame_display.html>display</a> ||
|
|
384
|
22 <a href=pygame_draw.html>draw</a> ||
|
|
|
23 <a href=pygame_event.html>event</a> ||<br>
|
|
|
24 || <a href=pygame_font.html>font</a> ||
|
|
265
|
25 <a href=pygame_image.html>image</a> ||
|
|
|
26 <a href=pygame_joystick.html>joystick</a> ||
|
|
|
27 <a href=pygame_key.html>key</a> ||
|
|
384
|
28 <a href=pygame_mixer.html>mixer</a> ||
|
|
|
29 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
|
|
|
30 || <a href=pygame_mouse.html>mouse</a> ||
|
|
265
|
31 <a href=pygame_movie.html>movie</a> ||
|
|
370
|
32 <a href=pygame_sndarray.html>sndarray</a> ||
|
|
265
|
33 <a href=pygame_surfarray.html>surfarray</a> ||
|
|
384
|
34 <a href=pygame_time.html>time</a> ||
|
|
|
35 <a href=pygame_transform.html>transform</a> ||<br>
|
|
265
|
36 <br>|| <a href=CD.html>CD</a> ||
|
|
16
|
37 <a href=Channel.html>Channel</a> ||
|
|
277
|
38 <a href=Clock.html>Clock</a> ||
|
|
16
|
39 <a href=Font.html>Font</a> ||
|
|
|
40 <a href=Joystick.html>Joystick</a> ||
|
|
277
|
41 <a href=Movie.html>Movie</a> ||<br>
|
|
|
42 || <a href=Rect.html>Rect</a> ||
|
|
|
43 <a href=Sound.html>Sound</a> ||
|
|
265
|
44 <a href=Surface.html>Surface</a> ||<br>
|
|
299
|
45 <br>|| <a href=pygame_cursors.html>cursors</a> ||
|
|
375
|
46 <a href=pygame_sprite.html>sprite</a> ||<br>
|
|
16
|
47
|
|
|
48
|
|
235
|
49 </td></tr></table></td></tr></table>
|
|
16
|
50 <br>
|
|
|
51 <h2 align=center>Channel</h2>
|
|
|
52 Channel objects represent a single channel of sound. Each channel
|
|
|
53 can only playback one Sound object at a time. If your application
|
|
|
54 only requires simply sound playback, you will usually not need to
|
|
|
55 bother with the Channel objects, they exist for finer playback
|
|
|
56 control.
|
|
151
|
57 <br> <br>
|
|
16
|
58 Sound objects can be retrieved from the pygame.mixer module with
|
|
88
|
59 functions like <a href=pygame_mixer.html#Channel>pygame.mixer.Channel()</a> and
|
|
151
|
60 <a href=pygame_mixer.html#find_channel>pygame.mixer.find_channel()</a>. Also, each time you call
|
|
|
61 <a href=Sound.html#play>Sound.play()</a> a Channel object will be returned, representing the
|
|
16
|
62 channel that sound is playing on.
|
|
|
63
|
|
|
64 <hr>
|
|
|
65
|
|
|
66 <table>
|
|
|
67 <tr><td><a href=#fadeout>fadeout</a></td><td> -
|
|
|
68 fade out the channel</td></tr>
|
|
|
69
|
|
|
70
|
|
|
71 <tr><td><a href=#get_busy>get_busy</a></td><td> -
|
|
|
72 query state of the channel</td></tr>
|
|
|
73
|
|
|
74
|
|
428
|
75 <tr><td><a href=#get_endevent>get_endevent</a></td><td> -
|
|
|
76 get the endevent for a channel</td></tr>
|
|
|
77
|
|
|
78
|
|
|
79 <tr><td><a href=#get_queue>get_queue</a></td><td> -
|
|
|
80 get the currently queued sound object</td></tr>
|
|
|
81
|
|
|
82
|
|
|
83 <tr><td><a href=#get_sound>get_sound</a></td><td> -
|
|
|
84 get the currently playing sound object</td></tr>
|
|
|
85
|
|
|
86
|
|
16
|
87 <tr><td><a href=#get_volume>get_volume</a></td><td> -
|
|
|
88 query the volume for the</td></tr>
|
|
|
89
|
|
|
90
|
|
|
91 <tr><td><a href=#pause>pause</a></td><td> -
|
|
|
92 temporarily stop the channel</td></tr>
|
|
|
93
|
|
|
94
|
|
|
95 <tr><td><a href=#play>play</a></td><td> -
|
|
|
96 play a sound on this channel</td></tr>
|
|
|
97
|
|
|
98
|
|
428
|
99 <tr><td><a href=#queue>queue</a></td><td> -
|
|
|
100 queue a sound on this channel</td></tr>
|
|
|
101
|
|
|
102
|
|
|
103 <tr><td><a href=#set_endevent>set_endevent</a></td><td> -
|
|
|
104 set an endevent for a channel</td></tr>
|
|
|
105
|
|
|
106
|
|
16
|
107 <tr><td><a href=#set_volume>set_volume</a></td><td> -
|
|
|
108 set volume for channel</td></tr>
|
|
|
109
|
|
|
110
|
|
|
111 <tr><td><a href=#stop>stop</a></td><td> -
|
|
|
112 stop playing on the channel</td></tr>
|
|
|
113
|
|
|
114
|
|
|
115 <tr><td><a href=#unpause>unpause</a></td><td> -
|
|
|
116 restart a paused channel</td></tr>
|
|
|
117
|
|
|
118
|
|
|
119 </table>
|
|
|
120
|
|
|
121 <hr>
|
|
|
122
|
|
|
123 <a name=fadeout><font size=+2><b>fadeout
|
|
|
124 </b></font><br><font size=+1><tt>
|
|
|
125 Channel.fadeout(millisec) -> None
|
|
|
126 </tt></font><ul>
|
|
|
127 Fade out the playing sound and stops it over the
|
|
255
|
128 given milliseconds.
|
|
16
|
129 </ul><br> <br>
|
|
|
130
|
|
|
131 <a name=get_busy><font size=+2><b>get_busy
|
|
|
132 </b></font><br><font size=+1><tt>
|
|
|
133 Channel.get_busy() -> bool
|
|
|
134 </tt></font><ul>
|
|
|
135 Returns true when there is a sound actively playing on this
|
|
|
136 channel.
|
|
|
137 </ul><br> <br>
|
|
|
138
|
|
428
|
139 <a name=get_endevent><font size=+2><b>get_endevent
|
|
|
140 </b></font><br><font size=+1><tt>
|
|
|
141 Channel.get_endevent() -> event_type
|
|
|
142 </tt></font><ul>
|
|
|
143 Returns the end event type for this Channel. If the
|
|
|
144 return value is NOEVENT, then no events will be sent
|
|
|
145 when playback ends.
|
|
|
146 </ul><br> <br>
|
|
|
147
|
|
|
148 <a name=get_queue><font size=+2><b>get_queue
|
|
|
149 </b></font><br><font size=+1><tt>
|
|
|
150 Channel.get_queue() -> Sound
|
|
|
151 </tt></font><ul>
|
|
|
152 Return the currently queued Sound object on this channel.
|
|
|
153 This will return None if there is nothing queued.
|
|
|
154 </ul><br> <br>
|
|
|
155
|
|
|
156 <a name=get_sound><font size=+2><b>get_sound
|
|
|
157 </b></font><br><font size=+1><tt>
|
|
|
158 Channel.get_sound() -> Sound
|
|
|
159 </tt></font><ul>
|
|
|
160 Return the currently playing Sound object on this channel.
|
|
|
161 This will return None if there is nothing playing.
|
|
|
162 </ul><br> <br>
|
|
|
163
|
|
16
|
164 <a name=get_volume><font size=+2><b>get_volume
|
|
|
165 </b></font><br><font size=+1><tt>
|
|
|
166 Channel.get_volume() -> val
|
|
|
167 </tt></font><ul>
|
|
|
168 Returns the current volume for this sound object. The value is
|
|
|
169 between 0.0 and 1.0.
|
|
|
170 </ul><br> <br>
|
|
|
171
|
|
|
172 <a name=pause><font size=+2><b>pause
|
|
|
173 </b></font><br><font size=+1><tt>
|
|
|
174 Channel.pause() -> None
|
|
|
175 </tt></font><ul>
|
|
|
176 Stops the sound that is playing on this channel,
|
|
164
|
177 but it can be resumed with a call to <a href=#unpause>unpause()</a>
|
|
16
|
178 </ul><br> <br>
|
|
|
179
|
|
|
180 <a name=play><font size=+2><b>play
|
|
|
181 </b></font><br><font size=+1><tt>
|
|
|
182 Channel.play(Sound, [loops, [maxtime]]) -> None
|
|
|
183 </tt></font><ul>
|
|
|
184 Starts playing a given sound on this channel. If the channels is
|
|
|
185 currently playing a different sound, it will be
|
|
|
186 replaced/restarted with the given sound. Loops controls how many
|
|
|
187 extra times the sound will play, a negative loop will play
|
|
|
188 indefinitely, it defaults to 0. Maxtime is the number of
|
|
|
189 totalmilliseconds that the sound will play. It defaults to
|
|
|
190 forever (-1).
|
|
|
191 </ul><br> <br>
|
|
|
192
|
|
428
|
193 <a name=queue><font size=+2><b>queue
|
|
|
194 </b></font><br><font size=+1><tt>
|
|
|
195 Channel.queue(Sound) -> None
|
|
|
196 </tt></font><ul>
|
|
|
197 When you queue a sound on a channel, it will begin playing
|
|
|
198 immediately when the current playing sound finishes. Each
|
|
|
199 channel can only have a single Sound object queued. The
|
|
|
200 queued sound will only play when the current Sound finishes
|
|
435
|
201 naturally, not from another call to <a href=Sound.html#stop>stop()</a> or <a href=Sound.html#play>play()</a>.
|
|
428
|
202 <br> <br>
|
|
|
203 If there is no currently playing sound on this Channel
|
|
|
204 it will begin playback immediately.
|
|
|
205 <br> <br>
|
|
|
206 This will only work with SDL_mixer greater than version 1.2.3
|
|
|
207 </ul><br> <br>
|
|
|
208
|
|
|
209 <a name=set_endevent><font size=+2><b>set_endevent
|
|
|
210 </b></font><br><font size=+1><tt>
|
|
|
211 Channel.set_endevent([event_type]) -> None
|
|
|
212 </tt></font><ul>
|
|
|
213 When you set an endevent for a channel, that event type
|
|
|
214 will be put on the pygame event queue everytime a sound stops
|
|
|
215 playing on that channel. This is slightly different than the
|
|
|
216 music object end event, because this will trigger an event
|
|
435
|
217 anytime the music stops. If you call <a href=Sound.html#stop>stop()</a> or <a href=Sound.html#play>play()</a> on the
|
|
428
|
218 channel, it will fire an event. An event will also be fired when
|
|
|
219 playback switches to a queued Sound.
|
|
|
220 <br> <br>
|
|
|
221 Pass no argument to stop this channel from firing events
|
|
|
222 </ul><br> <br>
|
|
|
223
|
|
16
|
224 <a name=set_volume><font size=+2><b>set_volume
|
|
|
225 </b></font><br><font size=+1><tt>
|
|
367
|
226 Channel.set_volume(val, [stereoval]) -> None
|
|
16
|
227 </tt></font><ul>
|
|
|
228 Sets the volume for the channel. The channel's volume level is
|
|
|
229 mixed with the volume for the active sound object. The value is
|
|
|
230 between 0.0 and 1.0.
|
|
367
|
231 <br> <br>
|
|
|
232 If mixer is using stereo, you can set the panning for audio
|
|
|
233 by supplying a volume for the left and right channels. If
|
|
|
234 SDL_mixer cannot set the panning, it will average the two
|
|
|
235 volumes. Panning requires SDL_mixer-1.2.1.
|
|
16
|
236 </ul><br> <br>
|
|
|
237
|
|
|
238 <a name=stop><font size=+2><b>stop
|
|
|
239 </b></font><br><font size=+1><tt>
|
|
|
240 Channel.stop() -> None
|
|
|
241 </tt></font><ul>
|
|
|
242 Stops the sound that is playing on this channel.
|
|
|
243 </ul><br> <br>
|
|
|
244
|
|
|
245 <a name=unpause><font size=+2><b>unpause
|
|
|
246 </b></font><br><font size=+1><tt>
|
|
|
247 Channel.unpause() -> None
|
|
|
248 </tt></font><ul>
|
|
|
249 Restarts a paused channel where it was paused.
|
|
|
250 </ul><br> <br>
|
|
|
251
|
|
|
252
|
|
|
253 <hr>
|
|
|
254 </body></html>
|