示例#1
0
	def draw(self):
		# global BackgroundThread
		# if BackgroundThread == None:
		# 	BackgroundThread = Background()
		# 	BackgroundThread.start()

		global MidiStarted
		if not MidiStarted:
			MidiStarted = True
			Midi.startup()
			m = MidiPypmHardware()
			outname = "loopMIDI Port 1"
			# Open MIDI output named
			try:
				# if outname is None, it opens default output
				self.o = m.get_output(outname)
				self.o.open()
			except:
				print "Error opening output: %s, exception: %s" % (outname,format_exc())
				# Midi.shutdown()
				# sys.exit(1)

			self.quicknote()

		return ""

		# plugins (classes that extend Processor) should define this
		# debug("draw in Processor!")
		while True:
			e = next_event()
			if e == None:
				break
			debug("Processor.draw2 type="+e["type"]+" region="+e["region"])
		return ""
示例#2
0
	def run(self):
		debug("Background run start")
		while True:
			e = next_event()
			if e != None:
				if e["type"] != "CursorDrag":
					debug("Background event type="+e["type"]+" region="+e["region"])
				dt = 0.001
			else:
				dt = 0.01
示例#3
0
文件: two.py 项目: nosuchtim/MMTT1
    def __init__(self):
        Processor.__init__(self, passthru=True)

        debug("TwoProcessor.__init__")
示例#4
0
import time
import mmtt.util
import mmtt.builtin
import nosuch.midiutil
from mmtt.builtin import debug
from nosuch.midiutil import Midi

# a = mmtt.util.getprocessor("Default","../")
a = mmtt.util.getprocessor("Text")
debug("before a.draw 1")
a.draw()
debug("before a.draw 2")
a.draw()
time.sleep(4.0)
Midi.shutdown()
time.sleep(1.0)
示例#5
0
	def __init__(self,passthru=True):
		debug("Processor.__init__ time=%f" % (time.time()) )
示例#6
0
	def __init__(self):
		Thread.__init__(self)
		debug("Background __init__")
示例#7
0
	def draw(self):
		debug("draw in DefaultProcessor!")
		return "foo2"
示例#8
0
文件: one.py 项目: nosuchtim/MMTT1
 def __init__(self):
     debug("OneProcessor.__init__")
     Processor.__init__(self, passthru=True)
示例#9
0
def getprocessor(bname):
	debug("getprocessor in python begins")
	blower = bname.lower()
	bpath = "mmtt.processor."+blower
	if bname == "Default":
		bclassname = "Processor"
	else:
		bclassname = bname + "Processor"
	debug("getprocessor - bname="+bname+" bpath="+bpath)
	try:
		recompile(bpath)
	except:
		debug("getprocessor - unable to recompile: "+bpath+" exception: "+format_exc())
		return None

	try:
		__import__(bpath)
	except:
		debug("getprocessor - unable to import: "+bpath+" exception: "+format_exc())
		return None

	try:
		processormod = getattr(mmtt.processor,blower)
	except:
		debug("getprocessor - no attribute on processor named: "+blower+" exception: "+format_exc())
		return None

	try:
		processorclass = getattr(processormod,bclassname)
	except:
		debug("getprocessor - module "+bpath+" didn't contain a class "+bclassname+" exception: "+format_exc())
		return None
	try:
		bobj = processorclass()
	except:
		debug("getprocessor - unable to instantiate object for module: "+bpath+" class: "+bclassname+" exception: "+format_exc())
		return None
	return bobj