- Fixed bug in getfillable()

- Added setcallback() method to set a user-callback
This commit is contained in:
Jack Jansen 1996-01-09 17:15:57 +00:00
parent 6259af9bbb
commit 195e33efa2
1 changed files with 8 additions and 1 deletions

View File

@ -9,9 +9,11 @@ def __init__(self):
self._sampwidth = 1
self._nchannels = 1
self._gc = []
self._usercallback = None
def __del__(self):
self.stop()
self._usercallback = None
def wait(self):
import time
@ -75,6 +77,11 @@ def writeframes(self, data):
def _callback(self, *args):
del self._gc[0]
if self._usercallback:
self._usercallback()
def setcallback(self, callback):
self._usercallback = callback
def getfilled(self):
filled = 0
@ -83,7 +90,7 @@ def getfilled(self):
return filled / self._nchannels / self._sampwidth
def getfillable(self):
return self._qsize - self.getfilled()
return (self._qsize / self._nchannels / self._sampwidth) - self.getfilled()
def ulaw2lin(self, data):
import audioop