Mercurial > pygame
view docs/ref/Sound.html @ 457:c7745825439b
trunc fix
| author | pygame |
|---|---|
| date | Mon, 12 May 2003 14:54:13 +0000 |
| parents | f4e6726b7d1d |
| children | 4c398dd9d49b |
line wrap: on
line source
<html> <title>Sound</title> <body bgcolor=#aaeebb text=#000000 link=#331111 vlink=#331111> <table cellspacing=3 width=100%><tr><td bgcolor=#00000> <table width=100%><tr><td bgcolor=c2fc20 align=center> <a href=http://www.pygame.org> <img src=../pygame_tiny.gif border=0 width=200 height=60></a><br> <b>pygame documentation</b> </td><td bgcolor=6aee28 align=center valign=top width=100%> || <a href=http://www.pygame.org>Home</a> || <a href=../index.html>Help Contents</a> || <br> <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_draw.html>draw</a> || <a href=pygame_event.html>event</a> ||<br> || <a href=pygame_font.html>font</a> || <a href=pygame_image.html>image</a> || <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> ||<br> || <a href=pygame_mouse.html>mouse</a> || <a href=pygame_movie.html>movie</a> || <a href=pygame_sndarray.html>sndarray</a> || <a href=pygame_surfarray.html>surfarray</a> || <a href=pygame_time.html>time</a> || <a href=pygame_transform.html>transform</a> ||<br> <br>|| <a href=CD.html>CD</a> || <a href=Channel.html>Channel</a> || <a href=Clock.html>Clock</a> || <a href=Font.html>Font</a> || <a href=Joystick.html>Joystick</a> || <a href=Movie.html>Movie</a> ||<br> || <a href=Rect.html>Rect</a> || <a href=Sound.html>Sound</a> || <a href=Surface.html>Surface</a> ||<br> <br>|| <a href=pygame_cursors.html>cursors</a> || <a href=pygame_sprite.html>sprite</a> ||<br> </td></tr></table></td></tr></table> <br> <h2 align=center>Sound</h2> Sound objects represent actual sound data. Sound objects are created from the function <a href=pygame_mixer.html#Sound>pygame.mixer.Sound()</a>. Sound objects can be playing on multiple channels simultaneously. Calling functions like <a href=#stop>Sound.stop()</a> from the sound objects will effect all channels playing that Sound object. <br> <br> All sound objects have the same frequency and format as the pygame.mixer module's initialization. <hr> <table> <tr><td><a href=#fadeout>fadeout</a></td><td> - fadeout all channels playing this sound</td></tr> <tr><td><a href=#get_num_channels>get_num_channels</a></td><td> - number of channels with sound</td></tr> <tr><td><a href=#get_volume>get_volume</a></td><td> - query volume for sound</td></tr> <tr><td><a href=#play>play</a></td><td> - play sound</td></tr> <tr><td><a href=#set_volume>set_volume</a></td><td> - change volume for sound</td></tr> <tr><td><a href=#stop>stop</a></td><td> - stop all channels playing this sound</td></tr> </table> <hr> <a name=fadeout><font size=+2><b>fadeout </b></font><br><font size=+1><tt> Sound.fadeout(millisec) -> None </tt></font><ul> Fade out all the playing channels playing this sound over the. All channels playing this sound will be stopped after the given milliseconds. </ul><br> <br> <a name=get_num_channels><font size=+2><b>get_num_channels </b></font><br><font size=+1><tt> Sound.get_num_channels() -> int </tt></font><ul> Returns the number of channels that have been using this sound. The channels may have already finished, but have not started playing any other sounds. </ul><br> <br> <a name=get_volume><font size=+2><b>get_volume </b></font><br><font size=+1><tt> Sound.get_volume() -> val </tt></font><ul> Returns the current volume for this sound object. The value is 0.0 to 1.0. </ul><br> <br> <a name=play><font size=+2><b>play </b></font><br><font size=+1><tt> Sound.play([loops, [maxtime]]) -> Channel </tt></font><ul> Starts playing a song on an available channel. If no channels are available, it will not play and return None. 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 total milliseconds that the sound will play. It defaults to forever (-1). <br> <br> Returns a channel object for the channel that is selected to play the sound. </ul><br> <br> <a name=set_volume><font size=+2><b>set_volume </b></font><br><font size=+1><tt> Sound.set_volume(val) -> None </tt></font><ul> Set the play volume for this sound. This will effect any channels currently playing this sound, along with all subsequent calls to play. The value is 0.0 to 1.0. </ul><br> <br> <a name=stop><font size=+2><b>stop </b></font><br><font size=+1><tt> Sound.stop() -> None </tt></font><ul> This will instantly stop all channels playing this sound. </ul><br> <br> <hr> </body></html>
