module music
The music
module provides some facilities for handling music. Individual pieces
of music can be started and stopped, or playlists can be constructed
and played sequentially or randomly. There are also some control and
dialog classes available for setting music-related options.
See also: PlayList, EnableMusicControl, MusicVolumeControl, MusicOptionsDialog
Variables
- fadeout_time
- Time in seconds over which the currently playing music is faded out when stopping or changing to a different piece of music.
- change_delay
- Time in seconds between stopping the previously playing music and starting the next piece of music.
Functions
- get_music(name, ..., prefix = "music")
- Returns the full pathname of a music resource.
- get_playlist(name, ..., prefix = "music", random = False, repeat = False)
- Returns a PlayList
constructed from a resource consisting of a directory of music files.
The random and repeat arguments are passed on to the PlayList
constructor.
- change_music(new_music, repeat = False)
- Fades
out any currently playing music and starts playing the specified music
file. If repeat is true, the file will be repeated indefinitely,
otherwise it will only play once.
- change_playlist(playlist)
- Fades out any currently playing music and starts playing from the specified playlist.
- get_music_enabled()
- Returns true if music is currently enabled.
- set_music_enabled(state)
- Enables or disables music. Note: To work around a bug in the pygame music
system, disabling music will cause the currently playing music to be
started again from the beginning when music is re-enabled.