Pygame 简明教程
Pygame - Mixer Channels
可以播放声音对象,而不是自动选择的默认通道。首先,使用以下命令创建一个通道对象 −
The Sound object can be played on a specific channel instead of the default channel automatically chosen. First create a channel object using the following command −
pygame.mixer.Channel(id)
以下函数在 mixer.channel 类中定义 −
Following functions are defined in the mixer.channel class −
play(Sound, loops=0, maxtime=0, fade_ms=0) |
This will begin playback of a Sound on a specific Channel. |
stop() |
Stop sound playback on a channel. After playback is stopped the channel becomes available for new Sounds to play on it |
pause() |
Temporarily stop the playback of sound on a channel. |
unpause() |
Resume the playback on a paused channel. |
set_volume(value) |
Set the volume (loudness) of a playing sound. The value argument is between 0.0 and 1.0. |
queue(Sound) |
When a Sound is queued on a Channel, it will begin playing immediately after the current Sound is finished. |