Skip to content

Commit

Permalink
Added plugin to set error state if audio is low teltek#495
Browse files Browse the repository at this point in the history
  • Loading branch information
dpeite authored and smarquard committed Feb 4, 2019
1 parent 519f9fb commit 4faa493
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
7 changes: 7 additions & 0 deletions conf-dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ appearance = False
checkrepo = False
cleanstale = False
failovermic = False
lowaudio = False
forcedurationrec = False
hidetabs = False
keyboard = False
Expand Down Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion galicaster/classui/recorderui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'):
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions galicaster/core/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,) )
Expand Down

0 comments on commit 4faa493

Please sign in to comment.