def configure(self, params): if "plot_type" in params and self.xyplot is None: if params["plot_type"] == "scatter": self.xyplot = ScatterPlot(self, self.INIT_WIDTH, self.INIT_HEIGHT) elif params["plot_type"] == "scope": self.xyplot = ScopePlot(self, self.INIT_WIDTH, self.INIT_HEIGHT, MFPApp().samplerate) self.xyplot.draw_complete_cb = self.draw_complete_cb if self.xyplot: self.add_actor(self.xyplot) self.xyplot.set_position(3, self.LABEL_SPACE) if self.obj_args is None: self.label.set_text("%s" % (self.obj_type,)) else: self.label.set_text("%s %s" % (self.obj_type, self.obj_args)) x_min = params.get('x_min', self.x_min) x_max = params.get('x_max', self.x_max) y_min = params.get('y_min', self.y_min) y_max = params.get('y_max', self.y_max) self.set_bounds(x_min, y_min, x_max, y_max) if self.xyplot is not None: self.xyplot.configure(params) PatchElement.configure(self, params)
def setup(): MFPApp().setup()
def teardown(): MFPApp().finish() print "test-dsp.py: MFPApp finish done"
from unittest import TestCase from mfp.mfp_app import MFPApp from mfp.patch import Patch def setup(): MFPApp().setup() def mkproc(case, init_type, init_args=None): return MFPApp().create(init_type, init_args, case.patch, None, init_type) class DSPObjectTests (TestCase): def setUp(self): self.patch = Patch('default', '', None, None, 'default') def tearDown(self): import time time.sleep(0.500) def test_create(self): '''test_create: [dsp] can make a DSP object''' o = mkproc(self, "osc~", "500") def test_read(self): '''test_read: [dsp] can read back a creation parameter''' o = mkproc(self, "osc~", "500") print "test_read: objid = ", o, o.dsp_obj f = o.dsp_obj.getparam("_sig_1")
def teardown(): MFPApp().finish()
def setup(): MFPApp().no_gui = True builtins.register()
from mfp.processor import Processor from mfp.mfp_app import MFPApp class Extension1(Processor): def __init__(self, init_type, init_args, patch, scope, name): Processor.__init__(self, 1, 0, init_type, init_args, patch, scope, name) self.dsp_inlets = [0] self.dsp_outlets = [0] self.dsp_init("ext1~") def trigger(self): pass MFPApp().register("ext1~", Extension1)