无法无间隙地循环 ctcsound.performancethread

问题描述

我正在尝试使用 csoundPerformance 线程使用 ctcsound 循环一个 .csd 文件。但是,每次循环结束时,持续时间都会有大约一秒的差距,我无法摆脱它。 感谢大家的帮助!

def main():
    

    
    pygame.init()
    screen = pygame.display.set_mode((400,400))
    pygame.display.set_caption("So help me god")
    
    track1 = False
    track1con = False
    
    while 1:
        
        for event in pygame.event.get():
            if event.type == QUIT:
                return
            elif event.type == pygame.KEYDOWN:
                if event.key == pygame.K_a:
                    if track1 == False:
                        track1 = True
                    else:
                        t1.stop()
                        track1 = False
                    print("TRACK 1: " + str(track1))
                          
        pygame.draw.circle(screen,(255,0),(30,200),20 )
        if track1 == True:
            pygame.draw.circle(screen,(0,255,20 )
            if not track1con:
                c1 = ctcsound.csound()
                c1.compile_("csound","sound.csd")
                t1 = ctcsound.csoundPerformanceThread(c1.csound())
                t1.scoreEvent(1,"i",(2,8,1,70))
            if t1.status() == 0:
                track1con = True
                t1.play()
            else:
                track1con = False

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)