Ejemplo n.º 1
0
def main(mode):
    print "PERF=%d PROG=%d PROFILE=%d BASE_NOTE=%s BASE_NOTE_NUM=%d" % (not prog_mode, prog_mode, prof_mode, base_note, base_note_num)
    h = cm.open()
    A = {"accX" : 32768,
         "accY" : 32768,
         "accZ" : 32768}
    Ai = {"accX" : 0,
          "accY" : 1,
          "accZ" : 2}

    for e in ps3events():
        if ps3_spy:
            print e

        if e[0] == 'select' and (not e[1][0] and e[2][0]):
            mode = mode_mappers.keys()[(modes.index(mode) + 1) % len(modes)]
            print "Mode changed to:", mode

        (mes, A) = mode_mappers[mode](e, A, base_note_num=base_note_num)
        if acc_spy and e[0].startswith('acc'):
            print '%d:%d' % (Ai[e[0]], A[e[0]])
        if mes:
            cm.midi_send(h, mes)
Ejemplo n.º 2
0
#!/usr/bin/env python

from ps3events import ps3events
import sys

from time import sleep

diag = False
quiet = False # suppress (high volume) analog and accel. data, which is useful sometimes

for p in sys.argv[1:]:
    if p == '-d':
        diag = True
    elif p == '-q':
        quiet = True

freq = 2 if diag else 1000

for e in ps3events(freq=freq, diag=diag):
    fname = e[0]
    if quiet and (fname.startswith('acc') or fname.find("analog") != -1):
        continue
    print e