import pyglet
#import time

window = pyglet.window.Window()

# i use this for my code.
#pyglet.resource.path = ['/resources']
#pyglet.resource.reindex()
#bullet_sound = pyglet.resource.media("bullet.wav", streaming=False)
                                            ## streaming fix's an error 
message

bullet_sound = pyglet.media.load("/resources/bullet.wav", streaming=False)

@window.event
def on_key_press(symbol, modifiers):
    # sound only plays for a millisecond 
    bullet_sound.play()

    # this lets the sound complete
    #time.sleep(1)

    # also tried this with 'update()'
    #player.queue(bullet_sound)

#def update(dt):
#    player.play()
#pyglet.clock.schedule_interval(update, 1/120.0)

pyglet.app.run()

I can't seem to find anything about this when google searching. Sleeping 
makes the sound finish, so i suppose it has something to do with it 
dropping the sound prematurely. But how to i get it not to do so?

I even tried using the player, putting it in an update function and queuing 
it from the event, but that din't change anything.

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pyglet-users+unsubscr...@googlegroups.com.
To post to this group, send email to pyglet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to