aboutsummaryrefslogtreecommitdiff
path: root/voctogui/lib/audioleveldisplay.py
blob: bc2a38f5f5aca8575f2e34d727f6a26b3a9d60a8 (plain)
  1. import logging
  2. from gi.repository import Gst, Gtk
  3. class AudioLevelDisplay(object):
  4. """ Displays a Level-Meter of another VideoDisplay into a GtkWidget """
  5. def __init__(self, drawing_area):
  6. self.log = logging.getLogger('AudioLevelDisplay[%s]' % drawing_area.get_name())
  7. self.drawing_area = drawing_area
  8. self.levelrms = [0, 0] # Initialize to []
  9. self.drawing_area.connect('draw', self.on_draw)
  10. def on_draw(self, widget, cr):
  11. cr.set_source_rgb(1, 1, 1)
  12. cr.set_line_width(10)
  13. cr.move_to(15, 0)
  14. cr.line_to(15, self.levelrms[0]*-20) # Work with 0+ Channels
  15. cr.stroke()
  16. def level_callback(self, peaks, rms):
  17. self.levelrms = rms