def __init__(self, addr=None, channel=1): self.ctrl_param = 98 self.channel = channel - 1 alsaseq.client('Aeolus-OSC', 0, 1, True) alsaseq.start() self.src = (alsaseq.id(), 0) log.info('I am %s:%s' % (str(self.src[0]), str(self.src[1]))) self.update_connection(addr) # from help(alsaseq): # # ALSA events are returned as a tuple with 8 elements: # (type, flags, tag, queue, time stamp, source, destination, data) # # Some elements are also tuples: # time = (seconds, nanoseconds) # source, destination = (client, port) # data = ( varies depending on type ) # # See DATA section below for event type constants. # # This API is nuts. # TODO should send events to subscribed ports not directly to aeolus self.presets = None
def drums(ritmo, tempo, compases): "Output one measure to queue." global incoming tiempoms = alsamidi.tuple2time(alsaseq.status()[1]) * 1000 t = pista.construye(ritmo, tempo, compases, tiempoms) final = alsamidi.time2tuple(pista.duracion(ritmo, tempo, compases, tiempoms) / 1000.0) t.append((alsaseq.SND_SEQ_EVENT_ECHO, 1, 0, 0, final, (0, 0), (alsaseq.id(), 0), (1, 2, 3, 4, 5))) for evento in t: alsaseq.output(evento) incoming.append(evento) # record it
def drums(ritmo, tempo, compases): 'Output one measure to queue.' global incoming tiempoms = alsamidi.tuple2time(alsaseq.status()[1]) * 1000 t = pista.construye(ritmo, tempo, compases, tiempoms) final = alsamidi.time2tuple( pista.duracion(ritmo, tempo, compases, tiempoms) / 1000.) t.append((alsaseq.SND_SEQ_EVENT_ECHO, 1, 0, 0, final, (0, 0), (alsaseq.id(), 0), (1, 2, 3, 4, 5))) for evento in t: alsaseq.output(evento) incoming.append(evento) # record it