def __unplumb_static(self): if self.__merge: self.__input.correlator.unplumb_input(self.__signal, 1, piw.pathnull(0), 10) else: self.__input.correlator.unplumb_input(self.__signal, 1, piw.pathnull(0), -1)
def __plumb_static(self): if self.__merge: self.__input.correlator.plumb_input( self.__signal, 1, piw.pathnull(0), 10, policy.Plumber.input_merge, self.__static_data, self.__stream_policy.create_converter(False), piw.null_filter()) else: self.__input.correlator.plumb_input( self.__signal, 1, piw.pathnull(0), -1, policy.Plumber.input_input, self.__static_data, self.__stream_policy.create_converter(False), piw.null_filter())
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 destroy_plumber(self, term, plumber): if term and not self.closed(): self.__input.correlator.plumb_input( self.__signal, 1, piw.pathnull(0), -1, False, self.__static_data, self.__stream_policy.create_converter(False), piw.null_filter())
def create_plumber(self, init, address, filter, slot, clocked): assert clocked if init: self.__input.correlator.unplumb_input(self.__signal, 1, piw.pathnull(0), -1) return policy.Plumber(self.__input.correlator, self.__signal, slot, -1, policy.Plumber.input_input, self.__stream_policy, address, filter, True, self.__callback)
def __init__(self,atom,data_domain,init,transient,input,signal,stream_policy,clocked,callback): self.__stream_policy = stream_policy self.__input = input self.__signal = signal self.__callback = callback self.__static_data = FastSender() self.__ctrl = None policy.ConnectablePolicyImpl.__init__(self,atom,data_domain,init,clocked,node.Server(transient=transient),False) self.data_node().set_change_handler(self.__change) self.__input.correlator.plumb_input(self.__signal,255,piw.pathnull(0),10,policy.Plumber.input_merge,self.__static_data,self.__stream_policy.create_converter(False),piw.null_filter())
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), 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.__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 create_plumber(self, init, address, filter, slot, clocked): if init: 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 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,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 plumb(self): if monitor_debug: print '- Monitor: plumb - unplumbing first...' self.unplumb() if monitor_debug: print '- Monitor: plumbing...' if self.is_fast(): if monitor_debug: print '- Monitor: plumbed fast' self.set_sink(self.__recv) self.__fast = True else: if monitor_debug: print '- Monitor: not plumbed fast' self.__aux = piw.fastdata(const.fastdata_sender) piw.tsd_fastdata(self.__aux) self.__recv.set_upstream(self.__aux) self.__auxq = piw.tsd_dataqueue(16) self.__aux.send_slow(piw.pathnull(piw.tsd_time()), self.__auxq) self.set_change_handler(self.__auxq.sender_slow()) data = self.get_data() if not data.is_null(): if monitor_debug: print 'target=', self.target_id, 'data="', self.get_data( ), '" ready=', self.is_ready(), 'type=', type(data) self.__auxq.sender_slow()(data) self.__fast = False # called when a connection can successfully be made if self.__widget.send_channel is not None: if monitor_debug: print '- Monitor: set_connected true', self.__widget.send_channel self.__osc.set_connected(self.__widget.send_channel, True) else: if monitor_debug: print '- Monitor: **** not set_connected ****' # try sending change in status osc_path = self.__widget.get_property_string('target-name') if osc_path != '': if monitor_debug: print '- Monitor: sent osc connected 1' self.__osc.send(osc_path + '/connected', 1)
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 close(self): self.__input.correlator.unplumb_input(self.__signal,255,piw.pathnull(0),10) self.data_node().clear_change_handler() policy.ConnectablePolicyImpl.close(self)
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,size=2): piw.fastdata.__init__(self,const.fastdata_sender) piw.tsd_fastdata(self) self.__queue = piw.tsd_dataqueue(size) piw.fastdata.send_slow(self,piw.pathnull(piw.tsd_time()),self.__queue)
def create_plumber(self,config,clocked): if not config.connect_static() and self.count_data_connections()==0: self.__input.correlator.unplumb_input(self.__signal,1,piw.pathnull(0),-1) config.callback=self.__callback return policy.Plumber(self,config,clocked)
def destroy_plumber(self,plumber): if self.count_connections()==0: if not self.closed(): self.__input.correlator.plumb_input(self.__signal,1,piw.pathnull(0),-1,False,self.__static_data,self.__stream_policy.create_converter(False),piw.null_filter()) self.__ctrl = None
def breakid(path): if '#' not in path: return (piw.makestring(path, 0), piw.pathnull(0)) (a, p) = path.split('#') return (piw.makestring(a, 0), piw.parsepath(p, 0))
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 setup_leds(self): self.led_backend.set_functor(piw.pathnull(0), self.keyboard.led_functor())