The following doesn't work correctly in windows XP. It plays one Sin
wave and then continues to beep. This is from pyglet installed via
the MSI.
import pyglet
pyglet.options['audio'] = ('directsound',)
from pyglet import font, window, media, clock
from pyglet.gl import *
from pyglet.window import event, key
def testcw():
# The OpenGL context is created only when you create a window.
Any calls
# to OpenGL before a window is created will fail.
win = window.Window(visible=False)
win.set_visible()
# ... perform any OpenGL state initialisation here.
glShadeModel(GL_SMOOTH)
glClearColor(0, 0, 0, 0.5)
glClearDepth(1.0)
glEnable(GL_DEPTH_TEST)
glDepthFunc(GL_LEQUAL)
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)
glLoadIdentity()
player = media.Player()
@player.event
def on_eos():
print "got sound"
player.eos_action = player.EOS_NEXT
win.push_handlers(event.WindowEventLogger())
win.clear()
sin = media.StaticSource(procedural.Sine(2))
player.queue(sin)
while not win.has_exit:
time_passed = clock.tick()
player.play()
win.flip()
win.dispatch_events()
player.dispatch_events()
if __name__ == '__main__':
testcw()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---