diff options
author | MaZderMind <git@mazdermind.de> | 2015-08-04 23:15:12 +0200 |
---|---|---|
committer | MaZderMind <git@mazdermind.de> | 2015-08-04 23:15:12 +0200 |
commit | 34b3d802babc3818f77057c8cd7665e58fe16bfd (patch) | |
tree | cfa221712cb6d614959af6c93714b0b74bcd4bc6 /voctogui/lib/audioleveldisplay.py | |
parent | 74c0cf9f94ff4ab2a0490eb1819175d3daf0793c (diff) |
start the great refactoring
Diffstat (limited to 'voctogui/lib/audioleveldisplay.py')
-rw-r--r-- | voctogui/lib/audioleveldisplay.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/voctogui/lib/audioleveldisplay.py b/voctogui/lib/audioleveldisplay.py new file mode 100644 index 0000000..8b9bf7e --- /dev/null +++ b/voctogui/lib/audioleveldisplay.py @@ -0,0 +1,25 @@ +import logging +from gi.repository import Gst, Gtk + +class AudioLevelDisplay: + """ Displays a Level-Meter of another VideoDisplay into a GtkWidget """ + + def __init__(self, drawing_area): + self.log = logging.getLogger('AudioLevelDisplay[%s]' % drawing_area.get_name()) + + self.drawing_area = drawing_area + + self.levelrms = [0, 0] # Initialize to [] + self.drawing_area.connect('draw', self.on_draw) + + + def on_draw(self, widget, cr): + cr.set_source_rgb(1, 1, 1) + cr.set_line_width(10) + + cr.move_to(15, 0) + cr.line_to(15, self.levelrms[0]*-20) # Work with 0+ Channels + cr.stroke() + + def level_callback(self, peaks, rms): + self.levelrms = rms |