cocos 0.3.1beta audio problems

3 views
Skip to first unread message

claudio canepa

unread,
Mar 11, 2010, 8:43:18 PM3/11/10
to cocos2d discuss
I found some problems with the new audio:
In windows xp, a small script that don't uses audio:

D:\pcode\cocos coloLayer>test_3rects.py
Traceback (most recent call last):
File "D:\pcode\cocos coloLayer\test_3rects.py", line 10, in <module>
director.init( resizable=True )
File "D:\cocos_pristine\cocos_dev\cocos_released\cocos\director.py", line 342,
in init
raise NoAudioError(msg)
cocos.audio.exceptions.NoAudioError: cocos.audio isn't able to work without need
ed dependencies. Try installing pygame for fixing it, or forcing no audio mode b
y calling director.init with audio=None, or setting the COCOS2D_NOSOUND=1 variab
le in your env.

There is a report with other audio problem in linux (issue 140)

The old docs and all the apps that people can look for guidance are in terms of pyglet audio

Maybe we should add the kwarg
pyglet_audio=True
in the call to director.init() at least for the short term(pyweek)?
And try to load the relevant subsytem ?
Is this feasible Daniel ? (ie not too complicate)


A first peek to the problem in win xp: 

The problem is that ctypes cant find some dll's.
Copying from site-packages/pygame  to the failing script directory the following dlls
libogg-0.dll
libvorbis-0.dll
libvorbisfile-3.dll
SDL.dll
SDL_image.dll
SDL_mixer.dll
smpeg.dll

allows the script to run.

I think the problem is the use of ctypes.util.find_library:
a quick look at python docs 2.6 tells:
""" On Windows, find_library searches along the system search path, and returns the full pathname"""

For windows XP, that means current working directory, then windows/system32. Anyway, the standart pygame installer puts the dlls in site-packages\pygame , so ctypes cannot find the libraries.
A quick run in the python 2.6 interpreter:
>>> ctypes.WinDLL(r'c:\python26\Lib\site-packages\pygame\SDL.dll')
<WinDLL 'c:\python26\Lib\site-packages\pygame\SDL.dll', handle 6a740000 at b34f70>

meaning it is possible to load from a specific path 

 A possible fix for windows xp can be:
  1. include the dlls in cocos\dlls
  2. load the libs with ctypes.WinDLL  , not find_library

Windows vista  or win7 can have additional problems ( manifests ?).
At the moment I don't have access to those OS.

Clearly more experimentation is needed.

--
claudio 


 


 

Claudio Canepa

unread,
Mar 11, 2010, 11:34:01 PM3/11/10
to cocos2d discuss

On 11 mar, 22:43, claudio canepa <ccanep...@gmail.com> wrote:
> Maybe we should add the kwarg
> pyglet_audio=True
> in the call to director.init() at least for the short term(pyweek)?
> And try to load the relevant subsytem ?
> Is this feasible Daniel ? (ie not too complicate)

Using the COCOS2D_NOSOUND=1 with a game using the pyglet audio lets
the game run with sound, so if pyglet_audio=True is implemented the
same as COCOS2D_NOSOUND=1, the thing is easy.

--
claudio

devon

unread,
Mar 12, 2010, 2:13:54 PM3/12/10
to cocos2d discuss
maybe nosound should default true, at least for now? some (all?) of
the old
tests fail because it defaults to try and import sound but it's not
detecting my pygame dlls in windows 7 either.
Reply all
Reply to author
Forward
0 new messages