Source

pygame / docs / ref / Channel.html

<html>
<title>Channel</title>
<body bgcolor=#dddddd text=#333377 link=#7777bb vlink=#7777bb>

<table border=0 width=100% cellpadding=0 cellspacing=0 bgcolor=#f5f5f5><tr valign=top>
<td rowspan=2><table border=0 cellpadding=5 cellspacing=0 bgcolor=#333377>
<tr height=86 align=left><td valign=middle><font color=#ffffff size=+5>
	<a href=../index.html><font size=+5 color=#ffffff><i><b>
      pygame</b></i></font></a>&nbsp;&nbsp;</td>
<td valign=middle><tt><font color=#dddddd><br>
	pygame<br>documentation</font>
</td></tr></table></td><td width=100% align=center valign=middle>

	||&nbsp;
	<a href=http://pygame.seul.org>Home</a> &nbsp;||&nbsp;
	<a href=../index.html>Help Contents</a> &nbsp;||
	<br>&nbsp;<br>

|| <a href=CD.html>CD</a> || 
<a href=Channel.html>Channel</a> || 
<a href=Font.html>Font</a> || 
<a href=Joystick.html>Joystick</a> || 
<a href=Rect.html>Rect</a> || 
<a href=Sound.html>Sound</a> || 
<a href=Surface.html>Surface</a> ||<br>
|| <a href=pygame.html>pygame</a> || 
<a href=pygame_cdrom.html>cdrom</a> || 
<a href=pygame_constants.html>constants</a> || 
<a href=pygame_display.html>display</a> || 
<a href=pygame_event.html>event</a> || 
<a href=pygame_font.html>font</a> || 
<a href=pygame_image.html>image</a> ||<br>
|| <a href=pygame_joystick.html>joystick</a> || 
<a href=pygame_key.html>key</a> || 
<a href=pygame_mixer.html>mixer</a> || 
<a href=pygame_mixer_music.html>mixer_music</a> || 
<a href=pygame_mouse.html>mouse</a> || 
<a href=pygame_surfarray.html>surfarray</a> || 
<a href=pygame_time.html>time</a> ||<br>


</td></tr></table>
<br>
<h2 align=center>Channel</h2>
Channel objects represent a single channel of sound. Each channel
can only playback one Sound object at a time. If your application
only requires simply sound playback, you will usually not need to
bother with the Channel objects, they exist for finer playback
control.
<br>&nbsp;<br>
Sound objects can be retrieved from the pygame.mixer module with
functions like pygame.mixer.Channel() and
pygame.mixer.find_channel(). Also, each time you call
Sound.play() a Channel object will be returned, representing the
channel that sound is playing on.

<hr>

<table>
<tr><td><a href=#fadeout>fadeout</a></td><td> -
fade out the channel</td></tr>


<tr><td><a href=#get_busy>get_busy</a></td><td> -
query state of the channel</td></tr>


<tr><td><a href=#get_volume>get_volume</a></td><td> -
query the volume for the</td></tr>


<tr><td><a href=#pause>pause</a></td><td> -
temporarily stop the channel</td></tr>


<tr><td><a href=#play>play</a></td><td> -
play a sound on this channel</td></tr>


<tr><td><a href=#set_volume>set_volume</a></td><td> -
set volume for channel</td></tr>


<tr><td><a href=#stop>stop</a></td><td> -
stop playing on the channel</td></tr>


<tr><td><a href=#unpause>unpause</a></td><td> -
restart a paused channel</td></tr>


</table>

<hr>

<a name=fadeout><font size=+2><b>fadeout
</b></font><br><font size=+1><tt>
Channel.fadeout(millisec) -> None
</tt></font><ul>
Fade out the playing sound and stops it over the
given millisonds.
</ul><br>&nbsp;<br>

<a name=get_busy><font size=+2><b>get_busy
</b></font><br><font size=+1><tt>
Channel.get_busy() -> bool
</tt></font><ul>
Returns true when there is a sound actively playing on this
channel.
</ul><br>&nbsp;<br>

<a name=get_volume><font size=+2><b>get_volume
</b></font><br><font size=+1><tt>
Channel.get_volume() -> val
</tt></font><ul>
Returns the current volume for this sound object. The value is
between 0.0 and 1.0.
</ul><br>&nbsp;<br>

<a name=pause><font size=+2><b>pause
</b></font><br><font size=+1><tt>
Channel.pause() -> None
</tt></font><ul>
Stops the sound that is playing on this channel,
but it can be resumed with a call to <a href=#unpause>unpause()</a>
</ul><br>&nbsp;<br>

<a name=play><font size=+2><b>play
</b></font><br><font size=+1><tt>
Channel.play(Sound, [loops, [maxtime]]) -> None
</tt></font><ul>
Starts playing a given sound on this channel. If the channels is
currently playing a different sound, it will be
replaced/restarted with the given sound. Loops controls how many
extra times the sound will play, a negative loop will play
indefinitely, it defaults to 0. Maxtime is the number of
totalmilliseconds that the sound will play. It defaults to
forever (-1).
</ul><br>&nbsp;<br>

<a name=set_volume><font size=+2><b>set_volume
</b></font><br><font size=+1><tt>
Channel.set_volume(val) -> None
</tt></font><ul>
Sets the volume for the channel. The channel's volume level is
mixed with the volume for the active sound object. The value is
between 0.0 and 1.0.
</ul><br>&nbsp;<br>

<a name=stop><font size=+2><b>stop
</b></font><br><font size=+1><tt>
Channel.stop() -> None
</tt></font><ul>
Stops the sound that is playing on this channel.
</ul><br>&nbsp;<br>

<a name=unpause><font size=+2><b>unpause
</b></font><br><font size=+1><tt>
Channel.unpause() -> None
</tt></font><ul>
Restarts a paused channel where it was paused.
</ul><br>&nbsp;<br>


<hr>

</body></html>