Avbin - Windows DEP issue workaround advise

66 views
Skip to first unread message

Juan Fco. Roco

unread,
Apr 17, 2010, 11:52:04 PM4/17/10
to pyglet...@googlegroups.com
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

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 pyglet...@googlegroups.com.
To unsubscribe from this group, send email to pyglet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en.

JF

unread,
Apr 19, 2010, 2:56:14 AM4/19/10
to pyglet-users
Hello,

After posting this I remembered that you can play wav files directly
from Pyglet not using AVBin so winsound is not actually necessary.

So for wav's I just can do this:

wavJump = pyglet.resource.media("media/salto.wav",streaming=False)
wavJump.play())

But unfortunately I'm not sure if this is going to cause a
WindowsError when I add the .dll file to my project, because I think
Pyglet will try to use avbin.dll if it is in the lib path, so to be
sure I'm not including the avbin.dll with my project any longer (1MB
compressed)

Instead of that I added a simple loop method to mp3play module, so I
don't need AVBin.dll anymore (at least for me I just needed it for
looping a mp3 file during gameplay).-

If you know a better way of doing this play let me know.

Best regards

JF
Reply all
Reply to author
Forward
0 new messages