Beispiel #1
0
def main(args):
	index = args.source
	impulse.setSourceIndex( index )

	peak_heights = [ 0 for i in range( 32 ) ]
	if curses:
		try:
			stdscr = curses.initscr()
			curses.noecho()
			curses.cbreak()
			curses.curs_set(0)
			stdscr.keypad(1)
			stdscr.nodelay(1) # make getch non-blocking

			draw_mode = ('horizontal','left','top') # default mode for draw_curses
			while True:
				calc_heights(peak_heights,args.size)

				draw_mode = get_mode_curses(stdscr,draw_mode)

				draw_curses(stdscr,peak_heights,draw_mode)
				curses.napms(int(args.sleep*1000))

		finally:
			curses.nocbreak(); stdscr.keypad(0); curses.echo()
			curses.curs_set(1)
			curses.endwin()
	else:
		while True:
			calc_heights(peak_heights,args.size)
			draw_cli(peak_heights)
			sleep(args.sleep)
                    help="Sleep before cube refresh")
parser.add_argument(
    "-f",
    "--factor",
    default=10,
    type=float,
    help="Multiply audio volumes coming form pulse audio by this factor")
parser.add_argument("-s",
                    "--source",
                    default=0,
                    type=int,
                    help="Pulse audio source to process")

args = parser.parse_args()

impulse.setSourceIndex(args.source)

context = pyudev.Context()
monitor = pyudev.Monitor.from_netlink(context)
monitor.filter_by('tty')
observer = pyudev.MonitorObserver(monitor, callback)
observer.start()

# and get the already connected ones
for dev in context.list_devices(subsystem="tty"):
    callback("already_connected", dev)

# main loop
to_be_removed = []
peak_heights = [0 for i in range(6)]
prev_leds = set()
Beispiel #3
0
 def set_audio_source(self, *args, **kwargs):
     impulse.setSourceIndex(self.audio_source_index)
Beispiel #4
0
 def set_audio_source( self, *args, **kwargs ):
     impulse.setSourceIndex( self.audio_source_index )
	def setAudioSource( self, source, *args, **kwargs ):
		impulse.setSourceIndex( source )
Beispiel #6
0
        # the Cube object from CUBES
        if action == "add" or action == "already_connected":
            CUBES.add( Cube(device.device_node) )

parser = argparse.ArgumentParser(description="Visualize audio from pulse-audio on Futuro Cube connected via USB")

parser.add_argument("-t", "--time-refresh", default=0.05, 
                    type=float, help="Sleep before cube refresh")
parser.add_argument("-f", "--factor", default=10,
                    type=float, help="Multiply audio volumes coming form pulse audio by this factor")
parser.add_argument("-s", "--source", default=0,
                    type=int, help="Pulse audio source to process")

args = parser.parse_args()

impulse.setSourceIndex( args.source )

context = pyudev.Context()
monitor = pyudev.Monitor.from_netlink(context)
monitor.filter_by('tty')
observer = pyudev.MonitorObserver(monitor, callback)
observer.start()

# and get the already connected ones
for dev in context.list_devices(subsystem="tty"):
    callback("already_connected",dev)

# main loop
to_be_removed = []
peak_heights = [ 0 for i in range( 6 ) ]
prev_leds = set()