From 7997f23f9cc82029860c244ac1db31b26269edb2 Mon Sep 17 00:00:00 2001 From: Jose Manuel Delicado Date: Wed, 19 Jul 2017 15:23:34 +0200 Subject: [PATCH] Revert "Fixed sound.py when there are multiple sessions trying to load the library" This reverts commit 80f2e8f984d5ca83862b77decde464b4f0d4ad65. --- src/sound.py | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/src/sound.py b/src/sound.py index 8a96be44..f6f771b5 100644 --- a/src/sound.py +++ b/src/sound.py @@ -22,8 +22,6 @@ import tempfile import glob URLPlayer = None -is_created = False - def setup(): global URLPlayer if not URLPlayer: @@ -60,26 +58,23 @@ class soundSystem(object): def __init__(self, soundConfig): """ Sound Player.""" - global is_created self.config = soundConfig # Set the output and input default devices. - if is_created == False: - try: - self.output = Output() - self.input = Input() - except IOError: - pass + try: + self.output = Output() + self.input = Input() + except IOError: + pass # Try to use the selected device from the configuration. It can fail if the machine does not has a mic. - if is_created == False: - try: - log.debug("Setting input and output devices...") - self.output.set_device(self.output.find_device_by_name(self.config["output_device"])) - self.input.set_device(self.input.find_device_by_name(self.config["input_device"])) - except: - log.exception("Error in input or output devices, using defaults...") - self.config["output_device"] = "Default" - self.config["input_device"] = "Default" - is_created = True + try: + log.debug("Setting input and output devices...") + self.output.set_device(self.output.find_device_by_name(self.config["output_device"])) + self.input.set_device(self.input.find_device_by_name(self.config["input_device"])) + except: + log.exception("Error in input or output devices, using defaults...") + self.config["output_device"] = "Default" + self.config["input_device"] = "Default" + self.files = [] self.cleaner = RepeatingTimer(60, self.clear_list) self.cleaner.start()