[pypy-svn] r55063 - in pypy/dist/pypy/rlib/rsdl: . test

karlb at codespeak.net karlb at codespeak.net
Wed May 21 15:30:23 CEST 2008


Author: karlb
Date: Wed May 21 15:30:21 2008
New Revision: 55063

Added:
   pypy/dist/pypy/rlib/rsdl/RMix.py
   pypy/dist/pypy/rlib/rsdl/test/test_sdl_mixer.py
Modified:
   pypy/dist/pypy/rlib/rsdl/RSDL.py
Log:
Adding SDL_mixer support to RSDL


Added: pypy/dist/pypy/rlib/rsdl/RMix.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/rlib/rsdl/RMix.py	Wed May 21 15:30:21 2008
@@ -0,0 +1,17 @@
+from pypy.rpython.lltypesystem import lltype, rffi
+from pypy.rpython.tool import rffi_platform as platform
+from pypy.translator.tool.cbuild import ExternalCompilationInfo
+from pypy.rlib.rsdl import RSDL
+
+eci = ExternalCompilationInfo(
+    includes=['SDL_mixer.h'],
+    libraries=['SDL_mixer'],
+    )
+eci = eci.merge(RSDL.eci)
+
+def external(name, args, result):
+    return rffi.llexternal(name, args, result, compilation_info=eci)
+
+OpenAudio = external('Mix_OpenAudio',
+                [rffi.INT, RSDL.Uint16, rffi.INT, rffi.INT],
+                rffi.INT)

Modified: pypy/dist/pypy/rlib/rsdl/RSDL.py
==============================================================================
--- pypy/dist/pypy/rlib/rsdl/RSDL.py	(original)
+++ pypy/dist/pypy/rlib/rsdl/RSDL.py	Wed May 21 15:30:21 2008
@@ -234,6 +234,10 @@
                             [rffi.INT], 
                             rffi.CCHARP)
 
+GetError         = external('SDL_GetError',
+                            [],
+                            rffi.CCHARP)
+
 # ------------------------------------------------------------------------------
 
 

Added: pypy/dist/pypy/rlib/rsdl/test/test_sdl_mixer.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/rlib/rsdl/test/test_sdl_mixer.py	Wed May 21 15:30:21 2008
@@ -0,0 +1,9 @@
+import py, os
+import autopath
+from pypy.rlib.rsdl import RSDL, RMix, RSDL_helper
+from pypy.rpython.lltypesystem import lltype, rffi
+
+def test_open_mixer():
+    if RMix.OpenAudio(22050, RSDL.AUDIO_S16LSB, 2, 1024) != 0:
+        error = rffi.charp2str(RSDL.GetError())
+        raise Exception(error)



More information about the Pypy-commit mailing list