diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1996-01-09 17:15:57 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1996-01-09 17:15:57 (GMT) |
commit | 195e33efa29db8eb4c5350572b5c92394db0c4a0 (patch) | |
tree | bd1d88ae0fc13ac3c143f113c42ae17ad3baa7aa /Mac/Lib | |
parent | 6259af9bbbb0968abce4b91b966139fb7b3d386e (diff) | |
download | cpython-195e33efa29db8eb4c5350572b5c92394db0c4a0.zip cpython-195e33efa29db8eb4c5350572b5c92394db0c4a0.tar.gz cpython-195e33efa29db8eb4c5350572b5c92394db0c4a0.tar.bz2 |
- Fixed bug in getfillable()
- Added setcallback() method to set a user-callback
Diffstat (limited to 'Mac/Lib')
-rw-r--r-- | Mac/Lib/Audio_mac.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Mac/Lib/Audio_mac.py b/Mac/Lib/Audio_mac.py index fef7d6e..d64bf4d 100644 --- a/Mac/Lib/Audio_mac.py +++ b/Mac/Lib/Audio_mac.py @@ -9,9 +9,11 @@ class Play_Audio_mac: 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 @@ class Play_Audio_mac: 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 @@ class Play_Audio_mac: 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 |