Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > dbcc611327ae4eb415bdca58fe00e521 > files > 32

pygame-doc-1.5.5-1mdk.ppc.rpm

<html>
<title>pygame.mixer.music</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&nbsp;&nbsp;&nbsp;documentation</b>
</td><td bgcolor=6aee28 align=center valign=top width=100%>

	||&nbsp;
	<a href=http://www.pygame.org>Home</a> &nbsp;||&nbsp;
	<a href=../index.html>Help Contents</a> &nbsp;||
	<br>&nbsp;<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>
&nbsp;<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>
&nbsp;<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>pygame.mixer.music</h2>
The music module is tied closely to the pygame.mixer module. It
is an optional module since it depends on the SDL_mixer library.
You should not manually import the music library. Instead it is
automatically included as a part of the mixer library. The default
module path to music is pygame.mixer.music.
<br>&nbsp;<br>
The difference between playback of music and playback of sounds
is that the music object is not loaded and decoded all at once,
instead the music data is streamed and decoded during playback.
There can only be one music file loaded at a single time. Loading
a new music file will replace any currently loaded music.
<br>&nbsp;<br>
The music module has many of the same types of functions as the
Sound objects. The main difference is only one music object can
be loaded at a time, with the <a href=#load>load()</a> function. Music
must be stored in an individual file on the system, it cannot be
loaded from special file-like objects through python.

<hr>

<table>
<tr><td><a href=#fadeout>fadeout</a></td><td> -
fadeout current music</td></tr>


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


<tr><td><a href=#get_endevent>get_endevent</a></td><td> -
query the current music finished event</td></tr>


<tr><td><a href=#get_pos>get_pos</a></td><td> -
query music position</td></tr>


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


<tr><td><a href=#load>load</a></td><td> -
load current music</td></tr>


<tr><td><a href=#pause>pause</a></td><td> -
pause the playing music</td></tr>


<tr><td><a href=#play>play</a></td><td> -
play the current loaded music</td></tr>


<tr><td><a href=#queue>queue</a></td><td> -
preload and queue a music file</td></tr>


<tr><td><a href=#rewind>rewind</a></td><td> -
restarts music</td></tr>


<tr><td><a href=#set_endevent>set_endevent</a></td><td> -
sets music finished event</td></tr>


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


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


<tr><td><a href=#unpause>unpause</a></td><td> -
restarts the paused music</td></tr>


</table>

<hr>

<a name=fadeout><font size=+2><b>fadeout
</b></font><br><font size=+1><tt>
pygame.mixer.music.fadeout(millisec) -> None
</tt></font><ul>
Fades out the current playing music and stops it over the given
milliseconds.
</ul><br>&nbsp;<br>

<a name=get_busy><font size=+2><b>get_busy
</b></font><br><font size=+1><tt>
pygame.mixer.music.get_busy() -> bool
</tt></font><ul>
Returns true if music is currently playing
</ul><br>&nbsp;<br>

<a name=get_endevent><font size=+2><b>get_endevent
</b></font><br><font size=+1><tt>
pygame.mixer.music.get_endevent([eventid]) -> int
</tt></font><ul>
When the music has finished playing, you can optionally have
pygame place a user defined message on the event queue. If there
is no callback event set, NOEVENT will be returned. Otherwise it
will return the id of the current music finishe event.
</ul><br>&nbsp;<br>

<a name=get_pos><font size=+2><b>get_pos
</b></font><br><font size=+1><tt>
pygame.mixer.music.get_pos() -> val
</tt></font><ul>
Get the current (interpolated) time position of the music.
Value is in ms, just like <a href=pygame_time.html#get_ticks>get_ticks()</a>.
<br>&nbsp;<br>
The returned time is only tracking the amount of music
played. It will not reflect the result of starting the
music at an offset.
</ul><br>&nbsp;<br>

<a name=get_volume><font size=+2><b>get_volume
</b></font><br><font size=+1><tt>
pygame.mixer.music.get_volume() -> val
</tt></font><ul>
Get the current volume for the music. Value is
between 0.0 and 1.0.
</ul><br>&nbsp;<br>

<a name=load><font size=+2><b>load
</b></font><br><font size=+1><tt>
pygame.mixer.music.load(filename) -> None
</tt></font><ul>
Load a music object as the current music. The music only handles
one music as the current. If music is currently playing, it will
be stopped and replaced with the given one. Loading music only
supports filenames, not file-like objects.
</ul><br>&nbsp;<br>

<a name=pause><font size=+2><b>pause
</b></font><br><font size=+1><tt>
pygame.mixer.music.pause() -> None
</tt></font><ul>
Temporarily stops the current music.
</ul><br>&nbsp;<br>

<a name=play><font size=+2><b>play
</b></font><br><font size=+1><tt>
pygame.mixer.music.play(loops=0, startpos=0.0) -> None
</tt></font><ul>
Starts playing the current loaded music. This will restart the
sound if it is playing. Loops controls how many extra time the
sound will play, a negative loop will play indefinitely, it
defaults to 0.
<br>&nbsp;<br>
The starting position argument controls where in the music the
song starts playing. The starting position is dependent on the
format of music playing. MP3 and OGG use the position as time
(in seconds). MOD music it is the pattern order number. Passing
a startpos will raise a NotImplementedError if it cannot set the
start position (or your version of SDL_mixer is too old)
</ul><br>&nbsp;<br>

<a name=queue><font size=+2><b>queue
</b></font><br><font size=+1><tt>
pygame.mixer.music.queue(soundfile) -> None
</tt></font><ul>
This will load a music file and queue it. A queued music file
will begin as soon as the current music naturally ends. If the
current music is ever stopped or changed, the queued song will
be lost.
</ul><br>&nbsp;<br>

<a name=rewind><font size=+2><b>rewind
</b></font><br><font size=+1><tt>
pygame.mixer.music.rewind() -> None
</tt></font><ul>
Restarts playback of the current music.
</ul><br>&nbsp;<br>

<a name=set_endevent><font size=+2><b>set_endevent
</b></font><br><font size=+1><tt>
pygame.mixer.music.set_endevent([eventid]) -> None
</tt></font><ul>
When the music has finished playing, you can optionally have
pygame place a user defined message on the event queue. If the
eventid field is omittied or NOEVENT, no messages will be sent
when the music finishes playing. Once the endevent is set, it
will be called every time the music finished playing.
</ul><br>&nbsp;<br>

<a name=set_volume><font size=+2><b>set_volume
</b></font><br><font size=+1><tt>
pygame.mixer.music.set_volume(val) -> None
</tt></font><ul>
Sets the current volume for the music. 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>
pygame.mixer.music.stop() -> None
</tt></font><ul>
Stops playback of the current music.
</ul><br>&nbsp;<br>

<a name=unpause><font size=+2><b>unpause
</b></font><br><font size=+1><tt>
pygame.mixer.music.unpause() -> None
</tt></font><ul>
Restarts playback of the current music object when paused.
</ul><br>&nbsp;<br>


<hr>
</body></html>