Pygame&蟒蛇3

时间:2017-07-13 14:12:14

标签: python raspberry-pi pygame raspberry-pi3

我已经和pygame和我的树莓派玩了一段时间了。我只需要播放一些声音,加载它们,卸载它们......等等。这是我的代码:

import time
import pygame


pygame.mixer.pre_init(44100, -16, 2, 2048)
pygame.mixer.init();

i = 0;
try:
        while 1:
                if not pygame.mixer.music.get_busy():
                    pygame.mixer.music.load('sounds/4min_440hz.mp3');
                    pygame.mixer.music.play(0);
                    print("Play sound \n");
            elif i == 10:
                    pygame.poxer.music.stop();
                    i = 0;
            time.sleep(0.5);
            i += 1;
except KeyboardInterrupt: # exit
    print('The end \n');

声音播放正常,但是一旦我使用stop()方法,我就会收到以下错误:

Traceback (most recent call last):
  File "soundTester.py", line 18, in <module>
*** Error in `python3': free(): invalid next size (normal): 0x00e70850 ***
Aborted

对于记录我几个月前在RPI3上测试了这个,我只在3或4次停止()左右后出现此错误。昨天我尝试了一个RPI2,我在第一站()直接得到它。我使用最新的Raspbian构建。

我做了一些研究,似乎这个&#34; free()&#34; bug不是特定于pygame,而是发生在其他库的其他情况下。有没有人知道如何解决这个问题?

提前致谢:)

0 个答案:

没有答案
相关问题