示例#1
0
文件: vxcmidi.py 项目: cwyss/vxc
 def start(self, devname="hw:1,0,1", filter=0):
     try:
         pyrawmidi.open(devname)
         pyrawmidi.setfilter(filter, 0)
         self.threadid = thread.start_new_thread(self.threadfunc, ())
     except (IOError, MemoryError):
         pyrawmidi.close()
         raise
示例#2
0
文件: wxtest.py 项目: cwyss/vxc
def runmain():
    pyrawmidi.close()
    pyrawmidi.open("hw:1,0,1")
    pyrawmidi.setfilter(0,0)

    app = wx.PySimpleApp()
    frame = MainFrame()
    midiinthread = MidiInThread(frame)

    app.MainLoop()

    sys.stdout.write("terminating midi thread...")
    sys.stdout.flush()
    midiinthread.stop()
    sys.stdout.write("\n")

    pyrawmidi.close()
示例#3
0
文件: viruscontrol.py 项目: cwyss/vxc
import pyrawmidi, thread


def printcmd(cmd):
    for b in cmd:
        print "%02X " % b,
    print


def midiinthread():
    while 1:
        cmd = pyrawmidi.read()
        printcmd(cmd)


pyrawmidi.open("hw:1,0,1")

thread.start_new_thread(midiinthread, ())

while 1:
    s = raw_input()
    if s == "q":
        break
    elif s.startswith("f"):
        f = s.split()
        pyrawmidi.setfilter(int(f[1]), int(f[2]))

pyrawmidi.close()
pyrawmidi.wait()
pyrawmidi.wait()
示例#4
0
文件: ctrllearn.py 项目: cwyss/vxc
 def openmidi(self):
     pyrawmidi.open("hw:1,0,1")
     pyrawmidi.setfilter(0,0)
     return MidiInThread()