コード例 #1
0
ファイル: default.py プロジェクト: nosuchtim/MMTT1
	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
ファイル: default.py プロジェクト: nosuchtim/MMTT1
	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
ファイル: testit2.py プロジェクト: nosuchtim/MMTT1
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
ファイル: default.py プロジェクト: nosuchtim/MMTT1
	def __init__(self,passthru=True):
		debug("Processor.__init__ time=%f" % (time.time()) )
コード例 #6
0
ファイル: default.py プロジェクト: nosuchtim/MMTT1
	def __init__(self):
		Thread.__init__(self)
		debug("Background __init__")
コード例 #7
0
ファイル: default.py プロジェクト: nosuchtim/MMTT1
	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
ファイル: getprocessor.py プロジェクト: nosuchtim/MMTT1
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