예제 #1
0
    def __init__(self,agent,row=None):
        self.__agent = agent
        self.__fastdata = bundles.FastSender()
        atom.Atom.__init__(self,domain=domain.Aniso(),policy=policy.FastReadOnlyPolicy())
        self.get_policy().set_source(self.__fastdata)
        self.get_policy().set_clock(self.__agent.model.get_clock())

        self.set_private(node.static(_1=node.Server(change=self.__changetarget),_2=node.Server(value=piw.makelong(1,0),change=self.__changerefs)))
        self.target = self.get_private()[1]
        self.refs = self.get_private()[2]

        if row is not None:
            self.__changetarget(piw.makelong(row,0))
예제 #2
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='metronome',
                             ordinal=ordinal)

        self.beat_changes = node.Server(creator=self.__beat_creator,
                                        wrecker=self.__beat_wrecker)
        self.bar_changes = node.Server(creator=self.__bar_creator,
                                       wrecker=self.__bar_wrecker)

        self.set_private(node.Server())
        self.get_private()[1] = self.beat_changes
        self.get_private()[2] = self.bar_changes

        self[2] = atom.Atom()
        self[2][1] = bundles.Output(1, False, names='running output')
        self[2][2] = bundles.Output(2, False, names='time output')
        self[2][3] = bundles.Output(3, False, names='song beat output')
        self[2][4] = bundles.Output(5, False, names='tempo output')
        self[2][5] = bundles.Output(8, False, names='bar beat output')

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*', 0))
        self.output = bundles.Splitter(self.domain, *self[2].values())
        self.barclock = clock_native.clock(6, 1.0, 4.0, self.output.cookie(),
                                           self.domain)
        self.beatclock = clock_native.clock(2, -60.0, 60.0,
                                            self.barclock.cookie(),
                                            self.domain)
        self.input = bundles.ScalarInput(self.beatclock.cookie(),
                                         self.domain,
                                         signals=(1, 2))

        self[1] = atom.Atom()
        self[1][1] = atom.Atom(domain=domain.Bool(),
                               init=False,
                               policy=self.input.policy(1, False),
                               names='running input')
        self[1][2] = atom.Atom(domain=domain.BoundedFloat(0, 10000.0),
                               policy=self.input.policy(2, False),
                               names='time input')

        self[3] = atom.Atom()
        self[3][1] = action.Verb(
            'set(none,none,role(at,[mass([second])]),role(to,[abstract]),role(none,[matches([tempo])]))',
            lambda s, a, t, x: self.__add(a, t))
        self[3][2] = action.Verb(
            'set(dont,none,role(at,[mass([second])]),role(to,[abstract]),role(none,[matches([tempo])]))',
            lambda s, a, t, x: self.__del(a, t))
예제 #3
0
파일: policy.py 프로젝트: shamharoth/EigenD
 def __init__(self,
              atom,
              data_domain,
              init,
              transient,
              handler,
              stream_policy=None,
              clock=True):
     self.__stream_policy = stream_policy or ThrottleStreamPolicy(500)
     self.__handler = handler
     self.__slow_handler = utils.fastchange(self.__handler)
     self.__ctl_handler = piw.change2(
         self.__slow_handler,
         piw.slowchange(utils.changify(self.__control)))
     self.__clock_domain = piw.clockdomain_ctl()
     self.__clock_domain.set_source(piw.makestring('*', 0L))
     self.__clock = piw.clocksink()
     self.__clock_domain.sink(self.__clock, 'FastPolicy')
     self.__upstream = None
     self.__backend = None
     self.__correlator = None
     self.__ctrl = None
     ConnectablePolicyImpl.__init__(self, atom, data_domain, init, clock,
                                    node.Server(transient=transient), False)
     self.data_node().set_change_handler(self.__slow_handler)
     self.data_node().set_data(self.get_domain().value2data(init))
예제 #4
0
 def __init__(self,atom,data_domain,init,transient,input,signal,stream_policy):
     self.__stream_policy = stream_policy
     self.__input = input
     self.__signal = signal
     self.__ctrl = None
     policy.ConnectablePolicyImpl.__init__(self,atom,data_domain,init,True,node.Server(transient=transient),False)
     self.data_node().set_change_handler(self.__change)
예제 #5
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,names='midi input',signature=version,container=6,ordinal=ordinal)

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*',0))
        self.set_private(node.Server(value=piw.makestring('[]',0), change=self.__settrim))

        self[1] = bundles.Output(1,False,names='key output')
        self[2] = bundles.Output(1,False,names='continuous controller output')
        self[8] = bundles.Output(1,False,names='program change output')
        self[10] = bundles.Output(1,False,names='trigger output')

        self.key_output = bundles.Splitter(self.domain,self[1])
        self.cc_output = bundles.Splitter(self.domain,self[2])
        self.programchange_output = bundles.Splitter(self.domain,self[8])
        self.trigger_output = bundles.Splitter(self.domain,self[10])

        self[6] = bundles.Output(1,False,names='midi output')
        self[7] = bundles.Output(2,False,names='midi clock output')
        self.midi_output = bundles.Splitter(self.domain,self[6],self[7])

        self[3] = VirtualKey()
        self[4] = VirtualCC()
        self[9] = VirtualProgramChange()
        self[11] = VirtualTrigger()
        self[5] = MidiPort(self.key_output.cookie(),self.cc_output.cookie(),self.programchange_output.cookie(),self.trigger_output.cookie(),self.midi_output.cookie())

        self.add_verb2(2,'choose([],None,role(None,[ideal([~server,midiport]),singular]))',self.__chooseport)
        self.add_verb2(3,'invert([],None,role(None,[cmpdsc(~(s)"#2")]))', self.__invert);
        self.add_verb2(4,'minimise([],None,role(None,[cmpdsc(~(s)"#2")]),option(to,[numeric]))', self.__setmin);
        self.add_verb2(5,'maximise([],None,role(None,[cmpdsc(~(s)"#2")]),option(to,[numeric]))', self.__setmax);

        self.set_ordinal(ordinal)
예제 #6
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,signature=version,names='clicker',container=3,ordinal=ordinal)
        self.domain = piw.clockdomain_ctl()
        accent = wav_resource('accent.wav')
        beat = wav_resource('beat.wav')

        self[1] = bundles.Output(1,True,names='audio output')
        self.output = bundles.Splitter(self.domain, self[1])
        self.clicker = loop_native.clicker(self.output.cookie(),self.domain,accent,beat)
        self.input = bundles.ScalarInput(self.clicker.cookie(), self.domain, signals=(1,2))

        self[2] = atom.Atom()
        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='bar beat input')

        self.add_verb2(1,'play([],None)',self.__play,status_action=self.__status)
        self.add_verb2(2,'play([un],None)',self.__unplay,status_action=self.__status)
        self.add_verb2(3,'play([toggle],None)',self.__toggle,status_action=self.__status)
        
        self[4]=bundles.Output(1,False,names='status output')
        self.light_output=bundles.Splitter(self.domain,self[4])
        self.lights=piw.lightsource(piw.change_nb(),0,self.light_output.cookie())
        self.lights.set_size(1)
        self.lights.set_status(1,const.status_inactive)
        self.__playstate = node.Server(value=piw.makebool(True,0),change=self.__playchanged)
        self.set_private(self.__playstate)
        self.__playing=False
예제 #7
0
 def __init__(self, scheduler, index):
     atom.Atom.__init__(self,
                        domain=domain.Aniso(),
                        policy=policy.FastReadOnlyPolicy(),
                        protocols='timeline')
     self.event = piw.event(scheduler.scheduler, False,
                            utils.changify(self.__enable_changed))
     self.__private = node.Server()
     self.__private[1] = node.Server(value=piw.makestring('', 0),
                                     change=self.__change_schema)
     self.__private[2] = node.Server(value=piw.makebool(False, 0),
                                     change=self.__change_enabled)
     self.scheduler = scheduler
     self.set_private(self.__private)
     self.get_policy().set_source(self.event.fastdata())
     self.index = index
예제 #8
0
 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.__ctrl = None
     policy.ConnectablePolicyImpl.__init__(self,atom,data_domain,init,clocked,node.Server(transient=transient),False)
예제 #9
0
    def __init__(self,address, ordinal):
        agent.Agent.__init__(self,signature=version,names='rig manager',container=1,ordinal=ordinal)

        self.__instances = container.PersistentFactory(asserted=self.__inst_asserted,retracted=self.__inst_retracted)
        self.__agentd = node.Server(value=piw.makestring('',0), change=self.__setagentd)
        self.__state = node.Server()
        self.__state[1] = self.__agentd
        self.__state[2] = self.__instances
        self.set_private(self.__state)

        self.add_verb2(1,'create([],None,role(None,[abstract,matches([rig])]))', self.__create_inst)
        self.add_verb2(2,'create([un],None,role(None,[concrete,issubject(create,[role(by,[cnc(~self)])])]))',callback=self.__uncreate_inst)
        self.add_verb2(3,'load([],None,role(None,[abstract]),option(with,[concrete,proto(agentfactory),singular]))', self.__create_tmpl)
        self.add_verb2(4,'use([],None,role(None,[concrete,proto(agentfactory),singular]))', self.__use)
#        self.add_verb2(5,'set([],None,role(None,[abstract,matches([icon])]),role(of,[concrete,singular,issubject(create,[role(by,[cnc(~server)])])]),role(to,[ideal([~server,icon]),singular])   )',self.__do_icon)
        self.add_verb2(6,'save([],None,role(None,[concrete,singular,issubject(create,[role(by,[cnc(~server)])])]),role(as,[abstract]))', self.__save_inst)

        self.__bucket = []
예제 #10
0
    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)
예제 #11
0
 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())
예제 #12
0
 def __init__(self,atom,data_domain,init,transient,input,signal,stream_policy,merge=False):
     self.__stream_policy = stream_policy
     self.__merge = merge
     self.__input = input
     self.__signal = signal
     self.__static_data = FastSender()
     self.__ctrl = None
     policy.ConnectablePolicyImpl.__init__(self,atom,data_domain,init,True,node.Server(transient=transient),False)
     self.data_node().set_change_handler(self.__change)
     self.__plumb_static()
예제 #13
0
 def __init__(self,agent,controller,index):
     atom.Atom.__init__(self,creator=self.__create,wrecker=self.__wreck,ordinal=index,names='key')
     self.__event = piw.fasttrigger(const.light_unknown)
     self.__event.attach_to(controller,index)
     self.__handler = piw.change2_nb(self.__event.trigger(),utils.changify(self.event_triggered))
     self.key_aggregator = piw.aggregator(agent.light_aggregator.get_output(index+1),agent.domain)
     self.agent = agent
     self.index = index
     self.set_private(node.Server(value=piw.makelong(3,0),change=self.__change_color))
     self.set_internal(250,atom.Atom(domain=domain.Trigger(),init=False,names='activate',policy=policy.TriggerPolicy(self.__handler),transient=True))
예제 #14
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self, signature=version,names='cycler',container=10,ordinal=ordinal)

        self.set_private(node.Server())
        self.get_private()[1]=node.Server(change=self.__cycle_set,value=piw.makebool(True,0))
        self.get_private()[2]=node.Server(change=self.__invert_set,value=piw.makebool(False,0))

        self[2] = atom.Atom(names='outputs')
        self[2][2] = bundles.Output(2,False,names='pressure output')
        self[2][3] = bundles.Output(3,False,names='roll output')
        self[2][4] = bundles.Output(4,False,names='yaw output')
        self[2][5] = bundles.Output(5,False,names='scale note output')
        self[2][6] = bundles.Output(6,False,names='frequency output')
        self[2][7] = bundles.Output(16,False,names='damper output')

        self[3] = atom.Atom(names="cycling",domain=domain.Bool(),init=True,policy=atom.default_policy(self.__setcycling))

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*',0))
        self.main_output = bundles.Splitter(self.domain,self[2][2],self[2][3],self[2][4],self[2][5],self[2][6])
        self.damp_output = bundles.Splitter(self.domain,self[2][7])
        self.cycler = piw.cycler(self.domain,32,self.main_output.cookie(),self.damp_output.cookie(),False)
        self.input = bundles.VectorInput(self.cycler.main_cookie(),self.domain,signals=(2,3,4,5,6,16,17),threshold=5)
        self.feedback = bundles.VectorInput(self.cycler.feedback_cookie(),self.domain,signals=(1,),threshold=5)

        self.cycler.set_cycle(True)
        self.cycler.set_maxdamp(1.0)
        self.cycler.set_invert(True)
        self.cycler.set_curve(1.0)

        self[1] = atom.Atom(names='inputs')
        self[1][2]=atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.input.vector_policy(2,False),names='pressure input')
        self[1][3]=atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.input.vector_policy(3,False),names='roll input')
        self[1][4]=atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.input.vector_policy(4,False),names='yaw input')
        self[1][5]=atom.Atom(domain=domain.BoundedFloat(0,1000),policy=self.input.vector_policy(5,False),names='scale note input')
        self[1][6]=atom.Atom(domain=domain.BoundedFloat(0,96000),policy=self.input.vector_policy(6,False),names='frequency input')
        self[1][7]=atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.feedback.vector_policy(1,False,clocked=False),names='feedback input')
        self[1][8]=atom.Atom(domain=domain.BoundedFloat(0,1),init=0.0,policy=self.input.linger_policy(16,False),names='damper pedal input',container=(None,'damper',self.verb_container()))
        self[1][10]=atom.Atom(domain=domain.BoundedFloat(0,1,hints=(T('stageinc',0.01),T('inc',0.01),T('biginc',0.1),T('control','updown'))),init=1.0,policy=atom.default_policy(self.__setmaxdamp),names='damper maximum input')
        self[1][12]=atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.input.latch_policy(17,False),names='hold pedal input')
        self[1][13]=atom.Atom(domain=domain.BoundedFloat(0.1,10,hints=(T('stageinc',0.1),T('inc',0.1),T('biginc',1),T('control','updown'))),init=1,names="damper curve",policy=atom.default_policy(self.__setdcurve))

        self[4] = atom.Atom(names="inverted damper",domain=domain.Bool(),init=True,policy=atom.default_policy(self.__setinverted))
예제 #15
0
    def __init__(self, parent, name):
        atom.Null.__init__(self,
                           names=None,
                           container=(None, 'browse', parent.verb_container()))
        self.parent = parent
        self.model = BrowseModel(self)
        self.virtual = BrowseSelection(self.model.resolve)

        self[1] = (self.virtual)
        self.add_verb2(1,
                       'show([],None,role(None,[abstract]))',
                       callback=self.changeDir)
        self.add_verb2(2, 'cancel([],None)', callback=self.root)
        self.add_verb2(3, 'show([un],None)', callback=self.back)
        self.add_verb2(4, 'clear([],None)', callback=self.clear)
        self.__target = node.Server(change=self.__target_changed)
        self.set_private(node.Server())
        self.get_private()[1] = self.__target
        self.__t = ''
        self.__setup_target()
예제 #16
0
파일: bundles.py 프로젝트: tylerwood/EigenD
 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
     policy.ConnectablePolicyImpl.__init__(self, atom, data_domain, init,
                                           clocked,
                                           node.Server(transient=transient),
                                           False)
     self.data_node().set_change_handler(self.__change)
예제 #17
0
    def __init__(self, fast, text, index):
        self.__index = index

        self.__fastdata = piw.fastdata(0)
        piw.tsd_fastdata(self.__fastdata)
        self.__fastdata.set_upstream(fast)
        atom.Atom.__init__(self,
                           domain=domain.Aniso(),
                           policy=policy.FastReadOnlyPolicy())
        self.get_policy().set_source(self.__fastdata)
        self.set_private(
            node.Server(value=piw.makestring(text, 0), change=self.__change))
예제 #18
0
    def __init__(self,agent,index):
        self.agent = agent
        self.__fastdata = bundles.FastSender()
        collection.Collection.__init__(self,domain=domain.Aniso(),policy=policy.FastReadOnlyPolicy(),creator=self.__create,wrecker=self.__wreck,ordinal=index,names='row',protocols='hidden-connection remove explicit')
        self.get_policy().set_source(self.__fastdata)
        self.get_policy().set_clock(self.agent.model.get_clock())

        self.set_private(node.static(_1=node.Server(change=self.__changetarget)))
        self.target = self.get_private()[1]

        if index is not None:
            self.__changetarget(piw.makelong(index-1,0))
예제 #19
0
    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)))
예제 #20
0
    def __init__(self, callback):
        node.Server.__init__(self, rtransient=True)
        self.__buffer = []
        self.__current = ''
        self.__next = 1
        self.__callback = callback
        self.__recogniser = language_native.wordrec(
            utils.changify(self.__keyinput))

        for h in range(0, self.history):
            self[h + 1] = node.Server()

        self.__setup()
예제 #21
0
 def __init__(self,
              atom,
              data_domain,
              init,
              transient,
              handler,
              stream_policy=None,
              clock=False):
     self.__stream_policy = stream_policy or ThrottleStreamPolicy(500)
     self.__handler = utils.weaken(handler)
     self.__clock_domain = piw.clockdomain_ctl()
     self.__clock_domain.set_source(piw.makestring('*', 0L))
     ConnectablePolicyImpl.__init__(self, atom, data_domain, init, clock,
                                    node.Server(transient=transient), False)
     self.data_node().set_change_handler(self.__slow_handler)
     self.data_node().set_data(self.get_domain().value2data(init))
예제 #22
0
    def __init__(self, manager, index, name="", value=""):
        self.__manager = manager
        self.__index = index
        self.name = ""
        self.value = ""
        bundles.Output.__init__(self, 1, False)
        self.__output = bundles.Splitter(self.__manager.agent.domain, self)
        self.__lights = piw.lightsource(piw.change_nb(), 0,
                                        self.__output.cookie())
        self.__private = node.Server(change=self.__change)
        self.set_private(self.__private)
        self.__alternatives = []

        if name:
            self.set_name(name)
            self.set_value(value)
예제 #23
0
파일: atom.py 프로젝트: shamharoth/EigenD
    def __init__(self, container):
        self.__func = piw.indirectchange()
        Bool.__init__(self,
                      False,
                      transient=True,
                      protocols='deferred',
                      policy=policy.FastPolicy(self.__func,
                                               policy.TriggerStreamPolicy(),
                                               clock=False))

        self.__private = node.Server(value=piw.makestring('', 0),
                                     change=self.__change)
        self.set_private(self.__private)
        self.container = container
        self.index = 0
        self.label = None
        self.ctx = None
        self.args = None
        self.status = None
예제 #24
0
    def __init__(self, agent, controller, index):
        collection.Collection.__init__(
            self,
            creator=self.__create,
            wrecker=self.__wreck,
            ordinal=index,
            names='key',
            protocols='hidden-connection remove explicit')
        self.__event = piw.fasttrigger(const.light_unknown)
        self.__event.attach_to(controller, index)
        self.__handler = piw.change2_nb(self.__event.trigger(),
                                        utils.changify(self.event_triggered))

        self.key_mapper = piw.function1(
            True, 2, 2, piw.data(),
            agent.light_aggregator.get_output(index + 1))
        self.key_mapper.set_functor(
            piw.d2d_const(utils.maketuple_longs((0, 0), 0)))
        self.key_aggregator = piw.aggregator(self.key_mapper.cookie(),
                                             agent.domain)

        self.agent = agent
        self.index = index

        self.set_private(node.Server(
            rtransient=True))  # kept in there for backwards compatibility
        self.set_internal(
            250,
            atom.Atom(domain=domain.Trigger(),
                      init=False,
                      names='activate',
                      policy=policy.TriggerPolicy(self.__handler),
                      transient=True))

        self.set_internal(
            247,
            atom.Atom(domain=domain.BoundedInt(0, 3),
                      names='default colour',
                      init=3,
                      policy=atom.default_policy(self.set_color)))
        self.set_internal(
            248,
            atom.Atom(domain=domain.BoundedInt(-32767, 32767),
                      names='key column',
                      init=0,
                      policy=atom.default_policy(self.__change_key_column)))
        self.set_internal(
            249,
            atom.Atom(domain=domain.BoundedInt(-32767, 32767),
                      names='key row',
                      init=0,
                      policy=atom.default_policy(self.__change_key_row)))
        self.set_internal(
            245,
            atom.Atom(domain=domain.Bool(),
                      names='key column end relative',
                      init=False,
                      policy=atom.default_policy(
                          self.__change_key_column_endrel)))
        self.set_internal(
            246,
            atom.Atom(domain=domain.Bool(),
                      names='key row end relative',
                      init=False,
                      policy=atom.default_policy(
                          self.__change_key_row_endrel)))

        self.agent.light_convertor.set_status_handler(
            self.index, self.__make_key_coordinate(),
            piw.slowchange(utils.changify(self.set_status)))
예제 #25
0
 def __init__(self, atom, data_domain, init, transient):
     self.__datanode = node.Server(transient=transient)
예제 #26
0
 def __init__(self, atom, data_domain, init, transient):
     self.__data_domain = data_domain
     self.__datanode = node.Server(transient=transient)
     atom.set_property_string('domain', str(data_domain))
예제 #27
0
    def __init__(self, name):
        agent.Agent.__init__(self,
                             signature=upgrade.Signature(),
                             names='eigenbrowser',
                             volatile=True)

        self.name = name
        self.node = random.randrange(0, 1 << 48L) | 0x010000000000L

        self.langModel = gui.call_bg_sync(self.__create_lang)
        self.historyModel = history.HistoryModel(self.langModel)
        self.cdomain = piw.clockdomain_ctl()
        self.cdomain.set_source(piw.makestring('*', 0))

        self.scroller1 = Scroller2(
            self.__scroll1)  # scrolls the left hand pane
        self.scroller2 = Scroller(
            self.__scroll2, self.__tap2)  # scrolls the right hand (dinfo) pane
        self.scroller3 = Scroller(self.__scroll3,
                                  self.__tap3)  # scrolls the path pane

        self.scroller_in1 = bundles.VectorInput(self.scroller1.cookie(),
                                                self.cdomain,
                                                signals=(1, 2, 3))
        self.scroller_in2 = bundles.VectorInput(self.scroller2.cookie(),
                                                self.cdomain,
                                                signals=(1, 2, 3))
        self.scroller_in3 = bundles.VectorInput(self.scroller3.cookie(),
                                                self.cdomain,
                                                signals=(1, 2, 3))

        nudge = (T('inc', 0.1), )
        self[1] = atom.Atom(domain=domain.BoundedFloat(-1, 1, hints=nudge),
                            init=0,
                            names='sideways nudger',
                            ordinal=1,
                            policy=self.scroller_in1.vector_policy(1, False))
        #self[2] = atom.Atom(domain=domain.BoundedFloat(-1,1,hints=nudge), init=0, names='vertical nudger', ordinal=1, policy=self.scroller_in1.vector_policy(2,False),rtransient=True)
        self[2] = atom.Atom(domain=domain.BoundedFloat(-1, 1, hints=nudge),
                            init=0,
                            names='vertical nudger',
                            ordinal=1,
                            policy=self.scroller_in1.vector_policy(2, False))

        self[3] = atom.Atom(domain=domain.BoundedFloat(-1, 1, hints=nudge),
                            init=0,
                            names='sideways nudger',
                            ordinal=2,
                            policy=self.scroller_in2.vector_policy(1, False))
        self[4] = atom.Atom(domain=domain.BoundedFloat(-1, 1, hints=nudge),
                            init=0,
                            names='vertical nudger',
                            ordinal=2,
                            policy=self.scroller_in2.vector_policy(2, False))

        self[8] = browse.BrowseAgent(self, browse.getName())

        self.add_verb2(1,
                       'browse([],None,role(None,[proto(browse),singular]))',
                       callback=self.__do_browse)
        self.add_verb2(2, 'minimise([],None)', callback=self.__minimise)
        self.add_verb2(3, 'maximise([],None)', callback=self.__maximise)

        self.font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)
        self.font.SetPointSize(fonts.DEFAULT_PTS)

        self[12] = atom.Atom(domain=domain.BoundedInt(5, 20, rest=11),
                             names='text',
                             policy=atom.default_policy(self.__set_fontsize))
        self[15] = atom.Atom(domain=domain.BoundedFloat(-1, 1, hints=nudge),
                             init=-1,
                             names='sideways nudger',
                             ordinal=3,
                             policy=self.scroller_in3.vector_policy(1, False))
        self[16] = atom.Atom(domain=domain.BoundedFloat(-1, 1, hints=nudge),
                             init=-1,
                             names='vertical nudger',
                             ordinal=3,
                             policy=self.scroller_in3.vector_policy(2, False))
        self[17] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                             init=0,
                             names='tapper',
                             ordinal=1,
                             policy=self.scroller_in1.vector_policy(3, False))
        self[18] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                             init=0,
                             names='tapper',
                             ordinal=2,
                             policy=self.scroller_in2.vector_policy(3, False))
        self[19] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                             init=0,
                             names='tapper',
                             ordinal=3,
                             policy=self.scroller_in3.vector_policy(3, False))

        self.__size = node.Server(change=self.__size_changed)
        self.set_private(node.Server())
        self.get_private()[1] = self.__size
        self.__x = 100
        self.__y = 100
        self.__setup_size()

        self.__minX = 60
        self.__minY = 80
        self.__maxX = 100
        self.__maxY = 100

        self.__rootFrame = None
        self.__createRootFrame()

        #        self.scroller2.reset(-1,-1)
        self.scroller3.reset(-1, 1)
        self.scroller1.set_scheme(1)

        self.scroller1.enable()
        self.scroller2.enable()
        self.scroller3.enable()
예제 #28
0
    def __init__(self, name):
        agent.Agent.__init__(self,
                             signature=upgrade.Signature(),
                             volatile=True,
                             names='eigencommander',
                             ordinal=1)

        self.name = name
        self.node = random.randrange(0, 1 << 48L) | 0x010000000000L

        self.langModel = gui.call_bg_sync(self.__create_lang)
        self.historyModel = history.HistoryModel(self.langModel)
        self.commandModel = command.CommandModel(self.langModel)
        self.dictionaryModel = dictionary.DictionaryModel(self.langModel)

        self.cdomain = piw.clockdomain_ctl()
        self.cdomain.set_source(piw.makestring('*', 0))

        self[25] = scroller.Scroller(self.__scroll1,
                                     self.__tap1,
                                     names="scroller",
                                     ordinal=1)  # scrolls the dictionary pane
        self[26] = scroller.Scroller(self.__scroll2,
                                     self.__tap2,
                                     names="scroller",
                                     ordinal=2)  # scrolls the history pane

        self.scroller_clone = piw.clone(True)
        self.scroller_clone.set_output(1, self[25].cookie())
        self.scroller_clone.set_output(2, self[26].cookie())

        self.scroller_in = bundles.VectorInput(self.scroller_clone.cookie(),
                                               self.cdomain,
                                               signals=(1, 2, 3, 4))

        self[28] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                             init=0,
                             names='roll',
                             policy=self.scroller_in.merge_policy(2, False))
        self[29] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                             init=0,
                             names='yaw',
                             policy=self.scroller_in.merge_policy(1, False))
        self[30] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                             init=0,
                             names='key',
                             policy=self.scroller_in.vector_policy(3, False))
        self[31] = atom.Atom(domain=domain.Aniso(),
                             names='controller',
                             policy=self.scroller_in.merge_policy(4, False))

        self[9] = dictionary.DictionaryAgent(self, dictionary.getName())

        self.add_verb2(2, 'minimise([],None)', callback=self.__minimise)
        self.add_verb2(3, 'maximise([],None)', callback=self.__maximise)

        self.font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)
        self.font.SetPointSize(fonts.DEFAULT_PTS)

        self[12] = atom.Atom(domain=domain.BoundedInt(5, 20, rest=11),
                             names='text',
                             protocols='nostage',
                             policy=atom.default_policy(self.__set_fontsize))

        self.__size = node.Server(change=self.__size_changed)
        self.set_private(node.Server())
        self.get_private()[1] = self.__size
        self.__x = 100
        self.__y = 100
        self.__setup_size()

        self.__minX = 60
        self.__minY = 80
        self.__maxX = 100
        self.__maxY = 100

        self.__rootFrame = None
        self.__createRootFrame()

        self[25].reset(1, -1)
        self[26].reset(-1, 1)

        self[25].enable()
        self[26].enable()