def __init__(self, c):
""" Initializer
:param c: configuration dictionary
"""
config = c[DATA_SOURCE]
self.left_channel = Queue(maxsize=1)
self.right_channel = Queue(maxsize=1)
self.mono_channel = Queue(maxsize=1)
self.mono_algorithm = config[MONO_ALGORITHM]
self.stereo_algorithm = config[STEREO_ALGORITHM]
self.ds_type = config[TYPE]
self.const = config[VOLUME_CONSTANT]
self.bits = 16
self.pipe_name = config[PIPE_NAME]
self.min = config[VOLUME_MIN]
self.max = config[VOLUME_MAX]
self.v = 0
self.step = config[STEP]
self.pipe_size = config[PIPE_SIZE]
self.rng = list(range(int(self.min), int(self.max)))
self.double_rng = self.rng
self.double_rng.extend(range(int(self.max) - 1, int(self.min), -1))
self.pipe = None
if self.ds_type == SOURCE_PIPE:
try:
self.pipe = os.open(self.pipe_name, os.O_RDONLY)
except:
logging.debug("cannot open pipe")
self.k = int(math.pow(2, self.bits)//2 - 1)
self.previous_left = self.previous_right = self.previous_mono = 0.0
self.run_flag = True
self.polling_interval = config[POLLING_INTERVAL]
self.prev_time = None
评论列表
文章目录