stream: move defaults to class variables

This commit is contained in:
Roman Zeyde
2014-12-31 14:04:38 +02:00
parent bb6e262b57
commit 72ee5147f4
2 changed files with 6 additions and 6 deletions

View File

@@ -64,7 +64,7 @@ def main(config, src, dst, pylab=None):
training_duration = sender.offset
log.info('Sending %.3f seconds of training audio', training_duration / Fs)
reader = stream.Reader(src, bufsize=(64 << 10), eof=True)
reader = stream.Reader(src, eof=True)
data = itertools.chain.from_iterable(reader)
bits = framing.encode(data)
log.info('Starting modulation')

View File

@@ -3,14 +3,14 @@ import time
class Reader(object):
def __init__(self, fd, data_type=None, bufsize=4096,
eof=False, timeout=2.0, wait=0.2):
wait = 0.2
timeout = 2.0
bufsize = 4096
def __init__(self, fd, data_type=None, eof=False):
self.fd = fd
self.data_type = data_type if (data_type is not None) else lambda x: x
self.bufsize = bufsize
self.eof = eof
self.timeout = timeout
self.wait = wait
self.total = 0
def __iter__(self):