import os.path
from .lock import Lock
-from . import gain
+from . import Config, gain
file_lock = Lock("file")
try:
print("Loading « {} »".format(self.name))
db_gain = gain(self.volume_factor * 100)
- self.audio_segment = pydub.AudioSegment.from_file(self.filename).set_frame_rate(44100).set_channels(2).set_sample_width(2).apply_gain(db_gain)
+ self.audio_segment = pydub.AudioSegment.from_file(self.filename).set_frame_rate(Config.frame_rate).set_channels(Config.channels).set_sample_width(Config.sample_width).apply_gain(db_gain)
self.audio_segment_frame_width = self.audio_segment.frame_width
self.sound_duration = self.audio_segment.duration_seconds
except Exception as e:
data += new_data
nb_frames += new_nb_frames
elif nb_frames == 0:
+ # FIXME: too slow
threading.Thread(name = "MSFinishedCallback", target=self.finished_callback).start()
return data.ljust(out_data_length, b'\0')