def stop(self): self.run = False # next midi msg makes virus produce some midi msgs, causing threadfunc # to return from pyrawmidi.read() and terminate pyrawmidi.write([0xf0,0,0x20,0x33,0x01,0x10,0x73,0,0,0,0xf7]) # wait for thread to terminate while self.running: time.sleep(.1)
def stop(self): self.run = False # next midi msg is echoed back from the virus, causing threadfunc # to return from pyrawmidi.read() and terminate # pyrawmidi.write([0xf0,0,0x20,0x33,0x01,0x10,0x73,0x40,0x10,0x01,0xf7]) # request single dump to cause threadfunc to terminate pyrawmidi.write([0xf0,0,0x20,0x33,0x01,0x10,0x30,0,0x40,0xf7]) # wait for thread to terminate while self.running: time.sleep(.1)
def writeCtrl(self, ctrlid, value): page, number = ctrlid if page==CTRL_A: msg = [0xB0, number, value] else: if page==CTRL_B: msg = [0x71, 0x40, number, value] elif page==CTRL_6E: msg = [0x6E, 0x40, number, value] elif page==CTRL_6F: msg = [0x6F, 0x40, number, value] msg = makeSysEx(msg) # printcmd(msg) pyrawmidi.write(msg)
def finddumpind(self): val = self.ctrldef.range[0] pos = None for i in range(4): pyrawmidi.write(self.ctrldef.makemsg(val)) self.reqsingledump() while self.dump==None: time.sleep(.1) pos = findindeces(self.dump, val, pos) print "%d: %s" % (i,pos) if len(pos)==1: print "found dump index: ", pos[0] self.ctrldef.dumpind = pos[0] return elif len(pos)==0: break val += 1 if val>self.ctrldef.range[1]: break print "dump index not found"
def stop(self): if self.threadid: self.threadid = 0 self.terminated = False # next midi msg makes virus produce some midi msgs, # causing threadfunc # to return from pyrawmidi.read() and terminate try: pyrawmidi.write([0xf0,0,0x20,0x33,0x01,0x10,0x73,0,0,0,0xf7]) except IOError: pass # wait for thread to terminate for i in range(8): if self.terminated: break time.sleep(.1) pyrawmidi.close()
def reqsingledump(self): self.dump = None pyrawmidi.write([0xF0, 0, 0x20, 0x33, 0x01, 0x10, 0x30, 0, 0x40, 0xF7])
def on_slider(self, evt): self.text.SetLabel(str(self.slider.GetValue())) pyrawmidi.write([0xB0,0x11,self.slider.GetValue()])
def sendsingleedit(self, dump): singledump = [0x10, 0, 0x40] singledump.extend(dump) pyrawmidi.write(makeSysEx(singledump))
def reqbankdump(self, bank): msg = makeSysEx([0x32,bank]) pyrawmidi.write(msg)
def reqsingledump(self, banknr=0, prognr=0x40): msg = makeSysEx([0x30, banknr, prognr]) pyrawmidi.write(msg)