@@ -24,7 +24,7 @@ def __setattr__(self, key, value):
2424
2525class Device (_NoSetAttr ):
2626 def __init__ (self , name = None ):
27- print repr (_alc .GetString (0 , _alc .ALC_DEVICE_SPECIFIER ))
27+ # print repr(_alc.GetString(0, _alc.ALC_DEVICE_SPECIFIER))
2828 self ._handle = _alc .OpenDevice (name )
2929 def __del__ (self ):
3030 if hasattr (self , "_handle" ):
@@ -130,7 +130,12 @@ def unqueue_buffers(self, buffers):
130130 raise NotImplementedError
131131 def play (self ):
132132 _al .SourcePlay (self ._handle )
133- #def play, pause, stop, rewind(self):
133+ def pause (self ):
134+ _al .SourcePause (self ._handle )
135+ def stop (self ):
136+ _al .SourceStop (self ._handle )
137+ def rewindy (self ):
138+ _al .SourceRewind (self ._handle )
134139
135140 position = property (
136141 lambda self : call_array (ctypes .c_float , 3 , _al .GetSourcefv , self ._handle , _al .POSITION ),
@@ -217,9 +222,12 @@ def play(self):
217222 )
218223
219224class Buffer (_NoSetAttr ):
220- def __init__ (self , filename = None ):
225+ def __init__ (self , filename = None , data = None ):
226+ assert filename is None or data is None
221227 if filename is not None :
222228 self ._handle = _alut .CreateBufferFromFile (filename )
229+ elif data is not None :
230+ self ._handle = _alut .CreateBufferFromFileImage (data , len (data ))
223231 else :
224232 x = ctypes .c_uint ()
225233 _al .GenBuffers (1 , ctypes .byref (x ))
0 commit comments