diff --git a/conf-dist.ini b/conf-dist.ini index 035f6e45..0d2847ba 100644 --- a/conf-dist.ini +++ b/conf-dist.ini @@ -120,6 +120,7 @@ appearance = False checkrepo = False cleanstale = False failovermic = False +lowaudio = False forcedurationrec = False hidetabs = False keyboard = False @@ -154,6 +155,12 @@ device = default failover_threshold = -50 audio_device = 1 +; 'lowaudio_threshold' is the threshold rms amplitude at which the audio will be considered low +; 'timeout' time in seconds to launch the error message +[lowaudio] +lowaudio_threshold = -45 +timeout = 120 + ; Duration in minutes [forcedurationrec] duration = 240 diff --git a/galicaster/classui/recorderui.py b/galicaster/classui/recorderui.py index 858ee2a9..f2307f6a 100644 --- a/galicaster/classui/recorderui.py +++ b/galicaster/classui/recorderui.py @@ -111,6 +111,8 @@ def __init__(self, package=None): self.vumeterL = builder.get_object("progressbarL") self.vumeterR = builder.get_object("progressbarR") self.label_channels= builder.get_object("label_channels") + self.low_audio = False + self.lowaudio_threshold = self.conf.get_float('lowaudio','lowaudio_threshold') # SWAP if not self.conf.get_boolean('basic', 'swapvideos'): @@ -186,13 +188,18 @@ def scale_data(self,data, data2): average = (data + data2)/2.0 if not self.mute: + if self.lowaudio_threshold and average < (self.lowaudio_threshold): + self.dispatcher.emit("low-audio") + self.low_audio = True if average < (self.thresholdVum): self.dispatcher.emit("audio-mute") self.mute = True if self.mute and average > (self.thresholdVum + 5.0): self.dispatcher.emit("audio-recovered") self.mute = False - + if self.low_audio and self.lowaudio_threshold and average > (self.lowaudio_threshold + 5.0): + self.dispatcher.emit("low-audio-recovered") + self.low_audio = False if data < -self.rangeVum: valor = 1 diff --git a/galicaster/core/dispatcher.py b/galicaster/core/dispatcher.py index b7a164c9..50fdebcf 100644 --- a/galicaster/core/dispatcher.py +++ b/galicaster/core/dispatcher.py @@ -83,6 +83,9 @@ def is_signal(self, name): GObject.signal_new('audio-recovered', Dispatcher, GObject.SignalFlags.RUN_LAST, None, () ) GObject.signal_new('action-audio-enable-msg', Dispatcher, GObject.SignalFlags.RUN_LAST, None, () ) GObject.signal_new('action-audio-disable-msg', Dispatcher, GObject.SignalFlags.RUN_LAST, None, () ) +GObject.signal_new('low-audio', Dispatcher, GObject.SignalFlags.RUN_LAST, None, () ) +GObject.signal_new('low-audio-recovered', Dispatcher, GObject.SignalFlags.RUN_LAST, None, () ) + #PLAYER GObject.signal_new('player-vumeter', Dispatcher, GObject.SignalFlags.RUN_LAST, None, (GObject.TYPE_PYOBJECT,GObject.TYPE_PYOBJECT,GObject.TYPE_PYOBJECT,) ) GObject.signal_new('player-status', Dispatcher, GObject.SignalFlags.RUN_LAST, None, (GObject.TYPE_PYOBJECT,) )