snd.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:solarwolf 作者: pygame 项目源码 文件源码
def play(name, volume=1.0, pos=-1):
    prefvolume = [0, 0.6, 1.0][game.volume]
    volume *= prefvolume
    if not volume:
        return
    sound = fetch(name)
    if sound:
        chan = sound.play()
        if not chan:
            chan = pygame.mixer.find_channel(1)
            chan.play(sound)
        if chan:
            if pos == -1:
                percent = 0.5
            else:
                percent = (pos / 700.0)
            inv = 1.0 - percent
            chan.set_volume(inv*volume, percent*volume)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号