[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Pygame sound delay problem



sound_test.zip
<http://pygame-users.25799.n6.nabble.com/file/n407/sound_test.zip>  
I'm uploading a zip of the demo with one of the sounds I a using. A copy of
the code is posted below. I did some more tests, and apparently in my
previous efforts I somehow was passing an incorrect value into the pre_init
call (which I'm assuming pygame was silently ignoring). So, after fixing
that, the demo and my game run fine. But only on my XP laptop. On the
desktop the demo runs fine, but the game still has the delay... what gives?
Is there something in my windows 7 audio system that could be causing the
delay? Or could it be in my game loop? If that's the case, why would it run
great on my way old laptop and not on the really nice new desktop?

import pygame, sys
from pygame.constants import *

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

BACKGROUND_FILL = (217,204,185)

display = pygame.display.set_mode((400,400))
clock = pygame.time.Clock()

sound_obj = pygame.mixer.Sound('some_sound.wav')
    
while True:
    clock.tick(30)
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()

        if event.type == MOUSEBUTTONDOWN:
            sound_obj.play()

    display.fill(BACKGROUND_FILL)
    pygame.display.update()




--
View this message in context: http://pygame-users.25799.n6.nabble.com/Pygame-sound-delay-problem-tp405p407.html
Sent from the pygame-users mailing list archive at Nabble.com.