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,agent,voice): self.agent = agent self.voice = voice self.__timestamp = piw.tsd_time() atom.Atom.__init__(self,domain=domain.String(),names='voice',ordinal=voice,protocols='remove browse',policy=atom.default_policy(self.set_loop)) self.looper = loop_native.player(agent.aggregator.get_output(voice),agent.domain,utils.statusify(self.__loop_status)) agent.clock_cloner.set_output(voice,self.looper.cookie()) self.loop_off = self.looper.player(0) self.loop_on = self.looper.player(1) self.loop_toggle = self.looper.player(3) self.loop_once = self.looper.player(2) self.agent.lights.set_status(self.voice,const.status_inactive) self[1] = atom.Atom(domain=domain.BoundedFloat(0.0,100.0,0.0,hints=(T('stageinc',1),T('inc',1),T('biginc',10),T('control','updown')),verbinc=10.0),init=100.0,policy=atom.default_policy(self.set_volume),names='volume') self[2] = atom.Atom(domain=domain.BoundedFloat(0.0,100.0,0.0,hints=(T('stageinc',1),T('inc',1),T('biginc',10),T('control','updown')),verbinc=10.0),init=10.0,policy=atom.default_policy(self.set_chop),names='chop') self[3] = atom.Atom(domain=domain.Bool(),init=False,names='enable',policy=atom.default_policy(self.set_playing),protocols='set',container=(None,'voice%d'%voice,agent.verb_container())) self[3].add_verb2(1,'set([],~a,role(None,[instance(~self)]))', create_action=self.__enable_set, status_action=self.__enable_status) self[3].add_verb2(2,'set([un],~a,role(None,[instance(~self)]))', create_action=self.__enable_unset, status_action=self.__enable_status) self[3].add_verb2(3,'set([toggle],~a,role(None,[instance(~self)]))', create_action=self.__enable_toggle, status_action=self.__enable_status) self.looper.set_chop(10.0) self.looper.set_volume(1.0) piw.changelist_connect(agent.loop_on,self.loop_on) piw.changelist_connect(agent.loop_off,self.loop_off) piw.changelist_connect(agent.loop_toggle,self.loop_toggle) self.first()
def __init__(self,agent): self.agent=agent atom.Atom.__init__(self,domain=domain.String(),names='audio port',protocols='virtual browse',policy=atom.default_policy(self.__change_device),init='') self.__mapping = [] # (uid,name) self.__timestamp = piw.tsd_time() self.__selected=None self.__update()
def __init__(self,agent,sessionChanges): self.__agent = agent self.__sessionChanges = sessionChanges atom.Atom.__init__(self,domain=domain.String(),policy=atom.default_policy(self.setXML),protocols='nostage') self.set_property_long('tabIndex',-1) self[1] = WidgetList(self)
def __init__(self,agent): self.__scan() self.agent = agent atom.Atom.__init__(self,names='sample',protocols='virtual browse',domain=domain.String(),policy=atom.load_policy(self.__loadcurrent)) self.__timestamp = piw.tsd_time() self.__selected=None self.__update()
def __init__(self, address, ordinal): agent.Agent.__init__(self, signature=version, names='scaler',protocols='bind set',icon='plg_simple/scaler.png',container=5,ordinal=ordinal) self.domain = piw.clockdomain_ctl() self.domain.set_source(piw.makestring('*',0)) self.__fixed = False self.set_private(node.Server(value=piw.makebool(False,0),change=self.__changefix)) self[1] = atom.Atom() self[1][1] = bundles.Output(1,False,names='activation output', protocols='') self[1][2] = bundles.Output(2,False,names='pressure output', protocols='') self[1][3] = bundles.Output(3,False,names='roll output', protocols='') self[1][4] = bundles.Output(4,False,names='yaw output', protocols='') self[1][5] = bundles.Output(5,False,names='scale note output', protocols='') self[1][6] = bundles.Output(6,False,names='frequency output', protocols='') self.ctl = piw.scaler_controller() self.ctl_input = bundles.VectorInput(self.ctl.cookie(),self.domain,signals=(1,)) self.output = bundles.Splitter(self.domain,*self[1].values()) self.filter = piw.scaler(self.ctl,self.output.cookie(),cubic()) self.input = bundles.VectorInput(self.filter.cookie(), self.domain,signals=(1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17)) self.input.correlator.clocksink().add_upstream(self.ctl_input.correlator.clocksink()) self[4]=atom.Atom() self[4][1]=atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.input.merge_policy(1,False),names='activation input') self[4][2]=atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.input.vector_policy(2,False),names='pressure input') self[4][3]=atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.input.merge_policy(3,False),names='roll input') self[4][4]=atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.input.merge_policy(4,False),names='yaw input') th=(T('inc',1),T('biginc',1),T('control','updown')) bh=(T('inc',1),T('biginc',1),T('control','updown')) sh=(T('choices','[0,2,4,5,7,9,11,12]','[0,1,2,3,4,5,6,7,8,9,10,11,12]','[0,2,4,6,8,10,12]','[0,2,3,5,7,8,10,12]','[0,3,5,6,7,10,12]', '[0,2,3,6,7,8,11,12]','[0,3,5,7,10,12]','[0,2,4,7,9,12]'), T('control','selector')) self[4][5]=atom.Atom(domain=domain.BoundedFloat(0,12,hints=th),policy=self.input.merge_policy(5,False),names='tonic input',protocols='bind set',container=(None,'tonic',self.verb_container())) self[4][6]=atom.Atom(domain=domain.BoundedFloat(-20,20,hints=bh),policy=self.input.merge_policy(6,False),names='base note input',protocols='bind') self[4][7]=atom.Atom(domain=domain.String(hints=sh),init='[0,2,4,5,7,9,11,12]',policy=self.input.merge_policy(7,False),names='scale input',protocols='bind set',container=(None,'scale',self.verb_container())) self[4][8]=atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.input.merge_policy(9,policy.LopassStreamPolicy(200,0.6)),names='k pitch bend input') self[4][9]=atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.input.merge_policy(10,False),names='global pitch bend input') self[4][10]=atom.Atom(domain=domain.BoundedFloat(0,72),init=1,policy=self.input.merge_policy(11,False),names='k bend range input',protocols='bind') self[4][11]=atom.Atom(domain=domain.BoundedFloat(0,72),init=12,policy=self.input.merge_policy(12,False),names='global bend range input',protocols='bind') self[4][12]=atom.Atom(domain=domain.Aniso(),policy=self.ctl_input.vector_policy(1,False),names='controller input') self[4][13]=atom.Atom(domain=domain.Bool(),policy=self.input.merge_policy(14,False),names='override',protocols='bind') self[4][14]=atom.Atom(domain=domain.BoundedFloat(-1,9,hints=th),init=3,policy=self.input.merge_policy(15,False),names='octave input',protocols='bind',container=(None,'octave',self.verb_container())) self[4][15]=atom.Atom(domain=domain.BoundedInt(1,4),init=2,policy=atom.default_policy(self.__set_curve),names='curve',protocols='bind') self[4][16]=atom.Atom(domain=domain.BoundedFloat(0,1000),policy=self.input.merge_nodefault_policy(16,False),names='key input') self[4][17]=atom.Atom(domain=domain.BoundedFloat(-10,10,hints=th),init=0,policy=self.input.merge_policy(17,False),names='relative octave input',protocols='bind') self.add_verb2(3,'choose([],None,role(none,[ideal([None,scale]),singular]))',callback=self.__tune_scale) self.add_verb2(5,'fix([],None)',callback=self.__fix) self.add_verb2(6,'fix([un],None)',callback=self.__unfix) self[4][5].add_verb2(1,'set([],~a,role(None,[instance(~self)]),role(to,[ideal([None,note]),singular]))',callback=self.__tune_tonic) self[4][7].add_verb2(2,'set([],~a,role(None,[instance(~self)]),role(to,[ideal([None,scale]),singular]))',callback=self.__tune_scale)
def __init__(self, key_cookie,cc_cookie,pc_cookie,trig_cookie,midi_cookie): self.__timestamp = piw.tsd_time() self.__midi = MidiDelegate(key_cookie,cc_cookie,pc_cookie,trig_cookie,midi_cookie,self.__sinks_changed) atom.Atom.__init__(self,domain=domain.String(),names='midi port',policy=atom.default_policy(self.set_port),protocols='virtual browse') self.__midi.set_port(0) self.__midi.set_destination('') self.__selected=None self.__update() self.__index = 1
def __init__(self, agent, index): atom.Atom.__init__(self, names='key press', ordinal=index, protocols='remove') self.__agent = agent self.__index = index self.__inputcookie = self.__agent.sysin_events.create_keypress_input( self.__index) self.__input = bundles.VectorInput(self.__inputcookie, agent.domain, signals=(1, )) self[1] = atom.Atom(domain=domain.BoundedFloat(-1, 1), names="pressure input", policy=self.__input.vector_policy(1, True)) self[2] = atom.Atom(domain=domain.BoundedInt(0, 127), names='key code', policy=atom.default_policy(self.__set_code)) self[3] = atom.Atom(domain=domain.String(), names='character', init='', policy=atom.default_policy(self.__set_character)) self[4] = atom.Atom(domain=domain.Bool(), names='hold', init=True, policy=atom.default_policy(self.__set_hold)) self[5] = atom.Atom(domain=domain.BoundedFloat(-1, 1), names='threshold', init=0.0, policy=atom.default_policy(self.__set_threshold)) self[6] = atom.Atom(domain=domain.Bool(), names='velocity', init=False, policy=atom.default_policy(self.__set_velocity)) self[7] = atom.Atom(domain=domain.String(), names='description', init='', policy=atom.default_policy(self.__set_description))
def __init__(self,agent): print 'Icon: user',self.userdir,'rel',self.reldir self.__scan() self.agent=agent atom.Atom.__init__(self,names='icon',protocols='virtual browse',domain=domain.String()) self.__selection='' self.__timestamp = piw.tsd_time() self.__update()
def __init__(self,agent): self.__agent = agent audio.AudioOutput.__init__(self,self.__agent.audio_output,1,1,names='microphone') self[100] = toggle.Toggle(self.__enable,self.__agent.domain,container=(None,'microphone enable',self.__agent.verb_container()),names='enable',transient=True) self[101] = atom.Atom(domain=domain.String(),init='electret',names='type',policy=atom.default_policy(self.__type)) self[102] = atom.Atom(domain=domain.BoundedInt(0,50,hints=(T('inc',1),T('biginc',5),T('control','updown'))),names='gain',init=30,policy=atom.default_policy(self.__gain)) self[103] = toggle.Toggle(self.__pad,self.__agent.domain,container=(None,'microphone pad',self.__agent.verb_container()),names='pad') self[104] = toggle.Toggle(self.__loop_enable,self.__agent.domain,container=(None,'microphone loop',self.__agent.verb_container()),names='loop') self[105] = atom.Atom(domain=domain.BoundedInt(0,120,hints=(T('inc',1),T('biginc',5),T('control','updown'))),names='loop gain',init=100,policy=atom.default_policy(self.__loop_gain)) self[106] = toggle.Toggle(self.__mute_enable,self.__agent.domain,container=(None,'microphone mute',self.__agent.verb_container()),names='automute') self[109] = atom.Atom(domain=domain.BoundedInt(0,4),names='quality',init=2,policy=atom.default_policy(self.__quality))
def __init__(self, finder, trigger, status_cookie, names='action', ordinal=None, protocols=None): p = protocols + ' nostage hidden-connection explicit' if protocols else 'nostage hidden-connection explicit' atom.Atom.__init__(self, domain=domain.String(), policy=atom.default_policy(self.__change), names='action', protocols=p, ordinal=ordinal) self.__finder = finder self.__domain = piw.clockdomain_ctl() self.__domain.set_source(piw.makestring('*', 0)) self.__loading = False self.__active_phrase_operation = False self.__pending_set_phrase = None self.__pending_clear_phrase = False self.__pending_redo = False if status_cookie: self.status_input = bundles.VectorInput(status_cookie, self.__domain, signals=(1, )) self[1] = atom.Atom(domain=domain.BoundedFloat(0, 1), policy=self.status_input.vector_policy( 1, False, clocked=False), names='status input', protocols='nostage hidden-connection explicit') self[2] = atom.Atom(domain=domain.Aniso(), policy=policy.FastReadOnlyPolicy(), names='trigger output', protocols='hidden-connection explicit') self[2].get_policy().set_source(trigger) # prevent running coroutines from being garbage collected self.__running = []
def __init__(self, clk_domain): self.__timestamp = piw.tsd_time() # output MIDI port self.__midi_port = OutputMidiDelegate(self.__update) self.__midi_functor = self.__midi_port.get_midi_output_functor() # merge MIDI channels to output self.__midi_merge = midi_native.midi_merge_output( self.__midi_functor, clk_domain) atom.Atom.__init__(self, domain=domain.String(), names='midi port', policy=atom.default_policy(self.set_port), protocols='virtual browse') self.__midi_port.set_port(0) self.__midi_port.set_source('') self.__selected = None self.__index = 1 self.__update()
def __init__(self, scheduler, index): self.scheduler = scheduler self.index = index self.event = piw.event(scheduler.scheduler, False, utils.changify(self.__enable_changed)) self.event.set_self_light(const.status_selector_off) talker.Talker.__init__( self, scheduler.finder, self.event.fastdata(), self.scheduler.light_aggregator.get_output(index), names='event', ordinal=index, protocols='remove') self[3] = atom.Atom(domain=domain.String(), policy=atom.default_policy(self.__change_schema), names='schema') self[4] = atom.Atom(domain=domain.Bool(), init=False, policy=atom.default_policy(self.__change_enabled), names='enabled')
def __init__(self, callback): self.__callback = callback self.__user_file_name = resource.user_resource_file( 'Fingerer', 'User Fingerings.txt', version='') self.__factory_file_name = os.path.join(os.path.dirname(__file__), 'Factory Fingerings.txt') self.__user_seed_file = resource.find_release_resource( 'fingerer', 'User Fingerings.txt') self.__timestamp = piw.tsd_time() self.__timer = piw.thing() self.__timer.set_slow_timer_handler(utils.notify( self.__timer_callback)) if not resource.os_path_exists( self.__user_file_name) and resource.os_path_exists( self.__user_seed_file): resource.shutil_copyfile(self.__user_seed_file, self.__user_file_name) self.__user_file_time = 0 self.__factory_fingerings = {} self.__user_fingerings = {} self.__load_factory() self.__load_user() fn = set(self.__factory_fingerings.keys()) fn.update(set(self.__user_fingerings.keys())) atom.Atom.__init__(self, names='fingering', domain=domain.String(), init='simple whistle', policy=atom.default_policy(self.__change_fingering), protocols='browse')
def __init__(self, address, ordinal): agent.Agent.__init__(self, names='midi processor', signature=version, ordinal=ordinal) self.domain = piw.clockdomain_ctl() self[2] = atom.Atom(names='outputs') self[2][1] = bundles.Output(1, False, names='wet midi output') self[2][2] = bundles.Output(2, False, names='dry midi output') self.output = bundles.Splitter(self.domain, self[2][1], self[2][2]) self.midiprocessor = midi_native.midi_processor( self.output.cookie(), self.domain) self.input = bundles.VectorInput(self.midiprocessor.cookie(), self.domain, signals=(1, )) self[1] = atom.Atom(domain=domain.Aniso(), names="midi input", policy=self.input.vector_policy(1, False)) self[3] = atom.Atom(domain=domain.Bool(), init=False, names='closed', policy=atom.default_policy(self.__closed)) self[4] = atom.Atom(names='filter') self[4][1] = atom.Atom(domain=domain.Bool(), init=True, names='note on enabled', policy=atom.default_policy( self.__noteon_enabled)) self[4][2] = atom.Atom(domain=domain.Bool(), init=True, names='note off enabled', policy=atom.default_policy( self.__noteoff_enabled)) self[4][3] = atom.Atom(domain=domain.Bool(), init=True, names='polyphonic pressure enabled', policy=atom.default_policy( self.__polypressure_enabled)) self[4][4] = atom.Atom(domain=domain.Bool(), init=True, names='continuous controller enabled', policy=atom.default_policy(self.__cc_enabled)) self[4][5] = atom.Atom(domain=domain.Bool(), init=True, names='program change enabled', policy=atom.default_policy( self.__programchange_enabled)) self[4][6] = atom.Atom(domain=domain.Bool(), init=True, names='channel pressure enabled', policy=atom.default_policy( self.__channelpressure_enabled)) self[4][7] = atom.Atom(domain=domain.Bool(), init=True, names='pitch bend enabled', policy=atom.default_policy( self.__pitchbend_enabled)) self[4][8] = atom.Atom(domain=domain.Bool(), init=True, names='messages enabled', policy=atom.default_policy( self.__messages_enabled)) self[4][9] = atom.Atom(domain=domain.String(), init='[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]', names='channels enabled', policy=atom.default_policy( self.__channels_enabled)) self[5] = atom.Atom(names='mapping') self[5][1] = atom.Atom(domain=domain.String(), init='[]', names='channel mapping', policy=atom.default_policy( self.__set_channel_map)) self.add_verb2( 1, 'clear([],none,role(none,[matches([channel,mapping])]))', callback=self.__clear_channel_map) self.add_verb2( 2, 'map([],none,role(none,[mass([channel])]),role(to,[numeric]))', callback=self.__map_channel) self.add_verb2(3, 'map([un],none,role(none,[mass([channel])]))', callback=self.__unmap_channel)
def __init__(self, init, **kwd): Atom.__init__(self, init=init, domain=domain.String(), **kwd)
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='scale illuminator', 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.illuminator = scale_illuminator(self.domain, self.output.cookie()) th = (T('stageinc', 1), T('inc', 1), T('biginc', 1), T('control', 'updown')) sh = (T('choices', '[0,2,4,5,7,9,11,12]', '[0,1,2,3,4,5,6,7,8,9,10,11,12]', '[0,2,4,6,8,10,12]', '[0,2,3,5,7,8,10,12]', '[0,3,5,6,7,10,12]', '[0,2,3,6,7,8,11,12]', '[0,3,5,7,10,12]', '[0,2,4,7,9,12]'), T('control', 'selector')) self.control_input = bundles.VectorInput(self.illuminator.cookie(), self.domain, signals=(1, )) self[2] = atom.Atom(names="inputs") self[2][1] = atom.Atom(domain=domain.Aniso(), policy=self.control_input.vector_policy( 1, False), names='controller input') self[2][2] = atom.Atom(domain=domain.String(hints=sh), policy=atom.default_policy(self.__change_scale), names='scale', protocols='bind set', container=(None, 'scale', self.verb_container())) self[2][2].add_verb2( 1, 'set([],~a,role(None,[instance(~self)]),role(to,[ideal([None,scale]),singular]))', callback=self.__tune_scale) self[2][3] = atom.Atom(domain=domain.BoundedFloatOrNull(0, 12, hints=th), init=None, policy=atom.default_policy(self.__change_tonic), names='tonic', protocols='bind set', container=(None, 'tonic', self.verb_container())) self[2][3].add_verb2( 1, 'set([],~a,role(None,[instance(~self)]),role(to,[ideal([None,note]),singular]))', callback=self.__tune_tonic) self[2][4] = atom.Atom(domain=domain.Bool(), init=False, policy=atom.default_policy( self.__change_inverted), names='inverted') self[2][5] = atom.Atom(domain=domain.Bool(), init=True, policy=atom.default_policy( self.__change_root_light), names='root') self.add_verb2(3, 'clear([],None,role(None,[matches([scale])]))', callback=self.__clear_scale)
def __init__(self, manager): atom.Atom.__init__(self,domain=domain.String(),names='clip manager',transient=True,policy=atom.default_policy(self.__recv_change),protocols="widget-clipmanager") self.__widget = conductor_native.widget(utils.changify(self.__send_change)); self.set_value(""); manager.initialise_widget(self.__widget)
def __init__(self, tab): atom.Atom.__init__(self,domain=domain.String(),policy=atom.default_policy(self.setXML),protocols='nostage') self.tab = tab
def __init__(self, address, ordinal): # self[3] is the verb container agent.Agent.__init__(self, signature=version, names='console mixer', protocols='inputlist has_subsys browse', icon='plg_synth/mixer.png', container=3, ordinal=ordinal) self.__private = node.Server() self.set_private(self.__private) self.__private[1] = container.PersistentFactory( asserted=self.__inst_asserted, retracted=self.__inst_retracted) self.__private[2] = node.server(value=piw.makestring('testing1', 0)) self.clk = piw.clockdomain_ctl() pan_function = pan_laws[default_pan] # make vol and pan tables self.vol = piw.make_f2f_table( 0, 120, 1000, picross.make_f2f_functor(volume_function)) self.pan = piw.make_f2f_table(-1, 1, 1000, picross.make_f2f_functor(pan_function)) self[1] = atom.Atom() self[1][1] = bundles.Output(1, True, names='left audio output') self[1][2] = bundles.Output(2, True, names='right audio output') self.output = bundles.Splitter(self.clk, self[1][1], self[1][2]) self.mixer = piw.consolemixer(self.vol, self.pan, self.clk, self.output.cookie()) sh = (T('choices', *pan_laws.keys()), T('control', 'selector')) self[10] = atom.Atom(names='pan curve', domain=domain.String(hints=sh), init='default', policy=atom.default_policy(self.__set_pan)) # channel dicts self.channels = {} self.fxchannels = {} # adds subsystems numbered 1..24, which means effect channels cannot be called 1..24 ... for n in range(0, num_inputs): ss = Channel(self, n + 1, self.clk, self.mixer.create_channel(n)) self.add_subsystem(str(n), ss) self.channels[n] = ss self.master_controls_input = bundles.ScalarInput( self.mixer.master_controls_cookie(), self.clk, signals=(1, 2)) self[2] = atom.Atom() self[2][1] = atom.Atom(domain=domain.BoundedFloat( 0, 120, hints=(T('inc', 1), T('biginc', 10), T('control', 'updown'))), init=100, names='master volume', policy=self.master_controls_input.notify_policy( 1, policy.LopassStreamPolicy(100, 0.97), notify=self.volume_changed)) self[2][2] = atom.Atom(domain=domain.BoundedFloat( -1, 1, hints=(T('inc', 0.02), T('biginc', 0.2), T('control', 'updown'))), init=0, names='master pan', policy=self.master_controls_input.policy( 2, policy.LopassStreamPolicy(100, 0.97))) # verbs # verb to create a named effect channel self.add_verb2( 1, 'create([],None,role(None,[abstract,matches([effect])]), role(called,[abstract]))', self.__create_named_fx_chan) self.add_verb2( 2, 'create([un],None,role(None, [abstract,matches([effect])]), role(called,[abstract]))', self.__uncreate_named_fx_chan) self.add_verb2( 3, 'label([],None,role(None,[mass([channel])]),role(to,[abstract]))', self.__label) self.add_verb2(4, 'label([un],None,role(None,[mass([channel])]))', self.__unlabel) self.add_verb2( 5, 'label([],None,role(None,[mass([effect])]),role(to,[abstract]))', self.__labelfx) self.add_verb2(6, 'label([un],None,role(None,[mass([effect])]))', self.__unlabelfx) self.__timestamp = piw.tsd_time() self.__selected = None self.__pending = True self.__thing = piw.thing() piw.tsd_thing(self.__thing) self.__thing.set_slow_timer_handler(utils.notify(self.update)) self.__thing.timer_slow(500)
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='interpreter', protocols='langagent has_subsys', container=10, ordinal=ordinal) self.__transcript = resource.open_logfile('transcript') self.database = database.Database() self.help_manager = help_manager.HelpManager() self.__plumber = builtin_conn.Plumber(self, self.database, ordinal) self.__builtin = builtin_misc.Builtins(self, self.database) self[12] = script.ScriptManager(self, self.__runner) self.__ctxmgr = context.ContextManager(self) self.__statemgr = node.Server(value=piw.makestring('', 0), change=self.__setstatemgr) self.__state = node.Server() self.__state[1] = self.__statemgr self.__state[2] = container.PersistentFactory( asserted=self.__ctlassert, retracted=self.__ctlretract) self.__state[3] = self.__ctxmgr self.set_private(self.__state) self.__interpreters = {} self.interpreter = interpreter.Interpreter( self, self.database, self, ctx=self.__ctxmgr.default_context()) self.register_interpreter(self.interpreter) self.queue = interpreter.Queue(self.interpreter) self[11] = atom.Atom(rtransient=True) self.__history = feedback.History(self) self[11].set_private(self.__history) self.domain = piw.clockdomain_ctl() self.domain.set_source(piw.makestring('*', 0)) self.cloner = piw.clone(True) self.input = bundles.VectorInput(self.cloner.cookie(), self.domain, signals=(1, 2, 3, 4), filter=piw.last_filter()) self[1] = atom.Atom() self[1][1] = atom.Atom(domain=domain.BoundedFloat(0, 1), policy=self.input.vector_policy(1, False), names='activation input') self[1][2] = atom.Atom(domain=domain.BoundedFloat(-1, 1), policy=self.input.vector_policy(2, False), names='roll input') self[1][3] = atom.Atom(domain=domain.BoundedFloat(-1, 1), policy=self.input.vector_policy(3, False), names='yaw input') self[1][4] = atom.Atom(domain=domain.BoundedFloat(0, 1), policy=self.input.vector_policy(4, False), names='pressure input') self.cloner.set_output(1, self.__history.cookie()) self[2] = atom.Atom(init='', names='word output', domain=domain.String()) self[5] = atom.Atom(names='main kgroup') self[5][1] = bundles.Output(1, False, names='activation output') self[5][2] = bundles.Output(2, False, names='roll output') self[5][3] = bundles.Output(3, False, names='yaw output') self[5][4] = bundles.Output(4, False, names='pressure output') self[9] = atom.Atom(names='auxilliary kgroup') self[9][1] = bundles.Output(1, False, names='activation output') self[9][2] = bundles.Output(2, False, names='roll output') self[9][3] = bundles.Output(3, False, names='yaw output') self[9][4] = bundles.Output(4, False, names='pressure output') self.output1 = bundles.Splitter(self.domain, *self[5].values()) self.output2 = bundles.Splitter(self.domain, *self[9].values()) self.cloner.set_filtered_output(3, self.output1.cookie(), piw.last_lt_filter(9)) self.cloner.set_filtered_output(4, self.output2.cookie(), piw.last_gt_filter(10)) self.add_verb2(100, 'create([],None,role(None,[matches([controller])]))', self.__ctlcreate) self.add_verb2( 101, 'create([un],None,role(None,[concrete,singular,issubject(create,[role(by,[cnc(~self)])])]))', self.__ctluncreate) self.add_verb2(30, 'message([],None,role(None,[abstract]))', self.__message) self.add_verb2(150, 'execute([],None,role(None,[abstract]))', self.__runscript) self.add_verb2(151, 'load([],None,role(None,[matches([help])]))', self.__loadhelp) self.add_builtins(self.__builtin) self.add_builtins(self.__ctxmgr) self.database.add_module(builtin_conn) self.database.add_module(context) self.database.add_module(controller) self.__messages_on = True self[4] = atom.Atom(names='messages', policy=atom.default_policy(self.__messages), domain=domain.Bool(), init=True) self[3] = variable.VariableManager(self) self.add_builtins(self[3]) self.add_subsystem('plumber', self.__plumber) # TODO: how should the port number be chosen to avoid clashes with multiple eigenDs? # perhaps could get a free socket like this: # import socket #s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #s.bind(('',0)) #port = s.getsockname()[1] #s.close() self.xmlrpc_server_port = 55553 self.widgets = widget.WidgetManager(self, self.xmlrpc_server_port) self.database.set_widget_manager(self.widgets) # Stage tab data self[14] = stage_server.TabList(self) self.tabs = self[14] self[15] = self.widgets self.add_verb2( 102, 'create([],None,role(None,[matches([widget])]),role(for,[concrete,singular]))', callback=self.__add_widget) self.add_verb2( 103, 'create([un],None,role(None,[matches([widget])]),role(for,[concrete,singular]))', callback=self.__del_widget)
def __init__(self, address, ordinal): self.domain = piw.clockdomain_ctl() self.domain.set_source(piw.makestring('*', 0)) agent.Agent.__init__(self, signature=version, names='strummer', protocols='', ordinal=ordinal) self[1] = atom.Atom(names='outputs') self[1][1] = bundles.Output(1, False, names='key output') self[1][2] = bundles.Output(2, False, names='pressure output') self[1][3] = bundles.Output(3, False, names='roll output') self[1][4] = bundles.Output(4, False, names='yaw output') self.output = bundles.Splitter(self.domain, *self[1].values()) self.strummer = strummer_native.cstrummer(self.output.cookie(), self.domain) self.aggregator = piw.aggregator(self.strummer.cookie(), self.domain) self.strum_input = bundles.VectorInput( self.aggregator.get_filtered_output(1, piw.null_filter()), self.domain, signals=( 1, 2, 3, 4, 5, )) self.data_input = bundles.VectorInput( self.aggregator.get_filtered_output(2, piw.null_filter()), self.domain, signals=( 1, 2, 3, 4, )) self[4] = atom.Atom(names='inputs') self[4][1] = atom.Atom(domain=domain.BoundedFloat(-1, 1), policy=self.strum_input.vector_policy(1, False), names='strum breath input', protocols='nostage') self[4][2] = atom.Atom(domain=domain.Aniso(), policy=self.strum_input.vector_policy(2, False), names='strum key input', protocols='nostage') self[4][3] = atom.Atom(domain=domain.BoundedFloat(0, 1), policy=self.strum_input.merge_policy(3, False), names='strum pressure input', protocols='nostage') self[4][4] = atom.Atom(domain=domain.BoundedFloat(-1, 1), policy=self.strum_input.merge_policy(4, False), names='strum roll input', protocols='nostage') self[4][5] = atom.Atom(domain=domain.BoundedFloat(-1, 1), policy=self.strum_input.merge_policy(5, False), names='strum yaw input', protocols='nostage') self[4][6] = atom.Atom(domain=domain.Aniso(), policy=self.data_input.vector_policy(1, False), names='course key input', protocols='nostage') self[4][7] = atom.Atom(domain=domain.BoundedFloat(0, 1), policy=self.data_input.merge_policy(2, False), names='course pressure input', protocols='nostage') self[4][8] = atom.Atom(domain=domain.BoundedFloat(-1, 1), policy=self.data_input.merge_policy(3, False), names='course roll input', protocols='nostage') self[4][9] = atom.Atom(domain=domain.BoundedFloat(-1, 1), policy=self.data_input.merge_policy(4, False), names='course yaw input', protocols='nostage') self[2] = atom.Atom(names='controls') self[2][1] = atom.Atom(domain=domain.Bool(), init=True, names='enable', policy=atom.default_policy(self.__enable)) self[2][2] = atom.Atom(domain=domain.BoundedInt(0, 2000), init=0, names='trigger window', policy=atom.default_policy( self.__set_trigger_window)) self[2][3] = atom.Atom(domain=domain.BoundedFloat(0, 10), init=0.0, names='course pressure scale', policy=atom.default_policy( self.__set_course_pressure_scale)) self[2][4] = atom.Atom(domain=domain.BoundedFloat(0, 10), init=1.0, names='course roll scale', policy=atom.default_policy( self.__set_course_roll_scale)) self[2][5] = atom.Atom(domain=domain.BoundedFloat(0, 10), init=1.0, names='course yaw scale', policy=atom.default_policy( self.__set_course_yaw_scale)) self[2][6] = atom.Atom(domain=domain.BoundedFloat(0, 10), init=1.0, names='strum breath scale', policy=atom.default_policy( self.__set_strum_breath_scale)) self[2][7] = atom.Atom(domain=domain.BoundedFloat(0, 10), init=1.0, names='strum pressure scale', policy=atom.default_policy( self.__set_strum_pressure_scale)) self[2][8] = atom.Atom(domain=domain.BoundedFloat(0, 10), init=0.0, names='strum roll scale', policy=atom.default_policy( self.__set_strum_roll_scale)) self[2][9] = atom.Atom(domain=domain.BoundedFloat(0, 10), init=0.0, names='strum yaw scale', policy=atom.default_policy( self.__set_strum_yaw_scale)) self[2][10] = atom.Atom(domain=domain.Bool(), init=True, names='strum note end', policy=atom.default_policy( self.__set_strum_note_end)) self[2][11] = atom.Atom(domain=domain.Bool(), init=False, names='open course enable', policy=atom.default_policy( self.__open_course_enable)) self[2][12] = atom.Atom(domain=domain.BoundedFloat(0, 1), init=0.0, names='open course pressure default', policy=atom.default_policy( self.__open_course_pressure_default)) self[2][13] = atom.Atom(domain=domain.BoundedFloat(-1, 1), init=0.0, names='open course roll default', policy=atom.default_policy( self.__open_course_roll_default)) self[2][14] = atom.Atom(domain=domain.BoundedFloat(-1, 1), init=0.0, names='open course yaw default', policy=atom.default_policy( self.__open_course_yaw_default)) self[2][15] = atom.Atom(domain=domain.BoundedFloat(0, 1), init=0.0, names='strum roll pressure mix', policy=atom.default_policy( self.__set_strum_roll_pressure_mix)) self[2][16] = atom.Atom(domain=domain.BoundedFloat(0, 1), init=0.0, names='strum yaw pressure mix', policy=atom.default_policy( self.__set_strum_yaw_pressure_mix)) self[2][17] = atom.Atom(domain=domain.BoundedFloat(0, 1), init=0.1, names='course mute threshold', policy=atom.default_policy( self.__set_course_mute_threshold)) self[2][18] = atom.Atom(domain=domain.BoundedFloat(0, 1), init=0.1, names='strum mute threshold', policy=atom.default_policy( self.__set_strum_mute_threshold)) self[2][19] = atom.Atom(domain=domain.BoundedInt(0, 1000), init=20, names='course mute interval', policy=atom.default_policy( self.__set_course_mute_interval)) self[2][20] = atom.Atom(domain=domain.BoundedInt(0, 1000), init=20, names='strum mute interval', policy=atom.default_policy( self.__set_strum_mute_interval)) self[2][21] = atom.Atom(domain=domain.Bool(), init=True, names='polyphonic courses enable', policy=atom.default_policy( self.__set_poly_courses_enable)) self[2][22] = atom.Atom(domain=domain.Bool(), init=True, names='course mute enable', policy=atom.default_policy( self.__set_course_mute_enable)) self[2][23] = atom.Atom(domain=domain.Bool(), init=True, names='strum mute enable', policy=atom.default_policy( self.__set_strum_mute_enable)) self[2][24] = atom.Atom(domain=domain.BoundedFloat(0, 1), init=0.6, names='pulloff threshold', policy=atom.default_policy( self.__set_pulloff_threshold)) self[2][25] = atom.Atom(domain=domain.BoundedInt(0, 1000), init=10, names='pulloff interval', policy=atom.default_policy( self.__set_pulloff_interval)) self[2][26] = atom.Atom(domain=domain.Bool(), init=True, names='pulloff enable', policy=atom.default_policy( self.__set_pulloff_enable)) self[3] = atom.Atom(domain=domain.String(), init='[]', names='courses', policy=atom.default_policy(self.__set_courses), protocols='course_editor') self.add_verb2( 1, 'set([],~a,role(None,[matches([breath,modulation])]),role(for,[mass([course])]))', callback=self.__set_breath_modulation) self.add_verb2( 2, 'set([un],~a,role(None,[matches([breath,modulation])]),role(for,[mass([course])]))', callback=self.__unset_breath_modulation) self.add_verb2( 3, 'set([],~a,role(None,[matches([open])]),role(as,[mass([key])]),role(for,[mass([course])]))', callback=self.__set_open_course_key) self.add_verb2( 4, 'set([],~a,role(None,[matches([open])]),role(as,[coord(physical,[column],[row])]),role(for,[mass([course])]))', callback=self.__set_open_course_physical) self.add_verb2( 5, 'add([],~a,role(None,[matches([strum,key])]),role(with,[coord(physical,[column],[row])]),role(for,[mass([course])]))', callback=self.__add_strum_key) self.add_verb2( 6, 'clear([],~a,role(None,[matches([all,strum,key])]),role(for,[mass([course])]))', callback=self.__clear_strum_key) self.strumconfig = strummer_native.strumconfig()
def __init__(self, address, ordinal): agent.Agent.__init__(self, signature=version, names='scheduler', container=6, protocols='scheduler', ordinal=ordinal) c = dict(c=schedproxy.get_constraints()) self.add_verb2( 1, 'do([],None,role(None,[abstract]),role(at,%(c)s),option(until,%(c)s),option(every,%(c)s),option(called,[numeric]))' % c, lambda s, t, a, u, e, c: self.__do_verb( s, t, tsm(a), tsm(u), tsm(e), c)) self.add_verb2( 2, 'do([],None,role(None,[abstract]),role(until,%(c)s),option(every,%(c)s),option(called,[numeric]))' % c, lambda s, t, u, e, c: self.__do_verb(s, t, {}, tsm(u), tsm(e), c)) self.add_verb2( 3, 'do([],None,role(None,[abstract]),role(every,%(c)s),option(called,[numeric]))' % c, lambda s, t, e, c: self.__do_verb(s, t, {}, {}, tsm(e), c)) self.add_verb2(4, 'cancel([],None,role(None,[numeric]))', self.__verb_cancel) self.domain = piw.clockdomain_ctl() self.domain.set_source(piw.makestring('*', 0)) self.scheduler = piw.scheduler(4) self.input = bundles.ScalarInput(self.scheduler.cookie(), self.domain, signals=(1, 2, 3, 4, 5)) self.finder = talker.TalkerFinder() self[2] = atom.Atom(names='inputs') self[2][1] = atom.Atom(domain=domain.Aniso(), policy=self.input.policy(1, False), names='running input') self[2][2] = atom.Atom(domain=domain.Aniso(), policy=self.input.policy(2, False), names='song time input') self[2][3] = atom.Atom(domain=domain.Aniso(), policy=self.input.policy(3, False), names='bar beat input') self[2][4] = atom.Atom(domain=domain.Aniso(), policy=self.input.policy(4, False), names='song beat input') self[2][5] = atom.Atom(domain=domain.Aniso(), policy=self.input.policy(5, False), names='bar input') self[3] = collection.Collection(creator=self.__create, wrecker=self.__wreck, names='event', inst_creator=self.__create_inst, inst_wrecker=self.__wreck_inst, protocols='hidden-connection explicit') self[4] = atom.Atom(names='controller') self[4][1] = bundles.Output(1, False, names='light output', protocols='revconnect') self.light_output = bundles.Splitter(self.domain, self[4][1]) self.controller = piw.controller2(self.light_output.cookie(), utils.pack_str(1, 2)) self.light_aggregator = piw.aggregator( self.controller.converter_cookie(), self.domain) self.activation_input = bundles.VectorInput( self.controller.event_cookie(), self.domain, signals=(1, )) self.controller_input = bundles.VectorInput( self.controller.controller_cookie(), self.domain, signals=(1, )) self[4][2] = atom.Atom(domain=domain.Aniso(), policy=self.controller_input.vector_policy( 1, False), names='controller input', protocols='nostage') self[4][3] = atom.Atom(domain=domain.Aniso(), policy=self.activation_input.vector_policy( 1, False), names='key input', protocols='nostage') self[5] = EventBrowser(self.__eventlist) self[6] = atom.Atom(domain=domain.String(), names='identifier')
def __init__(self, address, ordinal): agent.Agent.__init__(self,signature=version, names='interpreter',protocols='langagent has_subsys',container=10,ordinal=ordinal) self.__transcript = resource.open_logfile('transcript') self.database = database.Database(lexicon_changed=self.__lexicon_changed) self.help_manager = help_manager.HelpManager() self.__db_started = False self.set_property_string('timestamp',self.database.get_lexicon().get_timestamp()) self.__builtin = builtin_misc.Builtins(self,self.database) self[12] = script.ScriptManager(self,self.__runner) self.__plumber = plumber.Plumber(self,self.database) self.__ctxmgr = context.ContextManager(self) self.__statemgr = node.Server(value=piw.makestring('',0), change=self.__setstatemgr) self.__state = node.Server() self.__state[1] = self.__statemgr self.__state[3] = self.__ctxmgr self.set_private(self.__state) self.__interpreters = {} self.interpreter = interpreter.Interpreter(self, self.database, self, ctx=self.__ctxmgr.default_context()) self.register_interpreter(self.interpreter) self.queue = interpreter.Queue(self.interpreter) self[11] = atom.Atom(rtransient=True) self.__history = feedback.History(self) self[11].set_private(self.__history) self.domain = piw.clockdomain_ctl() self.domain.set_source(piw.makestring('*',0)) self.cloner = piw.clone(True) self.input = bundles.VectorInput(self.cloner.cookie(),self.domain,signals=(1,2,3,4),filter=piw.last_filter()) self[1] = atom.Atom(names='inputs') self[1][1] = atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.input.vector_policy(1,False),names='key input') self[1][2] = atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.input.vector_policy(2,False),names='roll input') self[1][3] = atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.input.vector_policy(3,False),names='yaw input') self[1][4] = atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.input.vector_policy(4,False),names='pressure input') self.cloner.set_output(1,self.__history.cookie()) self[2] = atom.Atom(init='',names='word output',domain=domain.String()) self[5] = atom.Atom(names='outputs') self[5][1] = bundles.Output(1,False, names='key output') self[5][2] = bundles.Output(2,False, names='roll output') self[5][3] = bundles.Output(3,False, names='yaw output') self[5][4] = bundles.Output(4,False, names='pressure output') self.output1 = bundles.Splitter(self.domain,*self[5].values()) self.cloner.set_output(2,self.output1.cookie()) self.add_verb2(30,'message([],None,role(None,[abstract]))', self.__message) self.add_verb2(150,'execute([],None,role(None,[abstract]))',self.__runscript) self.add_verb2(151,'load([],None,role(None,[matches([help])]))',self.__loadhelp) self.add_verb2(152,'identify([],None,role(None,[concrete]))',self.__identify) self.add_builtins(self.__builtin) self.add_builtins(self.__ctxmgr) self.add_builtins(self.__plumber) self.__messages_on = True self[4] = atom.Atom(names='messages',policy=atom.default_policy(self.__messages),domain=domain.Bool(),init=True) self[3] = variable.VariableManager(self) self.add_builtins(self[3]) # TODO: how should the port number be chosen to avoid clashes with multiple eigenDs? # perhaps could get a free socket like this: # import socket #s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #s.bind(('',0)) #port = s.getsockname()[1] #s.close() self.xmlrpc_server_port = 55553; self.widgets = widget.WidgetManager(self, self.xmlrpc_server_port) self.database.set_widget_manager(self.widgets) # Stage tab data self[14] = stage_server.TabList(self) self.tabs = self[14] self[15] = self.widgets