Hello,

I'm developing a game using Pyglet that plays Mp3 files so it uses
AVBin.dll.

Some users are using Win7 and Vista with DEP enabled, so they receive errors
like:

Traceback (most recent call last):
 File "Engine001.py", line 243, in <module>
 File "pygletmedia__init__.pyc", line 1386, in load
 File "pygletmediaavbin.pyc", line 247, in __init__
WindowsError: exception: access violation writing 0x6E6BBA88

or

Traceback (most recent call last):
  File "Engine001.py", line 243, in <module>
  File "pyglet\media\__init__.pyc", line 1386, in load
  File "pyglet\media\riff.pyc", line 202, in __init__
pyglet.media.riff.WAVEFormatException: AVbin is required to decode
compressed media

I know this has been reported several times and the solution is disable or
configure DEP. In fact, if they disable DEP (or configure for Windows
programs and services only) the game runs correctly.

Unfortunately it seems that it is very hard to ask users to disable or
configure DEP just to play my game :(

So I'm using the attached code  as a workaround.

Do you think that there is a better way? Would you recommend me a different
audio library?

I just want to loop mp3/ogg files and play wav files for player's actions.

Thank you

JF

CODE:

import pyglet
import mp3play  #http://code.google.com/p/mp3play/
import winsound  #http://docs.python.org/library/winsound.html

try:
    import pyglet.media.avbin
    have_avbin = True
except:
    have_avbin = False

#print have_avbin

#For MP3s:
if have_avbin:
    mp3 = pyglet.resource.media("media\pyweek.mp3")
    mp3.play()
else:
    mp3 = mp3play.load("media/pyweek.mp3")
    mp3.play()

#For Wav's
if have_avbin:
    wavJump = pyglet.resource.media("sounds/salto.wav",streaming=False)
    wavJump.play()
else:
    winsound.PlaySound("media/salto.wav",winsound.SND_ASYNC)


window = pyglet.window.Window(200,40)
label = pyglet.text.Label("AVBin Test: %s" % have_avbin)

@window.event
def on_draw():
    window.clear()
    label.draw()

pyglet.app.run()

-- 
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.

Reply via email to