Пример #1
0
    def __init__(self, database, master_agent, ordinal):
        agent.Agent.__init__(self,
                             names='controller',
                             signature=version,
                             subsystem='controller',
                             container=2,
                             protocols='is_subsys',
                             ordinal=ordinal)
        self.database = database
        self.agent = master_agent
        self.domain = master_agent.domain

        self.add_verb2(1,
                       'control([],None,role(None,[concrete,singular]))',
                       callback=self.__control)
        self.add_verb2(
            2,
            'control([],None,role(None,[concrete,singular]),role(with,[numeric]))',
            callback=self.__controlwith)
        self.add_verb2(3, 'control([un],None)', callback=self.__uncontrol)

        self[4] = atom.Atom(creator=self.__create, wrecker=self.__wreck)

        self[3] = bundles.Output(1,
                                 False,
                                 names='light output',
                                 protocols='revconnect')
        self.lights = bundles.Splitter(self.domain, self[3])
        self.lightconvertor = piw.lightconvertor(self.lights.cookie())
        self.controller = Controller0(self, self.lightconvertor.cookie(),
                                      utils.pack_str(1, 2, 3, 4, 5))
        self.clone = piw.clone(True)
        self.clone.set_output(1, self.controller.cookie())
        self.input = bundles.VectorInput(self.clone.cookie(),
                                         self.domain,
                                         signals=(1, 2, 3, 4, 5))

        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(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(-1, 1),
                               policy=self.input.vector_policy(5, False),
                               names='strip position input')
Пример #2
0
    def __init__(self,address,ordinal):
        agent.Agent.__init__(self, signature=version,names='audio',container=9,ordinal=ordinal)
        self.domain = piw.clockdomain_ctl()

        self.__timestamp = 0

        self.output = bundles.Splitter(self.domain)
        self[2] = AudioOutputList(self,'outputs')

        self.clone = piw.clone(True)
        self.audio = AudioDelegate(self,self.domain)
        self.recorder = piw.wavrecorder(self.domain)
        self.clone.set_output(1,self.audio.cookie())
        self.clone.set_output(2,self.recorder.cookie())
        self.input = bundles.ScalarInput(self.clone.cookie(),self.domain,signals=(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64),threshold=0)
        self.__loading = False

        self[1] = AudioInputList(self)
        self[1].create_channel(1)
        self[1].create_channel(2)

        self[3] = atom.Atom(domain=domain.EnumOrNull(44100,48000,96000), names='sample rate', protocols='bind set', policy=atom.default_policy(self.__change_sample_rate),container=(None,'sample rate',self.verb_container()))
        self[3].add_verb2(1,'set([],~a,role(None,[instance(~self)]),role(to,[numeric]))',callback=self.__set_sample_rate)
        self[3].add_verb2(2,'set([un],~a,role(None,[instance(~self)]))',callback=self.__unset_sample_rate)

        self[4] = atom.Atom(domain=domain.BoundedIntOrNull(0,64), names='input channels', protocols='output', policy=policy.ReadOnlyPolicy())
        self[5] = atom.Atom(domain=domain.BoundedIntOrNull(0,64), names='output channels', protocols='output', policy=policy.ReadOnlyPolicy())

        self[7] = Port(self)

        self[8] = atom.Atom(domain=domain.BoundedIntOrNull(0,3072,0), names='buffer size', protocols='bind set', policy=atom.default_policy(self.__change_buffer_size),container=(None,'buffer size',self.verb_container()))
        self[8].add_verb2(1,'set([],~a,role(None,[instance(~self)]),role(to,[numeric]))',callback=self.__set_buffer_size)
        self[8].add_verb2(2,'set([un],~a,role(None,[instance(~self)]))',callback=self.__unset_buffer_size)

        self.add_verb2(1,'mute([],None)', self.__mute)
        self.add_verb2(2,'mute([un],None)', self.__unmute)
        self.add_verb2(3,'choose([],None,role(None,[ideal([~server,port]),singular]))',self.__choose)
        self.add_verb2(4,'create([],None,role(None,[mass([input])]))', self.__create_input)
        self.add_verb2(5,'create([un],None,role(None,[mass([input])]))', self.__uncreate_input)
        self.add_verb2(6,'create([],None,role(None,[mass([output])]))', self.__create_output)
        self.add_verb2(7,'create([un],None,role(None,[mass([output])]))', self.__uncreate_output)

        self.enum()

        self.__filename = resource.new_resource_file('Audio','audio.wav')
        self.recorder.setfile(self.__filename)

        self[10] = atom.Atom(domain=domain.Bool(),init=False,transient=True,policy=policy.FastPolicy(self.recorder.record(),policy.TriggerStreamPolicy()),protocols='nostage',names='recorder running input')

        self[2].channels_changed()
Пример #3
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             names='controller',
                             signature=version,
                             ordinal=ordinal,
                             protocols='controller')

        self.domain = piw.clockdomain_ctl()

        self[4] = ConnectorList(self)

        self[3] = bundles.Output(1,
                                 False,
                                 names='light output',
                                 protocols='revconnect')
        self.lights = bundles.Splitter(self.domain, self[3])
        self.lightconvertor = piw.lightconvertor(False, self.lights.cookie())
        self.controller = Controller0(self, self.lightconvertor.cookie(),
                                      utils.pack_str(1, 2, 3, 4, 5, 6))
        self.clone = piw.clone(True)
        self.clone.set_output(1, self.controller.event_cookie())
        self.input = bundles.VectorInput(self.clone.cookie(),
                                         self.domain,
                                         signals=(1, 2, 3, 4, 5, 6))

        self[1] = atom.Atom(names='inputs')
        self[1][2] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.input.vector_policy(3, False),
                               names='pressure input')
        self[1][3] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.vector_policy(4, False),
                               names='roll input')
        self[1][4] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.vector_policy(5, False),
                               names='yaw input')
        self[1][5] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.vector_policy(6, False),
                               names='strip position input')
        self[1][6] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.vector_policy(1, False),
                               names='key input')
        self[1][7] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.merge_nodefault_policy(
                                   2, False),
                               names='controller input')

        self.add_verb2(1, 'create([],None,role(None,[mass([connector])]))',
                       self.__create_connector)
        self.add_verb2(2, 'create([un],None,role(None,[mass([connector])]))',
                       self.__uncreate_connector)
Пример #4
0
    def __init__(self, address, ordinal):
        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*',0))

        agent.Agent.__init__(self, signature=version, names='stringer',protocols='bind set',container=(5,'stringer',atom.VerbContainer(clock_domain=self.domain)),ordinal=ordinal)
        
        self[1] = atom.Atom(names='outputs')
        self[1][1] = bundles.Output(1,False, names='controller output', continuous=True)
        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='key output', protocols='')

        self.output = bundles.Splitter(self.domain,self[1][2],self[1][3],self[1][4],self[1][5])
        self.coutput = bundles.Splitter(self.domain,self[1][1])

        # stringer
        self.stringer = piw.stringer(self.output.cookie())

        # clone controller input to copy it to an output and the stringer
        self.cclone = piw.clone(True) 
        self.cclone.set_output(1,self.coutput.cookie())

        self.ctl_input = bundles.VectorInput(self.cclone.cookie(),self.domain,signals=(1,))
        self.data_input = bundles.VectorInput(self.stringer.data_cookie(),self.domain,signals=(2,3,4,5))

        self[4]=atom.Atom(names='inputs')
        self[4][1]=atom.Atom(domain=domain.Aniso(),policy=self.ctl_input.vector_policy(1,False),names='controller input')
        self[4][2]=atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.data_input.merge_policy(2,False),names='pressure input',protocols='nostage')
        self[4][3]=atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.data_input.merge_policy(3,False),names='roll input',protocols='nostage')
        self[4][4]=atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.data_input.merge_policy(4,False),names='yaw input',protocols='nostage')
        self[4][5]=atom.Atom(domain=domain.Aniso(),policy=self.data_input.vector_policy(5,False), names='key input')

        # self[5] is the verb container

        # enable, to deactivate the stringer
        self[6] = atom.Atom(domain=domain.Bool(),init=True,names="enable",policy=atom.default_policy(self.__enable))

        # status output to drive the talker lights
        self[7]=bundles.Output(1,False,names='status output')
        self.light_output=bundles.Splitter(self.domain,self[7])
        self.lights=piw.lightsource(piw.change_nb(),0,self.light_output.cookie())
        self.lights.set_size(1)
        self.__set_lights(self[6].get_value())

        # toggle enable verb, has status action to ensure the status output will be connected to a talker
        self.add_verb2(1,'enable([toggle],None)',callback=self.__toggle_enable,status_action=self.__status)
Пример #5
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self, signature=version, names='kmapper', icon='plg_simple/kgroup.png',container=17,ordinal=ordinal)

        self.__cur_size = 0
        self.__choices=[]
        self.__coursekeys=[]
        self.__course=1

        self.__private = node.Server(value=piw.makestring('[]',0),change=self.__set_members)
        self.set_private(self.__private)

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

        self.mapper = piw.kgroup_mapper()

        self[1] = bundles.Output(1,False, names='light output',protocols='revconnect')

        self.loutput = bundles.Splitter(self.domain,self[1])
        self.lmapper = piw.clone(True)
        self.lmapper.set_filtered_output(1,self.loutput.cookie(),self.mapper.light_filter())
        self.lmux = piw.multiplexer(self.lmapper.cookie(),self.domain)

        self.linput = bundles.VectorInput(self.lmux.get_input(1),self.domain,signals=(1,))

        self[2] = atom.Atom(names='light input',protocols='revconnect',policy=self.linput.vector_policy(1,False,False),domain=domain.Aniso())

        self[3] = bundles.Output(1,False, names='strip position output',ordinal=1)
        self[4] = bundles.Output(2,False, names='strip position output',ordinal=2)
        self[5] = bundles.Output(3,False, names='breath output')

        self.soutput = bundles.Splitter(self.domain,self[3],self[4],self[5])
        self.sgate = piw.gate(self.soutput.cookie(),True)
        self.sinput = bundles.VectorInput(self.sgate.cookie(),self.domain,signals=(1,2,3))

        self[6] = atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.sinput.vector_policy(1,False),names='strip position input',ordinal=1)
        self[7] = atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.sinput.vector_policy(2,False),names='strip position input',ordinal=2)
        self[8] = atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.sinput.vector_policy(3,False),names='breath input')

        self[9] = bundles.Output(1,False, names='activation output')
        self[10] = bundles.Output(2,False, names='pressure output')
        self[11] = bundles.Output(3,False, names='roll output')
        self[12] = bundles.Output(4,False, names='yaw output')

        self.koutput = bundles.Splitter(self.domain,self[9],self[10],self[11],self[12])
        self.kpoly = piw.polyctl(10,self.koutput.cookie(),False,5)

        self.kclone = piw.clone(True)
        self.kclone.set_policy(False)
        self.kinput = bundles.VectorInput(self.kclone.cookie(),self.domain,signals=(1,2,3,4),filter=self.mapper.key_filter())

        self[13] = atom.Atom(domain=domain.BoundedFloat(0,1), policy=self.kinput.vector_policy(1,False), names='activation input')
        self[14] = atom.Atom(domain=domain.BoundedFloat(0,1), policy=self.kinput.vector_policy(2,False), names='pressure input')
        self[15] = atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.kinput.vector_policy(3,False), names='roll input')
        self[16] = atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.kinput.vector_policy(4,False), names='yaw input')

        self.kclone.set_output(1,self.kpoly.cookie())

        #self.add_verb2(2,'choose([],None,role(None,[matches([k])]),option(from,[numeric,singular]))',self.__choose2)
        #self.add_verb2(3,'choose([],None,role(None,[mass([k])]))',self.__choose3)
        #self.add_verb2(4,'clear([],None)',self.__clear)
        #self.add_verb2(5,'add([],None,role(None,[mass([k])]))',self.__add)

        self.add_verb2(7,'choose([],None,role(None,[matches([k])]),option(as,[numeric]))',self.__choose)
        self.add_verb2(8,'set([],None,role(None,[tagged_ideal([~server,course],[offset])]),role(to,[mass([semitone])]))',callback=self.__set_course_semi)
        self.add_verb2(9,'set([],None,role(None,[tagged_ideal([~server,course],[offset])]),role(to,[mass([interval])]))',callback=self.__set_course_int)
        self.add_verb2(12,'clear([],None,option(None,[mass([course])]))',self.__kclear)
        self.add_verb2(13,'add([],None,role(None,[mass([k])]),option(to,[mass([course])]))',self.__kadd)
        self.add_verb2(14,'add([],None,role(None,[mass([k])]),role(to,[mass([k])]),option(as,[mass([course])]))',self.__radd)

        self[20] = VirtualKey(lambda: self.__cur_size)

        self.statusbuffer = piw.statusbuffer(self.lmux.gate_input(),2,self.lmux.get_input(2))
        self.selgate = piw.functor_backend(1,True)
        self.kclone.set_output(2,self.selgate.cookie())

        self.statusbuffer.enable(1)
        self.kclone.enable(1,True)
        self.sgate.enable(True)

        self.__upstream_size = 0
        self.__set_poly()
        self[21] = atom.Atom(domain=domain.Aniso(),policy=atom.default_policy(self.__upstream),names='controller input')

        self[22] = VirtualChannel()
        
        self[23] = bundles.Output(1,False, names='controller output', continuous=True)
        self.coutput = bundles.Splitter(self.domain,self[23])
        self.controller = Controller(self.coutput.cookie())
        self.__private[2]=self.controller.state()
        self.cgate = piw.gate(self.controller.cookie(),True)
        self.cinput = bundles.ScalarInput(self.cgate.cookie(),self.domain,signals=(1,))
        self[24] = atom.Atom(domain=domain.Aniso(), policy=self.cinput.nodefault_policy(1,False),names='controller input')
        self[25] = VirtualCourse(self.controller)
Пример #6
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='audio',
                             icon='plg_macosx/audio.png',
                             container=9,
                             ordinal=ordinal)

        self.domain = piw.clockdomain_ctl()
        self.clone = piw.clone(True)
        self.audio = AudioDelegate(self, self.domain)
        self.recorder = piw.wavrecorder(self.domain)
        self.clone.set_output(1, self.audio.cookie())
        self.clone.set_output(2, self.recorder.cookie())
        self.input = bundles.ScalarInput(self.clone.cookie(),
                                         self.domain,
                                         signals=(1, 2),
                                         threshold=0)
        self.__loading = False

        self[1] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                            names='left input',
                            policy=self.input.nodefault_policy(1, True))
        self[2] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                            names='right input',
                            policy=self.input.nodefault_policy(2, True))
        self[3] = atom.Atom(
            domain=domain.EnumOrNull(44100, 48000, 96000),
            names='sample rate',
            protocols='bind set',
            policy=atom.default_policy(self.__change_sample_rate),
            container=(None, 'sample rate', self.verb_container()))
        self[3].add_verb2(
            1,
            'set([],~a,role(None,[instance(~self)]),role(to,[numeric]))',
            callback=self.__set_sample_rate)
        self[3].add_verb2(2,
                          'set([un],~a,role(None,[instance(~self)]))',
                          callback=self.__unset_sample_rate)
        self[7] = Port(self)
        self[8] = atom.Atom(
            domain=domain.BoundedIntOrNull(0, 3072, 0),
            names='buffer size',
            protocols='bind set',
            policy=atom.default_policy(self.__change_buffer_size),
            container=(None, 'buffer size', self.verb_container()))
        self[8].add_verb2(
            1,
            'set([],~a,role(None,[instance(~self)]),role(to,[numeric]))',
            callback=self.__set_buffer_size)
        self[8].add_verb2(2,
                          'set([un],~a,role(None,[instance(~self)]))',
                          callback=self.__unset_buffer_size)

        self.add_verb2(1, 'mute([],None)', self.__mute)
        self.add_verb2(2, 'mute([un],None)', self.__unmute)
        self.add_verb2(
            3, 'choose([],None,role(None,[ideal([~server,port]),singular]))',
            self.__choose)

        self.enum()

        self.__filename = resource.new_resource_file('audio', 'audio.wav')
        self.recorder.setfile(self.__filename)

        self[10] = atom.Atom(domain=domain.Bool(),
                             init=False,
                             transient=True,
                             policy=policy.FastPolicy(
                                 self.recorder.record(),
                                 policy.TriggerStreamPolicy()),
                             names='recorder running input')
Пример #7
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()
Пример #8
0
    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
Пример #9
0
    def __init__(self, address, ordinal):
        self.domain = piw.clockdomain_ctl()
        agent.Agent.__init__(self, signature=version, names='recorder', protocols='bind',icon='plg_recorder/recorder.png',container=(3,'agent',atom.VerbContainer(clock_domain=self.domain)),ordinal=ordinal)

        self[2] = atom.Atom()
        self[2][1] = bundles.Output(1,False,names='activation output', protocols='')
        self[2][2] = bundles.Output(2,False,names='pressure output', protocols='')
        self[2][3] = bundles.Output(3,False,names='roll output', protocols='')
        self[2][4] = bundles.Output(4,False,names='yaw output', protocols='')
        self[2][5] = bundles.Output(1,False,names='auxilliary output', ordinal=1, protocols='')
        self[2][6] = bundles.Output(1,False,names='auxilliary output', ordinal=2, protocols='')
        self[2][7] = bundles.Output(1,False,names='auxilliary output', ordinal=3, protocols='')
        self[2][8] = bundles.Output(1,False,names='auxilliary output', ordinal=4, protocols='')
        self[2][9] = bundles.Output(1,False,names='auxilliary output', ordinal=5, protocols='')
        self[2][10] = bundles.Output(1,False,names='auxilliary output', ordinal=6, protocols='')
        self[2][11] = bundles.Output(1,False,names='auxilliary output', ordinal=7, protocols='')
        self[2][12] = bundles.Output(1,False,names='auxilliary output', ordinal=8, protocols='')
        self[2][13] = bundles.Output(1,False,names='auxilliary output', ordinal=9, protocols='')
        self[2][14] = bundles.Output(1,False,names='auxilliary output', ordinal=10, protocols='')

        self.output_data = bundles.Splitter(self.domain,self[2][1],self[2][2],self[2][3],self[2][4])
        self.output_aux1 = bundles.Splitter(self.domain,self[2][5])
        self.output_aux2 = bundles.Splitter(self.domain,self[2][6])
        self.output_aux3 = bundles.Splitter(self.domain,self[2][7])
        self.output_aux4 = bundles.Splitter(self.domain,self[2][8])
        self.output_aux5 = bundles.Splitter(self.domain,self[2][9])
        self.output_aux6 = bundles.Splitter(self.domain,self[2][10])
        self.output_aux7 = bundles.Splitter(self.domain,self[2][11])
        self.output_aux8 = bundles.Splitter(self.domain,self[2][12])
        self.output_aux9 = bundles.Splitter(self.domain,self[2][13])
        self.output_aux10 = bundles.Splitter(self.domain,self[2][14])

        self.poly_data = piw.polyctl(poly_data_initial,self.output_data.cookie(),False,poly_data_headroom)
        self.poly_aux1 = piw.polyctl(poly_aux_initial,self.output_aux1.cookie(),False,poly_aux_headroom)
        self.poly_aux2 = piw.polyctl(poly_aux_initial,self.output_aux2.cookie(),False,poly_aux_headroom)
        self.poly_aux3 = piw.polyctl(poly_aux_initial,self.output_aux3.cookie(),False,poly_aux_headroom)
        self.poly_aux4 = piw.polyctl(poly_aux_initial,self.output_aux4.cookie(),False,poly_aux_headroom)
        self.poly_aux5 = piw.polyctl(poly_aux_initial,self.output_aux5.cookie(),False,poly_aux_headroom)
        self.poly_aux6 = piw.polyctl(poly_aux_initial,self.output_aux6.cookie(),False,poly_aux_headroom)
        self.poly_aux7 = piw.polyctl(poly_aux_initial,self.output_aux7.cookie(),False,poly_aux_headroom)
        self.poly_aux8 = piw.polyctl(poly_aux_initial,self.output_aux8.cookie(),False,poly_aux_headroom)
        self.poly_aux9 = piw.polyctl(poly_aux_initial,self.output_aux9.cookie(),False,poly_aux_headroom)
        self.poly_aux10 = piw.polyctl(poly_aux_initial,self.output_aux10.cookie(),False,poly_aux_headroom)

        self.output_clone = piw.clone(True)
        self.output_clone.set_filtered_output(2,self.poly_data.cookie(),piw.grist_deaggregation_filter2(2,100))
        self.output_clone.set_filtered_output(3,self.poly_aux1.cookie(),piw.grist_deaggregation_filter(3))
        self.output_clone.set_filtered_output(4,self.poly_aux2.cookie(),piw.grist_deaggregation_filter(4))
        self.output_clone.set_filtered_output(5,self.poly_aux3.cookie(),piw.grist_deaggregation_filter(5))
        self.output_clone.set_filtered_output(6,self.poly_aux4.cookie(),piw.grist_deaggregation_filter(6))
        self.output_clone.set_filtered_output(7,self.poly_aux5.cookie(),piw.grist_deaggregation_filter(7))
        self.output_clone.set_filtered_output(8,self.poly_aux6.cookie(),piw.grist_deaggregation_filter(8))
        self.output_clone.set_filtered_output(9,self.poly_aux7.cookie(),piw.grist_deaggregation_filter(9))
        self.output_clone.set_filtered_output(10,self.poly_aux8.cookie(),piw.grist_deaggregation_filter(10))
        self.output_clone.set_filtered_output(11,self.poly_aux9.cookie(),piw.grist_deaggregation_filter(11))
        self.output_clone.set_filtered_output(12,self.poly_aux10.cookie(),piw.grist_deaggregation_filter(12))

        self.output_aggregator = piw.aggregator(self.output_clone.cookie(), self.domain)

        self.player = recorder_native.kplayer(self.domain, 16, 9, self.output_aggregator.get_output(2))
        self.recorder = Recorder(self.domain,9)

        self.input_clone = piw.clone(True)
        self.input_clone.set_output(1,self.output_aggregator.get_output(1))
        self.input_clone.set_output(2,self.player.cookie())
        self.input_clone.set_output(3,self.recorder.cookie())

        self.input_aggregator = piw.aggregator(self.input_clone.cookie(), self.domain)

        self.input_clock = bundles.ScalarInput(self.input_aggregator.get_filtered_output(1,piw.grist_aggregation_filter(1)), self.domain, signals=(1,2,3))
        self.input_clock.add_upstream(self.verb_container().clock)

        self.input_poly = piw.polyctl(10,self.input_aggregator.get_filtered_output(2,piw.grist_aggregation_filter(2)), False,5)
        self.input_data = bundles.VectorInput(self.input_poly.cookie(), self.domain, signals=(1,2,3,4))

        self.input_aux1 = bundles.VectorInput(self.input_aggregator.get_filtered_output(3,piw.grist_aggregation_filter(3)), self.domain, signals=(1,))
        self.input_aux2 = bundles.VectorInput(self.input_aggregator.get_filtered_output(4,piw.grist_aggregation_filter(4)), self.domain, signals=(1,))
        self.input_aux3 = bundles.VectorInput(self.input_aggregator.get_filtered_output(5,piw.grist_aggregation_filter(5)), self.domain, signals=(1,))
        self.input_aux4 = bundles.VectorInput(self.input_aggregator.get_filtered_output(6,piw.grist_aggregation_filter(6)), self.domain, signals=(1,))
        self.input_aux5 = bundles.VectorInput(self.input_aggregator.get_filtered_output(7,piw.grist_aggregation_filter(7)), self.domain, signals=(1,))
        self.input_aux6 = bundles.VectorInput(self.input_aggregator.get_filtered_output(8,piw.grist_aggregation_filter(8)), self.domain, signals=(1,))
        self.input_aux7 = bundles.VectorInput(self.input_aggregator.get_filtered_output(9,piw.grist_aggregation_filter(9)), self.domain, signals=(1,))
        self.input_aux8 = bundles.VectorInput(self.input_aggregator.get_filtered_output(10,piw.grist_aggregation_filter(10)), self.domain, signals=(1,))
        self.input_aux9 = bundles.VectorInput(self.input_aggregator.get_filtered_output(11,piw.grist_aggregation_filter(11)), self.domain, signals=(1,))
        self.input_aux10 = bundles.VectorInput(self.input_aggregator.get_filtered_output(12,piw.grist_aggregation_filter(12)), self.domain, signals=(1,))

        self.nplayer = recorder_native.nplayer(self.output_aggregator.get_filtered_output(3,piw.gristchaff_aggregation_filter(100,3)),16,2,self.domain)
        self.input_clock.add_upstream(self.nplayer.get_clock())

        self[1] = atom.Atom()

        self[1][1]=atom.Atom(domain=domain.BoundedFloat(0,1), policy=self.input_data.vector_policy(1,False),names='activation input')
        self[1][2]=atom.Atom(domain=domain.BoundedFloat(0,1), policy=self.input_data.vector_policy(2,False),names='pressure input')
        self[1][3]=atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.input_data.vector_policy(3,False),names='roll input')
        self[1][4]=atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.input_data.vector_policy(4,False),names='yaw input')

        self[1][5]=atom.Atom(domain=domain.Aniso(), policy=self.input_aux1.vector_policy(1,False),names='auxilliary input', ordinal=1)
        self[1][6]=atom.Atom(domain=domain.Aniso(), policy=self.input_aux2.vector_policy(1,False),names='auxilliary input', ordinal=2)
        self[1][7]=atom.Atom(domain=domain.Aniso(), policy=self.input_aux3.vector_policy(1,False),names='auxilliary input', ordinal=3)
        self[1][8]=atom.Atom(domain=domain.Aniso(), policy=self.input_aux4.vector_policy(1,False),names='auxilliary input', ordinal=4)
        self[1][9]=atom.Atom(domain=domain.Aniso(), policy=self.input_aux5.vector_policy(1,False),names='auxilliary input', ordinal=5)
        self[1][10]=atom.Atom(domain=domain.Aniso(), policy=self.input_aux6.vector_policy(1,False),names='auxilliary input', ordinal=6)
        self[1][11]=atom.Atom(domain=domain.Aniso(), policy=self.input_aux7.vector_policy(1,False),names='auxilliary input', ordinal=7)
        self[1][12]=atom.Atom(domain=domain.Aniso(), policy=self.input_aux8.vector_policy(1,False),names='auxilliary input', ordinal=8)
        self[1][13]=atom.Atom(domain=domain.Aniso(), policy=self.input_aux9.vector_policy(1,False),names='auxilliary input', ordinal=9)
        self[1][14]=atom.Atom(domain=domain.Aniso(), policy=self.input_aux10.vector_policy(1,False),names='auxilliary input', ordinal=10)

        self[1][16]=atom.Atom(domain=domain.BoundedFloat(0,10000000), policy=self.input_clock.nodefault_policy(1,False),names='song beat input')
        self[1][17]=atom.Atom(domain=domain.BoundedFloat(0,100), policy=self.input_clock.nodefault_policy(2,False),names='bar beat input')
        self[1][18]=atom.Atom(domain=domain.Bool(), init=False, policy=self.input_clock.nodefault_policy(3,False),names='running input')

        c = dict(c=schedproxy.get_constraints(),
                 x='[ideal([~server,take]),singular]',
                 o='option(with,[or([[matches([stretch],stretch)],[matches([un,stretch],unstretch)],[matches([chop],chop)]])])'
            )

        a = dict(create_action=self.__create_deferred, destroy_action=self.__destroy_deferred,clock=True)

        self.add_verb2(1,'record([],None,role(None,[mass([bar])]),%(o)s)'%c,self.__record)
        self.add_verb2(2,'play([un],None,option(None,%(x)s))'%c,self.__unplay)
        self.add_verb2(3,'play([],None,role(None,%(x)s),%(o)s)'%c,callback=self.__play_now,**a)
        self.add_verb2(4,'play([],None,role(None,%(x)s),role(at,%(c)s),option(until,%(c)s),option(every,%(c)s),%(o)s)'%c,callback=self.__play_aue,**a)
        self.add_verb2(5,'play([],None,role(None,%(x)s),role(until,%(c)s),option(every,%(c)s),%(o)s)'%c,callback=self.__play_ue,**a)
        self.add_verb2(6,'play([],None,role(None,%(x)s),role(every,%(c)s),%(o)s)'%c,callback=self.__play_e,**a)
        self.add_verb2(7,'play([dont],None,option(None,%(x)s))'%c,self.__unplay)
        self.add_verb2(8,'repeat([],None,role(None,%(x)s),%(o)s)'%c,callback=self.__repeat,**a)
        self.add_verb2(9,'name([],None,role(None,[ideal([~server,take]),singular]),role(to,[abstract]))',self.__name)
        self.add_verb2(10,'copy([],None,role(None,[gideal(take),singular]))',callback=self.__copy)
        self.add_verb2(11,'use([],None,role(None,[concrete,proto(scheduler),singular]))',callback=self.__usesched)
        self.add_verb2(12,'delete([],None,role(None,[ideal([~server,take]),singular]))',self.__delete)
        self.add_verb2(13,'play([],None,role(None,[mass([note])]),role(with,[mass([velocity])]))',create_action=self.__playnv,clock=True)
        self.add_verb2(14,'play([],None,role(None,[mass([note])]),role(with,[mass([velocity])]),role(for,[mass([second])]))',create_action=self.__playnvl,clock=True)

        self.add_verb2(15,'play([toggle],None,role(None,%(x)s),%(o)s)'%c,callback=self.__tog_play_now,**a)
        self.add_verb2(16,'play([toggle],None,role(None,%(x)s),role(at,%(c)s),option(until,%(c)s),option(every,%(c)s),%(o)s)'%c,callback=self.__tog_play_aue,**a)
        self.add_verb2(17,'play([toggle],None,role(None,%(x)s),role(until,%(c)s),option(every,%(c)s),%(o)s)'%c,callback=self.__tog_play_ue,**a)
        self.add_verb2(18,'play([toggle],None,role(None,%(x)s),role(every,%(c)s),%(o)s)'%c,callback=self.__tog_play_e,**a)
        self.add_verb2(19,'repeat([toggle],None,role(None,%(x)s),%(o)s)'%c,callback=self.__tog_repeat,**a)

        self.add_verb2(20,'cancel([],None)',self.__cancel)

        self[4] = TakeBrowser(self)
        self.library = TakeLibrary(self)

        self.__scheduler = schedproxy.SchedProxy(delegate=self)
        self.set_private(node.server(value=piw.makestring('',0),change=self.__schedchange))

        self.__schedready = False

        self[5] = Voice(self)

        # don't use self[6], it was previously used by a legacy status output that was removed in 1.2

        self[7]=toggle.Toggle(None,self.domain,container=(None,'overdub',self.verb_container()),init=False,names='overdub',transient=True)
Пример #10
0
    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)