kmonsoor / pyglet

Automatically exported from code.google.com/p/pyglet
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Cygwin (unix library on windows) sound broken. #217

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Under cygwin graphics works but sound is broken. I can play sounds under
cygwin with:
korg@cam korg/Desktop $ esdplay intro.wav

I didnt have all the cygwin libraries installed when i did the dumps below
so i went and installed everything under the audio group, but still the
same error.

Im not sure how much you'd care about this (given you can just use the
windows version of python) but it works out of the box with gl only stuff
(multiwindow, etc) it is just the sound that is broken so it's sooooooooo
cloooose.

Sorry to just handball, but my ctypes-foo is weak and my windows foo is
even weaker.

What steps will reproduce the problem?
1. Install cygwin tools (gcc, python, shell, audio packages, gl packages etc)
2. grab pyglet source code & extract & install
3. cd examples/noisy
4. /usr/bin/python noisy.py

Paste in the traceback or error message:

This winblows python works with the windows install of pyglet (the .msi)....

korg@cam pyglet-1.0/examples/noisy $ which python
python: aliased to e:/python2.5/python.exe -u
korg@cam pyglet-1.0/examples/noisy $ python -i
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
(Intel)] onwin32
...

This cygwin python works with graphics, but not sound using the cygwin
install (from source)
korg@cam pyglet-1.0/examples/noisy $ /usr/bin/python
Python 2.5.1 (r251:54863, May 18 2007, 16:56:43)
[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
...

korg@cam pyglet-1.0/examples/noisy $ /usr/bin/python ./noisy.py
Traceback (most recent call last):
  File "./noisy.py", line 51, in <module>
    from pyglet import media
  File "/usr/lib/python2.5/site-packages/pyglet/media/__init__.py", line
1221, in <module>
    driver.driver_init()
  File
"/usr/lib/python2.5/site-packages/pyglet/media/drivers/directsound/__init__.py",
line 384, in driver_init
    dsound.SetCooperativeLevel(hwnd, lib.DSSCL_NORMAL)
  File "/usr/lib/python2.5/site-packages/pyglet/com.py", line 116, in <lambda>
    self.method.get_field()(self.i, self.name)(obj, *args)
TypeError: function takes exactly 1 argument (2 given)

Paste in the output of tools/gl_info.py:

korg@cam tmp/pyglet-1.0/tools $ python gl_info.py > /tmp/gli1
korg@cam tmp/pyglet-1.0/tools $ /usr/bin/python gl_info.py > /tmp/gli2
d%
korg@cam tmp/pyglet-1.0/tools $ diff /tmp/gli?
1,2c1,2
< Platform instance is <pyglet.window.win32.Win32Platform object at 0x00D32770>
< Display instance is <pyglet.window.win32.Win32Display object at  x00B07070>

---
> Platform instance is <pyglet.window.win32.Win32Platform object at 0x7fd22d6c>
> Display instance is <pyglet.window.win32.Win32Display object at 0x7ff3de2c>

korg@cam tmp/pyglet-1.0/tools $ less /tmp/gli2
Platform instance is <pyglet.window.win32.Win32Platform object at 0x7fd22d6c>
Display instance is <pyglet.window.win32.Win32Display object at 0x7ff3de2c>
Screens:
  Win32Screen(x=0, y=0, width=1280, height=1024)
  Win32Screen(x=0, y=0, width=1280, height=1024)
Creating default context...
GL attributes:
double_buffer=True stereo=False buffer_size=32 aux_buffers=4
sample_buffers=0 samples=0 red_size=8 green_size=8 blue_size=8
alpha_size=0 depth_size=24 stencil_size=0 accum_red_size=16
accum_green_size=16 accum_blue_size=16 accum_alpha_size=16
GL version: 2.1.1
GL vendor: NVIDIA Corporation
GL renderer: GeForce 6800/AGP/SSE2/3DNOW!
GL extensions:
  GL_ARB_texture_compression GL_NV_point_sprite
  GL_NV_fragment_program_option GL_NV_vertex_array_range2
  GL_EXT_blend_color GL_EXT_blend_subtract GL_EXT_stencil_wrap
  GL_NV_fence GL_EXT_vertex_array GL_IBM_texture_mirrored_repeat
  GL_EXT_texture_compression_s3tc GL_NV_vertex_program2_option
  GL_ARB_depth_texture GL_NV_packed_depth_stencil GL_EXT_Cg_shader
  GL_NV_primitive_restart GL_EXT_texture_object
  GL_NVX_conditional_render GL_NV_texture_compression_vtc
  GL_NV_texture_shader3 GL_NV_texture_shader2 GL_EXT_blend_func_separate
  GL_EXT_texture_cube_map GL_ARB_occlusion_query GL_ARB_transpose_matrix
  GL_ARB_texture_border_clamp GL_EXT_fog_coord GL_NV_depth_clamp
  GL_ARB_texture_cube_map GL_EXT_blend_equation_separate
  GL_NV_framebuffer_multisample_coverage GL_ARB_point_parameters
  GL_EXT_texture_env_dot3 GL_EXT_multi_draw_arrays
  GL_EXT_texture_env_combine GL_NV_fog_distance GL_ARB_vertex_program
  GL_ARB_texture_env_dot3 GL_EXT_bgra GL_NV_float_buffer
  GL_NV_texture_env_combine4 GL_ARB_texture_env_combine
  GL_ARB_vertex_buffer_object GL_EXT_shadow_funcs
  GL_NV_vertex_array_range GL_NV_texture_expand_normal
  GL_EXT_separate_specular_color GL_EXT_texture_env_add
  GL_EXT_packed_depth_stencil GL_EXT_texture_mirror_clamp
  GL_EXT_timer_query GL_NV_multisample_filter_hint GL_SUN_slice_accum
  GL_ARB_point_sprite GL_EXT_framebuffer_object GL_ARB_vertex_shader
  GL_ARB_half_float_pixel GL_KTX_buffer_region GL_NV_register_combiners
  GL_ARB_draw_buffers GL_ARB_fragment_program_shadow GL_NV_half_float
  GL_NV_fragment_program GL_ATI_texture_mirror_once
  GL_IBM_rasterpos_clip GL_EXT_texture_sRGB GL_EXT_stencil_two_side
  GL_SGIX_shadow GL_NV_texgen_reflection GL_EXT_compiled_vertex_array
  GL_NV_fragment_program2 GL_EXT_point_parameters GL_WIN_swap_hint
  GL_ARB_texture_float GL_ARB_fragment_shader GL_ATI_texture_float
  GL_NV_texture_shader GL_NV_pixel_data_range GL_ARB_imaging
  GL_ARB_fragment_program GL_ARB_shader_objects
  GL_ARB_shading_language_100 GL_NV_blend_square GL_EXT_secondary_color
  GL_ARB_texture_non_power_of_two GL_EXT_texture_lod_bias
  GL_NV_texture_rectangle GL_EXT_pixel_buffer_object GL_EXT_abgr
  GL_NV_vertex_program GL_ARB_texture_rectangle GL_ARB_multisample
  GL_SGIS_generate_mipmap GL_EXT_texture_filter_anisotropic
  GL_NV_light_max_exponent GL_EXT_blend_minmax GL_EXT_framebuffer_blit
  GL_SGIS_texture_lod GL_NV_vertex_program3 GL_NV_vertex_program2
  WGL_EXT_swap_control GL_SGIX_depth_texture GL_ARB_color_buffer_float
  GL_EXT_texture_edge_clamp GL_ARB_window_pos GL_ARB_shadow
  GL_ARB_texture_mirrored_repeat GL_EXT_gpu_program_parameters
  GL_EXT_texture_lod GL_S3_s3tc GL_NV_vertex_program1_1
  GL_EXT_framebuffer_multisample GL_EXT_texture3D GL_ARB_multitexture
  GL_NV_copy_depth_to_color GL_ATI_draw_buffers GL_EXT_depth_bounds_test
  GL_EXT_draw_range_elements GL_NV_occlusion_query
  GL_ARB_texture_env_add GL_EXT_packed_pixels GL_EXT_rescale_normal
  GL_ARB_pixel_buffer_object GL_NV_register_combiners2
GLU version: 1.2.2.0 Microsoft Corporation
GLU extensions:
  GL_EXT_bgra

Context is Win32Context()
WGL extensions:
 WGL_ARB_buffer_region WGL_ARB_extensions_string
 WGL_ARB_make_current_read WGL_ARB_multisample WGL_ARB_pbuffer
 WGL_ARB_pixel_format WGL_ARB_pixel_format_float WGL_ARB_render_texture
 WGL_ATI_pixel_format_float WGL_EXT_extensions_string
 WGL_EXT_swap_control WGL_NV_float_buffer WGL_NV_render_depth_texture
 WGL_NV_render_texture_rectangle

korg@cam tmp/pyglet-1.0/tools $ python al_info.py
Default device:         Generic Hardware
Default capture device: SB Live! 24-bit
Devices:                Generic Hardware, Generic Software
Capture devices:        SB Live! 24-bit

Using default device...
OpenAL version 1.1
Extensions:              ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_EFX, ☺

korg@cam tmp/pyglet-1.0/tools $ /usr/bin/python al_info.py
Traceback (most recent call last):
  File "al_info.py", line 16, in <module>
    from pyglet.media.drivers import openal
  File "/usr/lib/python2.5/site-packages/pyglet/media/__init__.py", line
1221, in <module>
    driver.driver_init()
  File
"/usr/lib/python2.5/site-packages/pyglet/media/drivers/directsound/__init__.py",
line 384, in driver_init
    dsound.SetCooperativeLevel(hwnd, lib.DSSCL_NORMAL)
  File "/usr/lib/python2.5/site-packages/pyglet/com.py", line 116, in <lambda>
    self.method.get_field()(self.i, self.name)(obj, *args)
TypeError: function takes exactly 1 argument (2 given)

Any additional info (platform/language/hardware) that may be relevant?

This is the build/install process.... (I unaliased python from the windows
version so it would pick up the cygwin one).

korg@cam ~/tmp $ rm -rf pyglet-1.0
korg@cam ~/tmp $ tar xpfz pyglet-1.0.tar.gz
korg@cam ~/tmp $ unalias python
unalias: no such hash table element: python
korg@cam ~/tmp $ which python
/usr/bin/python
korg@cam ~/tmp $ cd pyglet-1.0
korg@cam ~/tmp/pyglet-1.0 $ python setup.py install
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/pyglet
copying pyglet/clock.py -> build/lib/pyglet
copying pyglet/com.py -> build/lib/pyglet
copying pyglet/event.py -> build/lib/pyglet
copying pyglet/lib.py -> build/lib/pyglet
copying pyglet/__init__.py -> build/lib/pyglet
creating build/lib/pyglet/gl
copying pyglet/gl/agl.py -> build/lib/pyglet/gl
copying pyglet/gl/gl.py -> build/lib/pyglet/gl
copying pyglet/gl/glext_arb.py -> build/lib/pyglet/gl
copying pyglet/gl/glext_missing.py -> build/lib/pyglet/gl
copying pyglet/gl/glext_nv.py -> build/lib/pyglet/gl
copying pyglet/gl/glu.py -> build/lib/pyglet/gl
copying pyglet/gl/glu_info.py -> build/lib/pyglet/gl
copying pyglet/gl/glx.py -> build/lib/pyglet/gl
copying pyglet/gl/glxext_arb.py -> build/lib/pyglet/gl
copying pyglet/gl/glxext_mesa.py -> build/lib/pyglet/gl
copying pyglet/gl/glxext_nv.py -> build/lib/pyglet/gl
copying pyglet/gl/glx_info.py -> build/lib/pyglet/gl
copying pyglet/gl/gl_info.py -> build/lib/pyglet/gl
copying pyglet/gl/lib.py -> build/lib/pyglet/gl
copying pyglet/gl/lib_agl.py -> build/lib/pyglet/gl
copying pyglet/gl/lib_glx.py -> build/lib/pyglet/gl
copying pyglet/gl/lib_wgl.py -> build/lib/pyglet/gl
copying pyglet/gl/wgl.py -> build/lib/pyglet/gl
copying pyglet/gl/wglext_arb.py -> build/lib/pyglet/gl
copying pyglet/gl/wglext_nv.py -> build/lib/pyglet/gl
copying pyglet/gl/wgl_info.py -> build/lib/pyglet/gl
copying pyglet/gl/__init__.py -> build/lib/pyglet/gl
creating build/lib/pyglet/font
copying pyglet/font/base.py -> build/lib/pyglet/font
copying pyglet/font/carbon.py -> build/lib/pyglet/font
copying pyglet/font/freetype.py -> build/lib/pyglet/font
copying pyglet/font/freetype_lib.py -> build/lib/pyglet/font
copying pyglet/font/ttf.py -> build/lib/pyglet/font
copying pyglet/font/win32.py -> build/lib/pyglet/font
copying pyglet/font/__init__.py -> build/lib/pyglet/font
creating build/lib/pyglet/image
copying pyglet/image/__init__.py -> build/lib/pyglet/image
creating build/lib/pyglet/image/codecs
copying pyglet/image/codecs/dds.py -> build/lib/pyglet/image/codecs
copying pyglet/image/codecs/gdiplus.py -> build/lib/pyglet/image/codecs
copying pyglet/image/codecs/gdkpixbuf2.py -> build/lib/pyglet/image/codecs
copying pyglet/image/codecs/pil.py -> build/lib/pyglet/image/codecs
copying pyglet/image/codecs/png.py -> build/lib/pyglet/image/codecs
copying pyglet/image/codecs/pypng.py -> build/lib/pyglet/image/codecs
copying pyglet/image/codecs/quicktime.py -> build/lib/pyglet/image/codecs
copying pyglet/image/codecs/s3tc.py -> build/lib/pyglet/image/codecs
copying pyglet/image/codecs/__init__.py -> build/lib/pyglet/image/codecs
creating build/lib/pyglet/media
copying pyglet/media/avbin.py -> build/lib/pyglet/media
copying pyglet/media/procedural.py -> build/lib/pyglet/media
copying pyglet/media/riff.py -> build/lib/pyglet/media
copying pyglet/media/__init__.py -> build/lib/pyglet/media
creating build/lib/pyglet/media/drivers
copying pyglet/media/drivers/silent.py -> build/lib/pyglet/media/drivers
copying pyglet/media/drivers/__init__.py -> build/lib/pyglet/media/drivers
creating build/lib/pyglet/media/drivers/alsa
copying pyglet/media/drivers/alsa/asound.py ->
build/lib/pyglet/media/drivers/alsa
copying pyglet/media/drivers/alsa/__init__.py ->
build/lib/pyglet/media/drivers/alsa
creating build/lib/pyglet/media/drivers/directsound
copying pyglet/media/drivers/directsound/lib_dsound.py ->
build/lib/pyglet/media/drivers/directsound
copying pyglet/media/drivers/directsound/__init__.py ->
build/lib/pyglet/media/drivers/directsound
creating build/lib/pyglet/media/drivers/openal
copying pyglet/media/drivers/openal/lib_alc.py ->
build/lib/pyglet/media/drivers/openal
copying pyglet/media/drivers/openal/lib_openal.py ->
build/lib/pyglet/media/drivers/openal
copying pyglet/media/drivers/openal/__init__.py ->
build/lib/pyglet/media/drivers/openal
creating build/lib/pyglet/window
copying pyglet/window/event.py -> build/lib/pyglet/window
copying pyglet/window/key.py -> build/lib/pyglet/window
copying pyglet/window/mouse.py -> build/lib/pyglet/window
copying pyglet/window/__init__.py -> build/lib/pyglet/window
creating build/lib/pyglet/window/carbon
copying pyglet/window/carbon/constants.py -> build/lib/pyglet/window/carbon
copying pyglet/window/carbon/quartzkey.py -> build/lib/pyglet/window/carbon
copying pyglet/window/carbon/types.py -> build/lib/pyglet/window/carbon
copying pyglet/window/carbon/__init__.py -> build/lib/pyglet/window/carbon
creating build/lib/pyglet/window/win32
copying pyglet/window/win32/constants.py -> build/lib/pyglet/window/win32
copying pyglet/window/win32/types.py -> build/lib/pyglet/window/win32
copying pyglet/window/win32/winkey.py -> build/lib/pyglet/window/win32
copying pyglet/window/win32/__init__.py -> build/lib/pyglet/window/win32
creating build/lib/pyglet/window/xlib
copying pyglet/window/xlib/cursorfont.py -> build/lib/pyglet/window/xlib
copying pyglet/window/xlib/xinerama.py -> build/lib/pyglet/window/xlib
copying pyglet/window/xlib/xlib.py -> build/lib/pyglet/window/xlib
copying pyglet/window/xlib/__init__.py -> build/lib/pyglet/window/xlib
running install_lib
running install_egg_info
Removing /usr/lib/python2.5/site-packages/pyglet-1.0-py2.5.egg-info
Writing /usr/lib/python2.5/site-packages/pyglet-1.0-py2.5.egg-info
korg@cam ~/tmp/pyglet-1.0 $ cd examples/noisy
korg@cam pyglet-1.0/examples/noisy $ python noisy.py
Traceback (most recent call last):
  File "noisy.py", line 51, in <module>
    from pyglet import media
  File "/usr/lib/python2.5/site-packages/pyglet/media/__init__.py", line
1221, in <module>
    driver.driver_init()
  File
"/usr/lib/python2.5/site-packages/pyglet/media/drivers/directsound/__init__.py",
line 384, in driver_init
    dsound.SetCooperativeLevel(hwnd, lib.DSSCL_NORMAL)
  File "/usr/lib/python2.5/site-packages/pyglet/com.py", line 116, in <lambda>
    self.method.get_field()(self.i, self.name)(obj, *args)
TypeError: function takes exactly 1 argument (2 given)

Original issue reported on code.google.com by cameron.blackwood on 20 Jan 2008 at 12:39

GoogleCodeExporter commented 9 years ago

Whoooot (as they say)

korg@cam pyglet-1.0/examples/noisy $ which python
/usr/bin/python
korg@cam pyglet-1.0/examples/noisy $ export PYGLET_AUDIO="alsa"
korg@cam pyglet-1.0/examples/noisy $ python noisy.py
Traceback (most recent call last):
  File "noisy.py", line 51, in <module>
    from pyglet import media
  File "/usr/lib/python2.5/site-packages/pyglet/media/__init__.py", line 1219, i
n <module>
    raise ImportError('No suitable audio driver could be loaded.')
ImportError: No suitable audio driver could be loaded.

korg@cam pyglet-1.0/examples/noisy $ export PYGLET_AUDIO="openal"
korg@cam pyglet-1.0/examples/noisy $ python noisy.py
**WORKED!!**

silent also worked (but without sound obviously!)

So it is just the directsound use which is broken.

Original comment by cameron.blackwood on 20 Jan 2008 at 12:47

GoogleCodeExporter commented 9 years ago
DirectSound can never work under the cygwin build, as the cygwin build of ctypes
doesn't include COM support (the calling convention is different enough from C 
that
it can't be emulated from Python alone).

I've made pyglet.com fail on import if sys.platform != 'win32' in r1623.  This 
should
cause the DirectSound driver to fail on import at the appropriate time, so the 
OpenAL
driver should be used as a fallback automatically, without any environment vars.

Let me know if that works for you.

Original comment by Alex.Hol...@gmail.com on 20 Jan 2008 at 12:53

GoogleCodeExporter commented 9 years ago
svn checkout and reinstall fixed it. Go pyglet, go pyglet... :)

Original comment by cameron.blackwood on 20 Jan 2008 at 1:31

GoogleCodeExporter commented 9 years ago
Closing issue.

Original comment by Alex.Hol...@gmail.com on 20 Jan 2008 at 1:37