def setup(self): with lltype.scoped_alloc(snd.seq_tp) as ptr: rv = snd.seq_open(ptr, "default", snd.SEQ_OPEN_INPUT, snd.SEQ_NONBLOCK) if rv: print "Couldn't open sequencer:", snd.strerror(rv) return False self.seq = ptr[0] rv = snd.seq_set_client_name(self.seq, "Dioxide") if rv: print "Couldn't set client name:", snd.strerror(rv) return False rv = snd.seq_create_simple_port(self.seq, "Dioxide", snd.SEQ_PORT_CAP_WRITE | snd.SEQ_PORT_CAP_SUBS_WRITE, snd.SEQ_PORT_TYPE_MIDI_GENERIC) if rv < 0: print "Couldn't open port:", snd.strerror(rv) return False self.port = rv print "Created sequencer port %d" % self.port return True