def __init__(self, address, ordinal): agent.Agent.__init__(self, signature=version, names='labeler', ordinal=ordinal) self.domain = piw.clockdomain_ctl() self[1] = atom.Atom( domain=domain.Aniso(hints=(logic.make_term('continuous'), )), names='controller output', policy=atom.readonly_policy()) self[2] = atom.Atom(domain=domain.String(), init='Label', names='label category', policy=atom.default_policy(self.__set_category)) self[3] = atom.Atom(domain=domain.String(), init='', names='label', policy=atom.default_policy(self.__set_label)) self.ctl_functor = piw.functor_backend(1, True) self.ctl_input = bundles.VectorInput(self.ctl_functor.cookie(), self.domain, signals=(1, )) self[4] = atom.Atom(domain=domain.Aniso(), policy=self.ctl_input.vector_policy(1, False), names='controller input') self.ctl_functor.set_functor( piw.pathnull(0), utils.make_change_nb( piw.slowchange(utils.changify(self.__controller_input)))) self.__ctl = []
def __init__(self, cdomain, policy=None, functor=None): self.__policy = policy or ThrottleStreamPolicy(10) f = functor or piw.slowchange(utils.changify(self.__dump)) self.__backend = piw.functor_backend(1, False) self.__backend.set_gfunctor(utils.make_change_nb(f)) self.__correlator = piw.correlator(cdomain, chr(1), piw.null_filter(), self.__backend.cookie(), 0, 0)
def __init__(self, address, ordinal): agent.Agent.__init__(self, signature=version, names='illuminator', ordinal=ordinal) self.domain = piw.clockdomain_ctl() self[7] = bundles.Output(1, False, names='server status output') self.server_status_output = bundles.Splitter(self.domain, self[7]) self.server_lights = piw.lightsource(piw.change_nb(), 0, self.server_status_output.cookie()) self.server_lights.set_size(1) self[1] = bundles.Output(1, False, names='light output',protocols='revconnect') self.output = bundles.Splitter(self.domain, self[1]) self.status_buffer = piw.statusbuffer(self.output.cookie()) self.status_buffer.autosend(False) self[2] = atom.Atom(domain=domain.String(), init='[]', names='physical light mapping', policy=atom.default_policy(self.__physical_light_map)) self[3] = atom.Atom(domain=domain.String(), init='[]', names='musical light mapping', policy=atom.default_policy(self.__musical_light_map)) self[5] = atom.Atom(domain=domain.BoundedIntOrNull(0,65535,0), names='server port', policy=atom.default_policy(self.__server_port)) self[6] = atom.Atom(domain=domain.Bool(), init=False, names='server start', policy=atom.default_policy(self.__server_start)) self.keyfunctor = piw.functor_backend(1, False) self.keyinput = bundles.VectorInput(self.keyfunctor.cookie(), self.domain, signals=(1,)) self[4] = atom.Atom(domain=domain.Aniso(), policy=self.keyinput.vector_policy(1,False), names='key input') self.choicefunctor = utils.make_change_nb(piw.slowchange(utils.changify(self.__choice))) self[8] = StoredLightMaps(self) self.add_verb2(1,'clear([],None)', callback=self.__clear) self.add_verb2(2,'clear([],None,role(None,[matches([physical])]))', callback=self.__clear_physical) self.add_verb2(3,'clear([],None,role(None,[matches([musical])]))', callback=self.__clear_musical) self.add_verb2(4,'set([],None,role(None,[coord(physical,[column],[row])]),role(to,[abstract,matches([red])]))', callback=self.__set_physical) self.add_verb2(5,'set([],None,role(None,[coord(physical,[column],[row])]),role(to,[abstract,matches([green])]))', callback=self.__set_physical) self.add_verb2(6,'set([],None,role(None,[coord(physical,[column],[row])]),role(to,[abstract,matches([orange])]))', callback=self.__set_physical) self.add_verb2(7,'set([],None,role(None,[coord(musical,[course],[key])]),role(to,[abstract,matches([red])]))', callback=self.__set_musical) self.add_verb2(8,'set([],None,role(None,[coord(musical,[course],[key])]),role(to,[abstract,matches([green])]))', callback=self.__set_musical) self.add_verb2(9,'set([],None,role(None,[coord(musical,[course],[key])]),role(to,[abstract,matches([orange])]))', callback=self.__set_musical) self.add_verb2(10,'set([un],None,role(None,[coord(physical,[column],[row])]))', callback=self.__unset_physical) self.add_verb2(11,'set([un],None,role(None,[coord(musical,[course],[key])]))', callback=self.__unset_musical) self.add_verb2(12,'choose([],None,role(None,[matches([physical])]),role(as,[abstract,matches([red])]))',self.__choose_physical) self.add_verb2(13,'choose([],None,role(None,[matches([physical])]),role(as,[abstract,matches([green])]))',self.__choose_physical) self.add_verb2(14,'choose([],None,role(None,[matches([physical])]),role(as,[abstract,matches([orange])]))',self.__choose_physical) self.add_verb2(15,'choose([],None,role(None,[matches([musical])]),role(as,[abstract,matches([red])]))',self.__choose_musical) self.add_verb2(16,'choose([],None,role(None,[matches([musical])]),role(as,[abstract,matches([green])]))',self.__choose_musical) self.add_verb2(17,'choose([],None,role(None,[matches([musical])]),role(as,[abstract,matches([orange])]))',self.__choose_musical) self.add_verb2(18,'choose([un],None)',self.__unchoose) self.add_verb2(19,'start([],None,role(None,[matches([server])]))',self.__start_server,status_action=self.__status_server) self.add_verb2(20,'stop([],None,role(None,[matches([server])]))',self.__stop_server,status_action=self.__status_server) self.add_verb2(21,'start([toggle],None,role(None,[matches([server])]))',self.__toggle_server,status_action=self.__status_server) self.add_verb2(22,'load([],None,role(None,[concrete,singular,partof(~(a)#8)]))', self.__load_lightmap) self.add_verb2(23,'delete([],None,role(None,[concrete,singular,partof(~(a)#8)]))', self.__delete_lightmap) self.add_verb2(24,'save([],None,role(None,[abstract]))', self.__save_lightmap) self.add_verb2(25,'save([],None)', self.__save_lightmap) self.httpServer = None self.__update_server_status()
def __init__(self,names,ordinal,dom,remove,keys): self.kbd_keys = keys agent.Agent.__init__(self,names=names,ordinal=ordinal,signature=version,subsystem='kbd',volatile=True,container=102,protocols='browse is_subsys') self.remover=remove self.domain = piw.clockdomain_ctl() self.domain.set_source(piw.makestring('*',0)) self[1] = bundles.Output(1,False,names='activation output') self[2] = bundles.Output(2,False,names='pressure output') self[3] = bundles.Output(3,False,names='roll output') self[4] = bundles.Output(4,False,names='yaw output') self[5] = bundles.Output(1,False,names='strip position output',ordinal=1) self[7] = bundles.Output(1,False,names='breath output') self[10] = bundles.Output(2,False,names='absolute strip output',ordinal=1) self[12] = bundles.Output(1,False,names='pedal output',ordinal=1) self[13] = bundles.Output(1,False,names='pedal output',ordinal=2) self[14] = bundles.Output(1,False,names='pedal output',ordinal=3) self[15] = bundles.Output(1,False,names='pedal output',ordinal=4) self.led_backend = piw.functor_backend(1,True) self.status_mixer = piw.statusmixer(self.led_backend.cookie()) self.led_input = bundles.VectorInput(self.status_mixer.cookie(),self.domain,signals=(1,)) self[8] = atom.Atom(names='light input',protocols='revconnect',policy=self.led_input.vector_policy(1,False,False,auto_slot=True),domain=domain.Aniso()) self[100] = VirtualKey(self.kbd_keys) self.koutput = bundles.Splitter(self.domain,self[1],self[2],self[3],self[4]) self.kpoly = piw.polyctl(10,self.koutput.cookie(),False,5) self.s1output = bundles.Splitter(self.domain,self[5],self[10]) self.boutput = bundles.Splitter(self.domain,self[7]) self.poutput1 = bundles.Splitter(self.domain,self[12]) self.poutput2 = bundles.Splitter(self.domain,self[13]) self.poutput3 = bundles.Splitter(self.domain,self[14]) self.poutput4 = bundles.Splitter(self.domain,self[15]) self.kclone=piw.sclone() self.kclone.set_filtered_output(1,self.kpoly.cookie(),piw.first_filter(1)) self.kclone.set_filtered_output(2,self.s1output.cookie(),piw.first_filter(2)) self.kclone.set_filtered_output(5,self.boutput.cookie(),piw.first_filter(5)) self.kclone.set_filtered_output(6,self.poutput1.cookie(),piw.first_filter(6)) self.kclone.set_filtered_output(7,self.poutput2.cookie(),piw.first_filter(7)) self.kclone.set_filtered_output(8,self.poutput3.cookie(),piw.first_filter(8)) self.kclone.set_filtered_output(9,self.poutput4.cookie(),piw.first_filter(9)) self[9] = atom.Atom(names='controller output',domain=domain.Aniso(),init=self.courses()) self.add_verb2(4,'maximise([],None,role(None,[mass([pedal])]))',self.__maximise) self.add_verb2(5,'minimise([],none,role(None,[mass([pedal])]))',self.__minimise) self.__timestamp = piw.tsd_time() self.update()
def create_plumber(self, init, address, filter, slot, clocked): if init: self.__backend = piw.functor_backend(1, True) self.__backend.set_functor( piw.pathnull(0), utils.make_change_nb( piw.slowchange(utils.changify(self.__slow_handler)))) self.__correlator = piw.correlator(self.__clock_domain, chr(1), piw.root_filter(), self.__backend.cookie(), 0, 0) return Plumber(self.__correlator, 1, slot, -1, Plumber.input_input, self.__stream_policy, address, filter, clocked, None)
def __init__(self,address,ordinal): self.domain = piw.clockdomain_ctl() vc = atom.VerbContainer(clock_domain=self.domain) self.finder = talker.TalkerFinder() agent.Agent.__init__(self,signature=version,names='arranger', protocols='bind', container=(9,'agent',vc), ordinal=ordinal) self[1] = self.verb_container() self.model = arranger_native.model(self.domain) self.light_output = bundles.Output(1,False,names='light output',protocols='revconnect') self.light_splitter = bundles.Splitter(self.domain, self.light_output) self.light_convertor = piw.lightconvertor(True,self.light_splitter.cookie()) self.view = arranger_native.view(self.model,self.light_convertor.cookie()) self.ctlr_fb = piw.functor_backend(1,True) self.ctlr_fb.set_functor(piw.pathnull(0),self.view.control()) self.ctlr_input = bundles.ScalarInput(self.ctlr_fb.cookie(),self.domain,signals=(1,)) self[2] = atom.Atom(domain=domain.Aniso(),policy=self.ctlr_input.policy(1,False),names='controller input') self.kinput = bundles.VectorInput(self.view.cookie(),self.domain,signals=(1,2,3,5)) self[3] = atom.Atom(names='key inputs') self[3][1] = atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.kinput.vector_policy(1,False),names='pressure input',protocols='nostage') self[3][2] = atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.kinput.merge_policy(2,False),names='roll input',protocols='nostage') self[3][3] = atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.kinput.merge_policy(3,False),names='yaw input',protocols='nostage') self[3][5] = atom.Atom(domain=domain.Aniso(), policy=self.kinput.vector_policy(5,False),names='key input') self[3][4] = self.light_output self.cinput = bundles.ScalarInput(self.model.cookie(),self.domain,signals=(1,2)) self.cinput.add_upstream(self.verb_container().clock) self[4] = atom.Atom(names='metronome inputs') self[4][1] = atom.Atom(domain=domain.Aniso(), policy=self.cinput.nodefault_policy(1,False),names='song beat input') self[4][2] = atom.Atom(domain=domain.Aniso(), policy=self.cinput.nodefault_policy(2,False),names='running input') self[5] = collection.Collection(creator=self.__createtarget,wrecker=self.__wrecktarget,names="row",inst_creator=self.__createtarget_inst,inst_wrecker=self.__wrecktarget_inst,protocols='hidden-connection explicit') self[7] = Parameters(self) self.__eventlist = EventList(self) self.__playstop = node.Server(change=self.__play_change) self.__playstop[1] = self.__eventlist self.set_private(self.__playstop) self.add_verb2(1,'play([],None)',create_action=self.__play,clock=True) self.add_verb2(2,'play([un],None)',create_action=self.__unplay,clock=True) self.add_verb2(3,'cancel([],None,role(None,[numeric]),option(called,[numeric]))',self.__cancel_verb) self.add_verb2(4,'clear([],None)',self.__clear_verb) self.add_verb2(5,'do([],None,role(None,[abstract]),role(when,[numeric]),option(called,[numeric]))', self.__do_verb) self.model.playstop_set(piw.make_change_nb(utils.slowchange(self.__play_set)))
def get_data_backend(self, config): if self.__correlator is None: self.__backend = piw.functor_backend(1, True) self.__backend.set_functor( piw.pathnull(0), utils.make_change_nb( piw.slowchange(utils.changify(self.__slow_handler)))) self.__correlator = piw.correlator(self.__clock_domain, chr(1), piw.root_filter(), self.__backend.cookie(), 0, 0) return PlumberBackend(self.__correlator, self.__stream_policy, 1, Plumber.input_input, -1, config.iid)
def get_data_backend(self, config): if self.__correlator is None: self.__backend = piw.functor_backend(1, True) self.__backend.set_functor(piw.pathnull(0), self.__handler) self.__backend.send_duplicates(True) self.__correlator = piw.correlator(self.__clock_domain, chr(1), piw.root_filter(), self.__backend.cookie(), 0, 0) if config.clocked: self.__set_clock(self.__backend.get_clock()) return PlumberBackend(self.__correlator, self.__stream_policy, 1, Plumber.input_input, -1, config.iid)
def get_data_backend(self, config): if self.__backend is None: self.__backend = piw.functor_backend(1, True) self.__backend.set_gfunctor(utils.make_change_nb(self.__handler)) self.__correlator = piw.correlator(self.__clock_domain, chr(1), piw.null_filter(), self.__backend.cookie(), 0, 0) if config.clocked: self.__set_clock(self.__backend.get_clock()) return PlumberBackend(self.__correlator, self.__stream_policy, 1, Plumber.input_input, -1, config.iid)
def create_plumber(self, init, address, filter, slot, clocked): if init: self.__backend = piw.functor_backend(1, True) self.__backend.set_functor(piw.pathnull_lck(0), self.__handler) self.__backend.send_duplicates(True) self.__correlator = piw.correlator(self.__clock_domain, chr(1), piw.root_filter(), self.__backend.cookie(), 0, 0) if clocked: self.__set_clock(self.__backend.get_clock()) return Plumber(self.__correlator, 1, slot, -1, Plumber.input_input, self.__stream_policy, address, filter, clocked, None)
def __init__(self, address, ordinal): agent.Agent.__init__(self, signature=version, names='tabulator', ordinal=ordinal) self.domain = piw.clockdomain_ctl() self[5] = bundles.Output(1, False, names='status output') self.status_output = bundles.Splitter(self.domain, self[5]) self.lights = piw.lightsource(piw.change_nb(), 0, self.status_output.cookie()) self.lights.set_size(1) self.cfunctor = piw.functor_backend(1, False) self.cinput = bundles.VectorInput(self.cfunctor.cookie(), self.domain, signals=(1,)) self[1] = atom.Atom(domain=domain.Aniso(), policy=self.cinput.vector_policy(1,False), names='controller input') self.cfunctor.set_gfunctor(utils.make_change_nb(piw.slowchange(utils.changify(self.__controller)))) self.keyfunctor = piw.functor_backend(1, False) self.keyinput = bundles.VectorInput(self.keyfunctor.cookie(), self.domain, signals=(1,)) self[2] = atom.Atom(domain=domain.Aniso(), policy=self.keyinput.vector_policy(1,False), names='key input') self.keyfunctor.set_gfunctor(utils.make_change_nb(piw.slowchange(utils.changify(self.__key)))) self[3] = atom.Atom(domain=domain.BoundedInt(1,100), init=DEFAULT_CHORD_TIMEOUT, policy=atom.default_policy(self.__set_chordtimeout), names='chord timeout') self[4] = atom.Atom(domain=domain.BoundedInt(80,200), init=DEFAULT_PAGE_WIDTH, policy=atom.default_policy(self.__set_pagewidth), names='page width') self[6] = atom.Atom(domain=domain.Bool(), init=False, names='start', policy=atom.default_policy(self.__change_start)) self.add_verb2(1,'start([],None)',self.__start,status_action=self.__status) self.add_verb2(2,'stop([],None)',self.__stop,status_action=self.__status) self.add_verb2(3,'start([toggle],None)',self.__toggle,status_action=self.__status) self.__set_chordtimeout(DEFAULT_CHORD_TIMEOUT) self.__set_pagewidth(DEFAULT_PAGE_WIDTH) self.__courselen = None self.__coursesqueue = None self.__coursesrender = None self.__lasttime = None self.__update_status()
def __init__(self,usbname,ordinal,dom,remove): agent.Agent.__init__(self,names='keyboard pico',ordinal=ordinal,signature=version,subsystem='kbd',volatile=True,container=102,protocols='is_subsys') self.usbname=usbname self.remover=remove self.domain = piw.clockdomain_ctl() self.domain.set_source(piw.makestring('*',0)) self[1] = bundles.Output(1,False, names='activation output') self[2] = bundles.Output(2,False, names='pressure output') self[3] = bundles.Output(3,False, names='roll output') self[4] = bundles.Output(4,False, names='yaw output') self[5] = bundles.Output(1,False, names='strip position output') self[6] = bundles.Output(1,False, names='breath output') self[8] = bundles.Output(2,False, names='absolute strip output') self.led_backend = piw.functor_backend(1,True) self.status_mixer = piw.statusmixer(self.led_backend.cookie()) self.led_input = bundles.VectorInput(self.status_mixer.cookie(),self.domain,signals=(1,)) self[7] = atom.Atom(names='light input',protocols='revconnect',policy=self.led_input.vector_policy(1,False,False,auto_slot=True),domain=domain.Aniso()) self.koutput = bundles.Splitter(self.domain,self[1],self[2],self[3],self[4]) self.kpoly = piw.polyctl(10,self.koutput.cookie(),False,5) self.soutput = bundles.Splitter(self.domain,self[5],self[8]) self.boutput = bundles.Splitter(self.domain,self[6]) self.kclone=piw.sclone() self.kclone.set_filtered_output(1,self.kpoly.cookie(),piw.first_filter(1)) self.kclone.set_filtered_output(2,self.soutput.cookie(),piw.first_filter(2)) self.kclone.set_filtered_output(3,self.boutput.cookie(),piw.first_filter(3)) self.keyboard=pkbd_native.bundle(usbname,self.kclone.cookie(),utils.notify(self.dead),utils.changify(self.signal)) self[100] = VirtualKey() #self[102] = vc self[251] = atom.Atom(domain=domain.BoundedFloat(0,1), init=self.keyboard.get_threshold1(), protocols='input output', names='soft threshold', policy=atom.default_policy(self.keyboard.set_threshold1)) self[249] = atom.Atom(domain=domain.BoundedFloat(0,1), init=self.keyboard.get_threshold2(), protocols='input output', names='hard threshold', policy=atom.default_policy(self.keyboard.set_threshold2)) self[240] = atom.Atom(domain=domain.BoundedFloat(0,1), init=self.keyboard.get_roll_axis_window(), protocols='input output', names='roll axis window', policy=atom.default_policy(self.keyboard.set_roll_axis_window)) self[241] = atom.Atom(domain=domain.BoundedFloat(0,1), init=self.keyboard.get_yaw_axis_window(), protocols='input output', names='yaw axis window', policy=atom.default_policy(self.keyboard.set_yaw_axis_window)) self[242] = atom.Atom(domain=domain.Bool(), init=False, protocols='input output nostage', names='k logging', policy=atom.default_policy(self.keyboard.enable_key_logging)) f=self.keyboard.led_functor() self.led_backend.set_functor(piw.pathnull(0),f) self[9] = atom.Atom(names='controller output',domain=domain.Aniso(),init=self.__courses())
def __init__(self, address, ordinal): agent.Agent.__init__(self, signature=version, names='t3d output', ordinal=ordinal) self.domain = piw.clockdomain_ctl() self.domain.set_source(piw.makestring('*',0)) self.t3d_output = t3d_output(self.domain, "localhost", 3123); self.output = self.t3d_output.create_output("", True, 0) self.input = bundles.VectorInput(self.output, self.domain, signals=(IN_KEY,IN_PRESSURE,IN_ROLL,IN_YAW,IN_FREQ)) # related inputs for a key self[1] = atom.Atom(names="inputs") self[1][1] = atom.Atom(domain=domain.Aniso(), policy=self.input.vector_policy(IN_KEY,False), names='key input') self[1][2] = atom.Atom(domain=domain.BoundedFloat(0,1), policy=self.input.vector_policy(IN_PRESSURE,False), names='pressure input') self[1][3] = atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.input.vector_policy(IN_ROLL,False), names='roll input') self[1][4] = atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.input.vector_policy(IN_YAW,False), names='yaw input') self[1][5] = atom.Atom(names='frequency input', domain=domain.BoundedFloat(1,96000), policy=self.input.vector_policy(IN_FREQ,False)) # breath output self.breath_output = self.t3d_output.create_output("breath",False,1) self.breath_input = bundles.VectorInput(self.breath_output, self.domain,signals=(1,)) self[1][6] = atom.Atom(domain=domain.BoundedFloat(0,1), policy=self.breath_input.vector_policy(1,False), names='breath input') # outputs for strips self.absstrip1_output = self.t3d_output.create_output("strip1",False,4) self.absstrip1_input = bundles.VectorInput(self.absstrip1_output, self.domain,signals=(1,)) self[1][7] = atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.absstrip1_input.vector_policy(1,False), names='absolute strip input', ordinal=1) self.absstrip2_output = self.t3d_output.create_output("strip2",False,5) self.absstrip2_input = bundles.VectorInput(self.absstrip2_output, self.domain,signals=(1,)) self[1][8] = atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.absstrip2_input.vector_policy(1,False), names='absolute strip input', ordinal=2) self.strippos1_output = self.t3d_output.create_output("d_strip1",False,2) self.strippos1_input = bundles.VectorInput(self.strippos1_output, self.domain,signals=(1,)) self[1][9] = atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.strippos1_input.vector_policy(1,False), names='strip position input', ordinal=1) self.strippos2_output = self.t3d_output.create_output("d_strip2",False,3) self.strippos2_input = bundles.VectorInput(self.strippos2_output, self.domain,signals=(1,)) self[1][10] = atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.strippos2_input.vector_policy(1,False), names='strip position input', ordinal=2) self.p1_output = self.t3d_output.create_output("pedal1",False,6) self.p1_input = bundles.VectorInput(self.p1_output, self.domain,signals=(1,)) self[1][11] = atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.p1_input.vector_policy(1,False), names='pedal input', ordinal=1) self.p2_output = self.t3d_output.create_output("pedal2",False,7) self.p2_input = bundles.VectorInput(self.p2_output, self.domain,signals=(1,)) self[1][12] = atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.p2_input.vector_policy(1,False), names='pedal input', ordinal=2) self.p3_output = self.t3d_output.create_output("pedal3",False,8) self.p3_input = bundles.VectorInput(self.p3_output, self.domain,signals=(1,)) self[1][13] = atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.p3_input.vector_policy(1,False), names='pedal input', ordinal=3) self.p4_output = self.t3d_output.create_output("pedal4",False,9) self.p4_input = bundles.VectorInput(self.p4_output, self.domain,signals=(1,)) self[1][14] = atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.p4_input.vector_policy(1,False), names='pedal input', ordinal=4) self[2] = atom.Atom(names="host") self[2][1] = atom.Atom(domain=domain.String(), init='localhost', names='name', policy=atom.default_policy(self.__set_host)); self[2][2] = atom.Atom(domain=domain.BoundedInt(1,9999), init=3123, names='port', policy=atom.default_policy(self.__set_port), ) self[3] = atom.Atom(domain=domain.BoundedInt(1,2000), init=250, policy=atom.default_policy(self.__set_data_freq), names='data frequency') self[5] = atom.Atom(domain=domain.BoundedInt(1,16), init=16, policy=atom.default_policy(self.__set_max_voice_count), names='max voice count') self[6] = atom.Atom(domain=domain.Bool(),init=False,policy=atom.default_policy(self.__set_kyma_mode),names='kyma') self.ctlr_fb = piw.functor_backend(1,True) self.ctlr_fb.set_functor(piw.pathnull(0),self.t3d_output.control()) self.ctlr_input = bundles.ScalarInput(self.ctlr_fb.cookie(),self.domain,signals=(IN_CONTROL,)) self[7] = atom.Atom(domain=domain.Aniso(),policy=self.ctlr_input.policy(IN_CONTROL,False),names='controller input') self[8] = atom.Atom(domain=domain.Bool(),init=False,policy=atom.default_policy(self.__set_continuous_mode),names='continuous') self.t3d_output.connect(self[2][1].get_value(), self[2][2].get_value())
def __init__(self, address, ordinal): # agent.Agent.__init__(self, signature=version, names='midi monitor', ordinal=ordinal) self.domain = piw.clockdomain_ctl() self.domain.set_source(piw.makestring('*', 0)) self[1] = atom.Atom(names='outputs') self[1][1] = bundles.Output(OUT_LIGHT, False, names='light output', protocols='revconnect') self.output = bundles.Splitter(self.domain, self[1][1]) self.monitor = midi_monitor(self.domain, self.output.cookie()) self.ctlr_fb = piw.functor_backend(1, True) self.ctlr_fb.set_functor(piw.pathnull(0), self.monitor.control()) self.ctlr_input = bundles.ScalarInput(self.ctlr_fb.cookie(), self.domain, signals=(IN_CONTROL, )) self[2] = atom.Atom(domain=domain.Aniso(), policy=self.ctlr_input.policy(IN_CONTROL, False), names='controller input') self.midi_input = bundles.VectorInput(self.monitor.cookie(), self.domain, signals=(IN_MIDI, )) self[3] = atom.Atom(domain=domain.Aniso(), policy=self.midi_input.vector_policy( IN_MIDI, False), names="midi input") self[4] = atom.Atom(names="inputs") self[4][1] = atom.Atom(domain=domain.Bool(), init=True, policy=atom.default_policy(self.__enable_notes), names='enable notes') self[4][2] = atom.Atom(domain=domain.Bool(), init=False, policy=atom.default_policy( self.__enable_poly_pressure), names='enable polyphonic pressure') self[4][3] = atom.Atom(domain=domain.Bool(), init=False, policy=atom.default_policy( self.__enable_cc_as_key), names='enable control with key') self[4][4] = atom.Atom(domain=domain.Bool(), init=False, policy=atom.default_policy( self.__enable_cc_as_course), names='enable control with course') self[4][5] = atom.Atom(domain=domain.BoundedInt(0, 16), init=0, policy=atom.default_policy(self.__channel), names='channel') self[4][6] = atom.Atom(domain=domain.Bool(), init=False, policy=atom.default_policy( self.__nearest_match), names='altered note') self[4][7] = atom.Atom(domain=domain.Bool(), init=False, policy=atom.default_policy(self.__first_match), names='base note') self[4][8] = atom.Atom(domain=domain.Bool(), init=True, policy=atom.default_policy( self.__use_velocity_as_state), names='velocity for status') self[4][9] = atom.Atom(domain=domain.Bool(), init=False, policy=atom.default_policy( self.__use_channel_as_state), names='channel for status') self[4][10] = atom.Atom(domain=domain.Bool(), init=False, policy=atom.default_policy( self.__use_physical_mapping), names='use physical mapping') self[4][11] = atom.Atom(domain=domain.BoundedInt(0, 127), init=0, policy=atom.default_policy( self.__control_offset), names='control offset')
def __init__(self, address, ordinal): agent.Agent.__init__(self, signature=version, names='kmapper', icon='plg_simple/kgroup.png',container=17,ordinal=ordinal) self.__cur_size = 0 self.__choices=[] self.__coursekeys=[] self.__course=1 self.__private = node.Server(value=piw.makestring('[]',0),change=self.__set_members) self.set_private(self.__private) self.domain = piw.clockdomain_ctl() self.domain.set_source(piw.makestring('*',0)) self.mapper = piw.kgroup_mapper() self[1] = bundles.Output(1,False, names='light output',protocols='revconnect') self.loutput = bundles.Splitter(self.domain,self[1]) self.lmapper = piw.clone(True) self.lmapper.set_filtered_output(1,self.loutput.cookie(),self.mapper.light_filter()) self.lmux = piw.multiplexer(self.lmapper.cookie(),self.domain) self.linput = bundles.VectorInput(self.lmux.get_input(1),self.domain,signals=(1,)) self[2] = atom.Atom(names='light input',protocols='revconnect',policy=self.linput.vector_policy(1,False,False),domain=domain.Aniso()) self[3] = bundles.Output(1,False, names='strip position output',ordinal=1) self[4] = bundles.Output(2,False, names='strip position output',ordinal=2) self[5] = bundles.Output(3,False, names='breath output') self.soutput = bundles.Splitter(self.domain,self[3],self[4],self[5]) self.sgate = piw.gate(self.soutput.cookie(),True) self.sinput = bundles.VectorInput(self.sgate.cookie(),self.domain,signals=(1,2,3)) self[6] = atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.sinput.vector_policy(1,False),names='strip position input',ordinal=1) self[7] = atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.sinput.vector_policy(2,False),names='strip position input',ordinal=2) self[8] = atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.sinput.vector_policy(3,False),names='breath input') self[9] = bundles.Output(1,False, names='activation output') self[10] = bundles.Output(2,False, names='pressure output') self[11] = bundles.Output(3,False, names='roll output') self[12] = bundles.Output(4,False, names='yaw output') self.koutput = bundles.Splitter(self.domain,self[9],self[10],self[11],self[12]) self.kpoly = piw.polyctl(10,self.koutput.cookie(),False,5) self.kclone = piw.clone(True) self.kclone.set_policy(False) self.kinput = bundles.VectorInput(self.kclone.cookie(),self.domain,signals=(1,2,3,4),filter=self.mapper.key_filter()) self[13] = atom.Atom(domain=domain.BoundedFloat(0,1), policy=self.kinput.vector_policy(1,False), names='activation input') self[14] = atom.Atom(domain=domain.BoundedFloat(0,1), policy=self.kinput.vector_policy(2,False), names='pressure input') self[15] = atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.kinput.vector_policy(3,False), names='roll input') self[16] = atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.kinput.vector_policy(4,False), names='yaw input') self.kclone.set_output(1,self.kpoly.cookie()) #self.add_verb2(2,'choose([],None,role(None,[matches([k])]),option(from,[numeric,singular]))',self.__choose2) #self.add_verb2(3,'choose([],None,role(None,[mass([k])]))',self.__choose3) #self.add_verb2(4,'clear([],None)',self.__clear) #self.add_verb2(5,'add([],None,role(None,[mass([k])]))',self.__add) self.add_verb2(7,'choose([],None,role(None,[matches([k])]),option(as,[numeric]))',self.__choose) self.add_verb2(8,'set([],None,role(None,[tagged_ideal([~server,course],[offset])]),role(to,[mass([semitone])]))',callback=self.__set_course_semi) self.add_verb2(9,'set([],None,role(None,[tagged_ideal([~server,course],[offset])]),role(to,[mass([interval])]))',callback=self.__set_course_int) self.add_verb2(12,'clear([],None,option(None,[mass([course])]))',self.__kclear) self.add_verb2(13,'add([],None,role(None,[mass([k])]),option(to,[mass([course])]))',self.__kadd) self.add_verb2(14,'add([],None,role(None,[mass([k])]),role(to,[mass([k])]),option(as,[mass([course])]))',self.__radd) self[20] = VirtualKey(lambda: self.__cur_size) self.statusbuffer = piw.statusbuffer(self.lmux.gate_input(),2,self.lmux.get_input(2)) self.selgate = piw.functor_backend(1,True) self.kclone.set_output(2,self.selgate.cookie()) self.statusbuffer.enable(1) self.kclone.enable(1,True) self.sgate.enable(True) self.__upstream_size = 0 self.__set_poly() self[21] = atom.Atom(domain=domain.Aniso(),policy=atom.default_policy(self.__upstream),names='controller input') self[22] = VirtualChannel() self[23] = bundles.Output(1,False, names='controller output', continuous=True) self.coutput = bundles.Splitter(self.domain,self[23]) self.controller = Controller(self.coutput.cookie()) self.__private[2]=self.controller.state() self.cgate = piw.gate(self.controller.cookie(),True) self.cinput = bundles.ScalarInput(self.cgate.cookie(),self.domain,signals=(1,)) self[24] = atom.Atom(domain=domain.Aniso(), policy=self.cinput.nodefault_policy(1,False),names='controller input') self[25] = VirtualCourse(self.controller)
def __init__(self, address, ordinal): agent.Agent.__init__(self, signature=version, names='audio unit', container=100, ordinal=ordinal) self.__state = PluginState(self.__plugin_state_loaded) self.set_private(self.__state) self.__browser = PluginBrowser(self) self.__domain = piw.clockdomain_ctl() self.__audio_output = audio.AudioOutput(bundles.Splitter( self.__domain), 1, 2, names='channels') self.__audio_output_channels = audio.AudioChannels(self.__audio_output) self.__midi_output = bundles.Splitter(self.__domain) self.__observer = PluginObserver(self.__state, self) self.host = host_native.plugin_instance( self.__observer, self.__domain, self.__audio_output.cookie(), self.__midi_output.cookie(), utils.statusify(self.__window_state_changed)) self.parameter_list = inputparameter.List(self.host, self.host.clock_domain(), self.verb_container()) self.__audio_input = audio.AudioInput(bundles.ScalarInput( self.host.audio_input_cookie(), self.__domain, signals=range(1, 65)), 1, 2, names='channels') self.__audio_input_channels = audio.AudioChannels(self.__audio_input) self.__key_input = bundles.VectorInput( self.host.midi_from_belcanto_cookie(), self.__domain, signals=(1, 2)) self.__midi_input = bundles.ScalarInput( self.host.midi_aggregator_cookie(), self.__domain, signals=(1, )) self.__metronome_input = bundles.ScalarInput( self.host.metronome_input_cookie(), self.__domain, signals=(1, 2, 3, 4)) self.host.set_bypassed(True) # plugin browser self[1] = self.__browser # audio output self[2] = atom.Atom(names='audio outputs') self[2][1] = self.__audio_output self[2][2] = self.__audio_output_channels # audio input self[3] = atom.Atom(names='audio inputs') self[3][1] = self.__audio_input self[3][2] = self.__audio_input_channels # parameter mapping self[4] = self.parameter_list # metronome input self[5] = atom.Atom(names='metronome inputs') self[5][1] = atom.Atom(domain=domain.Aniso(), policy=self.__metronome_input.nodefault_policy( 1, False), names='song beat input') self[5][2] = atom.Atom(domain=domain.Aniso(), policy=self.__metronome_input.nodefault_policy( 2, False), names='running input') self[5][3] = atom.Atom(domain=domain.Aniso(), policy=self.__metronome_input.nodefault_policy( 3, False), names='tempo input') self[5][4] = atom.Atom(domain=domain.Aniso(), policy=self.__metronome_input.nodefault_policy( 4, False), names='bar beat input') # kbd/controller inputs self[6] = atom.Atom(names='musical inputs') self[6][1] = atom.Atom(domain=domain.Aniso(), policy=self.__key_input.vector_policy(1, False), names='pressure input') self[6][2] = atom.Atom(domain=domain.Aniso(), policy=self.__key_input.merge_nodefault_policy( 2, False), names='frequency input') # midi channel self[7] = atom.Atom(domain=domain.BoundedInt(0, 20), init=0, names='midi channel', policy=atom.default_policy(self.set_midi_channel)) # velocity curve control vel = (T('stageinc', 0.1), T('inc', 0.1), T('biginc', 1), T('control', 'updown')) self[8] = atom.Atom(names='velocity curve controls') self[8][1] = atom.Atom(domain=domain.BoundedInt(1, 1000), init=4, names='velocity sample', policy=atom.default_policy( self.__set_velocity_samples)) self[8][2] = atom.Atom(domain=domain.BoundedFloat(0.1, 10, hints=vel), init=4, names='velocity curve', policy=atom.default_policy( self.__set_velocity_curve)) self[8][3] = atom.Atom(domain=domain.BoundedFloat(0.1, 10, hints=vel), init=4, names='velocity scale', policy=atom.default_policy( self.__set_velocity_scale)) self[9] = atom.Atom(domain=domain.Bool(), init=True, names='tail time enable', policy=atom.default_policy( self.__set_tail_time_enabled)) self[10] = atom.Atom(domain=domain.BoundedFloatOrNull(0, 100000), init=10, names='tail time', policy=atom.default_policy(self.__set_tail_time)) self[11] = atom.Atom(domain=domain.BoundedInt(1, 16), init=1, names='minimum channel', policy=atom.default_policy(self.set_min_channel)) self[12] = atom.Atom(domain=domain.BoundedInt(1, 16), init=16, names='maximum channel', policy=atom.default_policy(self.set_max_channel)) # other global settings inputs self[20] = atom.Atom(domain=domain.BoundedInt(0, 100), init=0, names="minimum decimation", policy=atom.default_policy( self.set_min_decimation)) self[21] = atom.Atom(domain=domain.Bool(), init=True, names="notes enable", policy=atom.default_policy(self.set_midi_notes)) self[22] = atom.Atom(domain=domain.Bool(), init=True, names="pitch bend enable", policy=atom.default_policy( self.set_midi_pitchbend)) self[23] = atom.Atom(domain=domain.Bool(), init=False, names="high resolution velocity enable", policy=atom.default_policy( self.set_midi_hires_velocity)) self[24] = atom.Atom(domain=domain.BoundedInt(0, 96), init=1, names="pitch bend range upper", policy=atom.default_policy(self.set_pitchbend_up)) self[25] = atom.Atom(domain=domain.BoundedInt(0, 96), init=1, names="pitch bend range lower", policy=atom.default_policy( self.set_pitchbend_down)) # status output to drive the talker lights self[13] = bundles.Output(1, False, names='status output') self.light_output = bundles.Splitter(self.__domain, self[13]) self.lights = piw.lightsource(piw.change_nb(), 0, self.light_output.cookie()) self.lights.set_size(2) self.set_light(1, True) self.set_light(2, False) # midi I/O # midi input self[14] = atom.Atom(domain=domain.Aniso(), policy=self.__midi_input.nodefault_policy( 1, False), names='midi input') # midi output self[15] = self.__midi_output.add_output( bundles.Output(1, False, names='midi output')) # controller input/output to add labels self[16] = atom.Atom( domain=domain.Aniso(hints=(logic.make_term('continuous'), )), names='controller output', policy=atom.readonly_policy()) self[17] = atom.Atom(domain=domain.String(), init='Plugin', names='label category', policy=atom.default_policy(self.__set_category)) self[18] = atom.Atom(domain=domain.String(), init='', names='label', policy=atom.default_policy(self.__set_label)) self.ctl_functor = piw.functor_backend(1, True) self.ctl_input = bundles.VectorInput(self.ctl_functor.cookie(), self.__domain, signals=(1, )) self[19] = atom.Atom(domain=domain.Aniso(), policy=self.ctl_input.vector_policy(1, False), names='controller input') self.ctl_functor.set_functor( piw.pathnull(0), utils.make_change_nb( piw.slowchange(utils.changify(self.__controller_input)))) self.__ctl = [] # verbs self.add_verb2(1, 'show([],None)', callback=self.__show) self.add_verb2(2, 'show([un],None)', callback=self.__unshow) self.add_verb2(3, 'close([],None)', callback=self.__close) self.add_verb2(4, 'bypass([toggle],None)', callback=self.__tog_bypass, status_action=self.__status_bypass) self.add_verb2(5, 'show([toggle],None)', callback=self.__tog_show, status_action=self.__status_show) self.add_verb2(6, 'open([],None,role(None,[abstract]))', callback=self.__open) self.add_verb2(7, 'scan([],None)', callback=self.__browser.refresh_plugin_list) self.add_verb2(8, 'bypass([],None)', callback=self.__bypass) self.add_verb2(9, 'bypass([un],None)', callback=self.__unbypass) # control change self.add_verb2( 10, 'set([],~a,role(None,[matches([midi,program])]),role(to,[numeric]))', create_action=self.__set_program_change) self.add_verb2( 11, 'set([],~a,role(None,[matches([midi,bank])]),role(to,[numeric]))', create_action=self.__set_bank_change) self.add_verb2( 12, 'set([],~a,role(None,[mass([midi,controller])]),role(to,[numeric]))', create_action=self.__set_midi_control) self.set_ordinal(ordinal)
def __init__(self, address, ordinal): agent.Agent.__init__(self, signature=version, names='tabulator', ordinal=ordinal) self.domain = piw.clockdomain_ctl() self[5] = bundles.Output(1, False, names='status output') self.status_output = bundles.Splitter(self.domain, self[5]) self.lights = piw.lightsource(piw.change_nb(), 0, self.status_output.cookie()) self.lights.set_size(1) self.cfunctor = piw.functor_backend(1, False) self.cinput = bundles.VectorInput(self.cfunctor.cookie(), self.domain, signals=(1, )) self[1] = atom.Atom(domain=domain.Aniso(), policy=self.cinput.vector_policy(1, False), names='controller input') self.cfunctor.set_gfunctor( utils.make_change_nb( piw.slowchange(utils.changify(self.__controller)))) self.keyfunctor = piw.functor_backend(1, False) self.keyinput = bundles.VectorInput(self.keyfunctor.cookie(), self.domain, signals=(1, )) self[2] = atom.Atom(domain=domain.Aniso(), policy=self.keyinput.vector_policy(1, False), names='key input') self.keyfunctor.set_gfunctor( utils.make_change_nb(piw.slowchange(utils.changify(self.__key)))) self[3] = atom.Atom(domain=domain.BoundedInt(1, 100), init=DEFAULT_CHORD_TIMEOUT, policy=atom.default_policy( self.__set_chordtimeout), names='chord timeout') self[4] = atom.Atom(domain=domain.BoundedInt(80, 200), init=DEFAULT_PAGE_WIDTH, policy=atom.default_policy(self.__set_pagewidth), names='page width') self[6] = atom.Atom(domain=domain.Bool(), init=False, names='start', policy=atom.default_policy(self.__change_start)) self.add_verb2(1, 'start([],None)', self.__start, status_action=self.__status) self.add_verb2(2, 'stop([],None)', self.__stop, status_action=self.__status) self.add_verb2(3, 'start([toggle],None)', self.__toggle, status_action=self.__status) self.__set_chordtimeout(DEFAULT_CHORD_TIMEOUT) self.__set_pagewidth(DEFAULT_PAGE_WIDTH) self.__columnlen = None self.__columnsqueue = None self.__columnsrender = None self.__lasttime = None self.__update_status()