示例#1
0
 def upgrade_7_0_to_8_0(self,tools,address):
     root = tools.root(address)
     rnode = root.ensure_node(4,17,255)
     rnode.ensure_node(1).set_data(piw.makestring('',0))
     rnode.ensure_node(8).set_data(piw.makestring('relative octave input',0))
     root.ensure_node(4,17,254).set_data(piw.makelong(0,0))
     return True
示例#2
0
 def upgrade_2_0_to_3_0(self,tools,address):
     root = tools.root(address)
     cnode = root.ensure_node(25,255)
     cnode.ensure_node(1).set_data(piw.makestring('aniso([])',0))
     cnode.ensure_node(3).set_data(piw.makestring('virtual',0))
     cnode.ensure_node(8).set_data(piw.makestring('course',0))
     return True
示例#3
0
def upgrade_3_0_to_4_0(tools, address, ss):
    root = tools.root(ss)
    ctl = root[4]

    for connector in ctl.iter():
        conn_id = paths.makeid_list(ss, *connector.path)
        target_id = connector[255][6].get_data().as_string().split(':')[0]
        target_addr, target_path = paths.breakid_list(target_id)
        old_conn = T('conn', None, None, conn_id, None)
        new_conn = logic.render_term(T('ctl', conn_id, None))
        print 'upgrade', conn_id, target_addr, target_path
        target_node = tools.root(target_addr).get_node(*target_path)
        target_conn = logic.parse_clauselist(
            target_node[255][2].get_data().as_string())
        if old_conn in target_conn:
            print 'removing', old_conn, 'from', target_conn, type(target_conn)
            target_conn = list(target_conn)
            target_conn.remove(old_conn)
            target_conn = tuple(target_conn)
            target_node[255][2].set_data(
                piw.makestring(logic.render_termlist(target_conn), 0))
            print 'target conn', target_conn

        target_node.ensure_node(255, const.meta_control).set_data(
            piw.makestring(new_conn, 0))

    return True
示例#4
0
    def __update_labels(self):
        # extract all control stream entries into a new list
        # extract the labels entry into a deticated list, if it exists
        new_ctl = []
        labels = []
        for e in self.__ctl:
            if e[0] == 'labels':
                labels = utils.tuple_items(e[1])
            else:
                new_ctl.append(e)

        # append the local category and label to the labels list
        category = self[17].get_value()
        label = self[18].get_value()
        if len(label) == 0 and self.host is not None and self.host.has_plugin(
        ):
            desc = self.host.get_description()
            if desc is not None:
                label = desc.name()

        if category and len(category) > 0 and label and len(label) > 0:
            labels.append(
                utils.maketuple(
                    [piw.makestring(category, 0),
                     piw.makestring(label, 0)], 0))

        # reintegrate the labels list and set the new control stream value
        new_ctl.append(['labels', utils.maketuple(labels, 0)])
        self[16].set_value(utils.makedict(new_ctl, 0))
示例#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 __setup(self,r,c,e):
     print 'setup',r,c,e
     x = self.__find(r,c,True)
     if x is None:
         k = self.find_hole()
         if k:
             self[k] = Event(self,piw.makestring('%d,%d,%f'%(r,c,e),0))
     else:
         k,v = x
         v.set_data(piw.makestring('%d,%d,%f'%(r,c,e),0))
示例#7
0
    def set_domain(self, dom):
        self.unplumb_clocks()
        self.set_property_string('domain', str(dom))

        if dom.iso():
            self.__clockdom.set_source(piw.makestring('', 0))
        else:
            self.__clockdom.set_source(piw.makestring('*', 0))

        self.plumb_clocks()
示例#8
0
 def upgrade_2_0_to_3_0(self,tools,address):
     root = tools.root(address)
     loop_node = root.get_node(3,254)
     loop = loop_node.get_data().as_long()
     loop_node.set_data(piw.makenull(0))
     root.ensure_node(5,255,6,1).set_data(piw.makestring(logic.render_term((loop,100.0)),0))
     root.ensure_node(5,255,const.meta_domain)
     root.ensure_node(5,255,const.meta_protocols)
     root.ensure_node(5,255,const.meta_names).set_data(piw.makestring('voice',0))
     return True
示例#9
0
    def upgrade_0_0_to_1_0(self,tools,address):
        root = tools.root(address)

        ctl_conn = []
        cnode = root.ensure_node(21,255)
        cnode.ensure_node(2).set_data(piw.makestring(logic.render_termlist(ctl_conn),0))
        cnode.ensure_node(1).set_data(piw.makestring('aniso([])',0))
        cnode.ensure_node(8).set_data(piw.makestring('controller input',0))
        root.ensure_node(2,255,2).set_data(piw.makestring('',0))

        return True
示例#10
0
文件: atom.py 项目: shamharoth/EigenD
    def setup(self, label, index, ctx, args):
        self.clear()

        act = self.container.create_action(label, index, ctx, *args)
        clk = self.container.isclocked(label, index)
        self.get_policy().set_clocked(clk)

        if clk:
            self.container.clock.add_upstream(self.get_policy().get_clock())

        if not act:
            return False

        (func, data) = act

        self.status = self.container.status_action(label, index, ctx, *args)
        self.index = index
        self.label = label
        self.data = data
        self.ctx = ctx
        self.args = args

        x = action.marshal((label, index, ctx, args))

        piw.indirectchange_set(self.__func, func)
        self.__private.set_data(piw.makestring(x, 0))

        return True
示例#11
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             names='midi output',
                             signature=version,
                             container=3)
        self.set_property_long('cordinal', ordinal)

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*', 0))
        self[1] = OutputMidiPort(self.domain)

        # midi input vector, merge down multiple MIDI input streams
        self.input = bundles.VectorInput(self[1].cookie(),
                                         self.domain,
                                         signals=(1, ))
        self[2] = atom.Atom(domain=domain.Aniso(),
                            names="midi input",
                            policy=self.input.vector_policy(1, False))

        # self[3] is verb container

        # choose verb for choosing an output MIDI port
        self.add_verb2(
            1,
            'choose([],None,role(None,[ideal([~server,midiport]),singular]))',
            self.__chooseport)

        self.set_ordinal(ordinal)
示例#12
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self, signature=version,names='ranger',ordinal=ordinal)

        self[2] = atom.Atom()
        self[2][1] = bundles.Output(1,False,names='output')

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*',0))
        self.output = bundles.Splitter(self.domain,*self[2].values())
        self.ranger = piw.ranger(self.domain,self.output.cookie())

        self.ctl_input = bundles.ScalarInput(self.ranger.ctl_cookie(), self.domain,signals=(1,2,3))
        self.data_input = bundles.VectorInput(self.ranger.data_cookie(), self.domain,signals=(1,))

        self[1] = atom.Atom()
        self[1][1]=atom.Atom(domain=domain.BoundedFloat(-10000000,10000000),init=-1,policy=self.ctl_input.policy(1,False),names='minimum')
        self[1][2]=atom.Atom(domain=domain.BoundedFloat(-10000000,10000000),init=1,policy=self.ctl_input.policy(2,False),names='maximum')
        self[1][3]=atom.Atom(domain=domain.BoundedFloat(-10000000,10000000),init=0,policy=self.ctl_input.policy(3,False),names='rest')
        self[1][4]=atom.Atom(domain=domain.BoundedFloat(-1,1),init=0,policy=self.data_input.vector_policy(1,False),names='input')

        self[3]=atom.Atom(domain=domain.Bool(),policy=atom.default_policy(self.__setsticky),names='sticky')
        self[4]=atom.Atom(domain=domain.BoundedFloat(-10,10),policy=atom.default_policy(self.__setcurve),names='curve')
        self[5]=atom.Atom(domain=domain.Bool(),policy=atom.default_policy(self.__setmono),names='mono')
        self[6]=atom.Atom(domain=domain.Bool(),init=True,policy=atom.default_policy(self.__setabsolute),names='absolute')

        self.ranger.set_absolute(True)
        self.add_verb2(1,'reset([],None)',self.__reset)
示例#13
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,signature=version,names='talker',container=5,ordinal=ordinal)

        self.add_mode2(4,'mode([],role(when,[singular,numeric]),option(using,[instance(~server)]))', self.__mode, self.__query, self.__cancel_mode, self.__attach_mode)
        self.add_mode2(7,'mode([],role(when,[singular,numeric]),role(called,[singular,numeric]),option(using,[instance(~server)]))', self.__cmode, self.__cquery, self.__cancel_mode, self.__attach_mode)
        self.add_verb2(1,'cancel([],None,role(None,[ideal([~server,event])]))', self.__cancel_verb)
        self.add_verb2(8,'cancel([],None,role(None,[singular,numeric]),role(called,[singular,numeric]))', self.__cancel_verb_called)
        self.add_verb2(5,'colour([],None,role(None,[singular,numeric]),role(to,[singular,numeric]))', self.__color_verb)
        self.add_verb2(6,'colour([],None,role(None,[singular,numeric]),role(to,[singular,numeric]),role(from,[singular,numeric]))', self.__all_color_verb)

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

        self[1] = bundles.Output(1,False, names='light output',protocols='revconnect')
        self.light_output = bundles.Splitter(self.domain,self[1])
        self.light_convertor = piw.lightconvertor(self.light_output.cookie())
        self.light_aggregator = piw.aggregator(self.light_convertor.cookie(),self.domain)
        self.controller = piw.controller(self.light_aggregator.get_output(1),utils.pack_str(1))

        self.activation_input = bundles.VectorInput(self.controller.cookie(), self.domain,signals=(1,))

        self[2] = atom.Atom(domain=domain.BoundedFloat(0,1), policy=self.activation_input.local_policy(1,False),names='activation input')
        self[3] = atom.Atom(creator=self.__create,wrecker=self.__wreck)
        self[4] = PhraseBrowser(self.__eventbykey,self.__keylist)
示例#14
0
    def set_name(self,name):
        name = name.split()
        ordinal = None

        try:
            if len(name)>0:
                ordinal=int(name[-1])
                name = name[:-1]
        except:
            pass

        name = ' '.join(name)

        d = self.get_data()

        if d.is_null():
            d = piw.dictnull(0)

        if d.is_dict():
            if name:
                d = piw.dictset(d,'name',piw.makestring(name,0))
            else:
                d = piw.dictdel(d,'name')
            if ordinal:
                d = piw.dictset(d,'ordinal',piw.makelong(ordinal,0))
            else:
                d = piw.dictdel(d,'ordinal')

        self.set_data(d)
示例#15
0
 def __init__(self,id,path,name,arg,timeout=30000):
     async.Deferred.__init__(self)
     piw.rpcclient.__init__(self)
     arg = piw.makestring_len(arg,len(arg),0)
     name = piw.makestring(name,0)
     piw.tsd_rpcclient(self,id.as_string(),path.make_normal(),name,arg,timeout)
     self.py_lock()
示例#16
0
    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 )
示例#17
0
def convert_atom(atom,extra={},ext=253):
    metadata = extra.copy()
    children = map(ord,atom.list_children())

    if 254 in children:
        children.remove(254)

    if 255 in children:
        children.remove(255)
        metanode = atom.get_child(255)
        metadata.update(convert_metadata(metanode))

    if 253 in children:
        children.remove(253)
        convert_list(atom.get_child(253))

    data = piw.dictnull(0)
    for (k,v) in metadata.iteritems():
        if isinstance(v,str):
            data = piw.dictset(data,k,piw.makestring(v,0))
        elif isinstance(v,int):
            data = piw.dictset(data,k,piw.makelong(v,0))
        elif isinstance(v,bool):
            data = piw.dictset(data,k,piw.makebool(v,0))

    atom.set_data(data)

    for c in children:
        convert_atom(atom.get_child(c))
示例#18
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='orb',
                             ordinal=ordinal)

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

        self[2] = atom.Atom(names="outputs")
        self[2][1] = bundles.Output(1, False, names='angle output')
        self[2][2] = bundles.Output(2, False, names='radius output')

        self.output = bundles.Splitter(self.domain, *self[2].values())
        self.native = orb(self.domain, self.output.cookie())

        self.key_input = bundles.VectorInput(self.native.cookie(),
                                             self.domain,
                                             signals=(1, 2))

        self[1] = atom.Atom(names="inputs")

        self[1][1] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.key_input.vector_policy(1, False),
                               names='roll input')
        self[1][2] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.key_input.vector_policy(2, False),
                               names='yaw input')
示例#19
0
 def upgrade_8_0_to_9_0(self, tools, address):
     root = tools.root(address)
     root.ensure_node(255, 3)
     root.ensure_node(255, 6)
     icon = 'ideal([~self,file],[True,[metronome_64.png,png,4975,ae403082470f2feee1639a34099d0efb],"pkg_res:plg_loop/metronome_64.png"])'
     root.ensure_node(255, 16).set_data(piw.makestring(icon, 0))
     return True
示例#20
0
文件: atom.py 项目: shamharoth/EigenD
 def set_property_string(self,
                         key,
                         value,
                         allow_veto=False,
                         notify=True,
                         delegate=None):
     self.set_property(key, piw.makestring(value, 0), allow_veto, notify,
                       delegate)
示例#21
0
 def rpc_create_trigger(self, schema):
     print 'event schema is:', schema
     i = self[3].find_hole()
     e = Event(self, i)
     e.setup(piw.makestring(schema, 0))
     self[3][i] = e
     self[5].update()
     return async .success(e.id())
示例#22
0
 def __addvoiceatom(self,root,voice,file,vol,chop,playing):
     voice_node = root.ensure_node(5,voice)
     voice_node.ensure_node(255,7).set_data(piw.makelong(voice,0))
     voice_node.ensure_node(255,8).set_data(piw.makestring('voice',0))
     voice_node.ensure_node(255,6).set_data(piw.makestring(logic.render_term((file,playing)),0))
     voice_node.ensure_node(255,1)
     voice_node.ensure_node(255,3)
     volume_node = voice_node.ensure_node(1)
     volume_node.ensure_node(255,8).set_data(piw.makestring('volume',0))
     volume_node.ensure_node(255,1)
     volume_node.ensure_node(255,3)
     volume_node.ensure_node(254).set_data(piw.makefloat(vol,0))
     chop_node = voice_node.ensure_node(2)
     chop_node.ensure_node(255,8).set_data(piw.makestring('chop',0))
     chop_node.ensure_node(255,1)
     chop_node.ensure_node(255,3)
     chop_node.ensure_node(254).set_data(piw.makefloat(chop,0))
示例#23
0
    def upgrade_6_0_to_7_0(self,tools,address):
        root = tools.root(address)
        for aux in range(8,10+1):
            nodenum = aux+4
            print 'adding aux input and output ',aux,' node num=',nodenum
            # aux input nodes (1,12), (1,13), (1,14)
            root.ensure_node(1,nodenum)
            root.ensure_node(1,nodenum,const.meta_node)
            root.ensure_node(1,nodenum,const.meta_node,const.meta_domain).set_data(piw.makestring('aniso([])',0))
            root.ensure_node(1,nodenum).setname(names='auxilliary input',ordinal=aux)
            # aux output nodes (2,12), (2,13), (2,14)
            root.ensure_node(2,nodenum)
            root.ensure_node(2,nodenum,const.meta_node)
            root.ensure_node(2,nodenum,const.meta_node,const.meta_domain).set_data(piw.makestring('aniso([])',0))
            root.ensure_node(2,nodenum).setname(names='auxilliary output',ordinal=aux)

        return True
示例#24
0
 def __update(self, k, v):
     t = piw.tsd_time()
     v = piw.makestring(v, t)
     self.__callback.update_timestamp(t)
     if k is None:
         self.set_data(v)
     else:
         self[k].set_data(v)
示例#25
0
文件: atom.py 项目: shamharoth/EigenD
 def set_property_termlist(self,
                           key,
                           value,
                           allow_veto=False,
                           notify=True,
                           delegate=None):
     self.set_property(key, piw.makestring(logic.render_termlist(value), 0),
                       allow_veto, notify, delegate)
示例#26
0
 def value2data(self,v,t=0L):
     if v is None: 
         raise ValueError('empty string is not in belcanto lexicon')
     for w in v.split():
         e=lexicon.lexicon.get(w)
         if e is None:
             raise ValueError(w,'not in belcanto lexicon')
     v=str(v)
     return piw.makestring(v,t)
示例#27
0
    def upgrade_1_0_1_to_1_0_2(self, tools, address):
        # assign canonical ordinals to agents

        n2 = tools.get_root(address).get_node(2)
        old_plugins = logic.parse_termlist(
            n2.get_data().as_dict_lookup('agents').as_string())
        plugs_by_type = {}

        for old_term in old_plugins:
            (paddress, plugin, pversion, pcversion) = old_term.args
            pmeta = tools.get_root(paddress).get_data()
            pname = pmeta.as_dict_lookup('name')
            pordinal = pmeta.as_dict_lookup('ordinal')

            if not pname.is_string() or not pname.as_string():
                pname = plugin
            else:
                pname = pname.as_string()

            pname = pname.split()
            try:
                pname.remove('agent')
            except:
                pass
            pname = '_'.join(pname)

            if not pordinal.is_long() or not pordinal.as_long():
                pordinal = 0
            else:
                pordinal = pordinal.as_long()

            plugs_by_type.setdefault(plugin, []).append(
                [paddress, plugin, pversion, pcversion, pname, pordinal, 0])

        plugins = []

        for (ptype, plist) in plugs_by_type.iteritems():
            ords_used = set()
            max_ord = 0

            for p in plist:
                if ptype == p[4] and p[5] and p[5] not in ords_used:
                    p[6] = p[5]
                    ords_used.add(p[5])
                    max_ord = max(max_ord, p[5])

            for p in plist:
                if not p[6]:
                    max_ord += 1
                    p[6] = max_ord

                new_term = logic.make_term('a', p[0], p[1], p[2], p[3], p[6])
                plugins.append(new_term)

        n2.set_data(
            piw.dictset(piw.dictnull(0), 'agents',
                        piw.makestring(logic.render_termlist(plugins), 0)))
示例#28
0
 def move_state(self, dst, test):
     for (k, v) in self.iteritems():
         val = v.get_data().as_string()
         if hasattr(v, 'state') and test(val, v.state):
             newval = str(dst)
             v.set_data(piw.makestring(newval, 0))
             self.__moved(k, val, newval, v.state)
             return True
     return False
示例#29
0
    def upgrade_1_0_0_to_1_0_1(self,tools,address):
        keys = tools.get_root(address).get_node(3)
        for k in keys.iter(exclude=(254,255)):
            ko = k.path[-1]
            km = k.get_data()
            km = piw.dictset(km,'name',piw.makestring('key',0))
            km = piw.dictset(km,'ordinal',piw.makelong(ko,0))
            k.set_data(km)

            for e in k.iter(exclude=(254,255)):
                eo = e.path[-1]
                em = e.get_data()
                et = e.ensure_node(255).get_data()
                em = piw.dictset(em,'name',piw.makestring('action',0))
                em = piw.dictset(em,'ordinal',piw.makelong(ko,0))
                em = piw.dictset(em,'help',et if et.is_string() else piw.makestring('',0))
                e.set_data(em)
                e.erase_child(255)
示例#30
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)
示例#31
0
    def __init__(self,names,ordinal,dom,remove,keys):
        self.kbd_keys = keys
        agent.Agent.__init__(self,names=names,ordinal=ordinal,signature=version,subsystem='kbd',volatile=True,container=102,protocols='browse is_subsys')

        self.remover=remove

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

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

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

        self[7] = bundles.Output(1,False,names='breath output')
        self[10] = bundles.Output(2,False,names='absolute strip output',ordinal=1)

        self[12] = bundles.Output(1,False,names='pedal output',ordinal=1)
        self[13] = bundles.Output(1,False,names='pedal output',ordinal=2)
        self[14] = bundles.Output(1,False,names='pedal output',ordinal=3)
        self[15] = bundles.Output(1,False,names='pedal output',ordinal=4)

        self.led_backend = piw.functor_backend(1,True)
        self.status_mixer = piw.statusmixer(self.led_backend.cookie())
        self.led_input = bundles.VectorInput(self.status_mixer.cookie(),self.domain,signals=(1,))
        self[8] = atom.Atom(names='light input',protocols='revconnect',policy=self.led_input.vector_policy(1,False,False,auto_slot=True),domain=domain.Aniso())

        self[100] = VirtualKey(self.kbd_keys)

        self.koutput = bundles.Splitter(self.domain,self[1],self[2],self[3],self[4])
        self.kpoly = piw.polyctl(10,self.koutput.cookie(),False,5)
        self.s1output = bundles.Splitter(self.domain,self[5],self[10])
        self.boutput = bundles.Splitter(self.domain,self[7])
        self.poutput1 = bundles.Splitter(self.domain,self[12])
        self.poutput2 = bundles.Splitter(self.domain,self[13])
        self.poutput3 = bundles.Splitter(self.domain,self[14])
        self.poutput4 = bundles.Splitter(self.domain,self[15])

        self.kclone=piw.sclone()
        self.kclone.set_filtered_output(1,self.kpoly.cookie(),piw.first_filter(1))
        self.kclone.set_filtered_output(2,self.s1output.cookie(),piw.first_filter(2))
        self.kclone.set_filtered_output(5,self.boutput.cookie(),piw.first_filter(5)) 
        self.kclone.set_filtered_output(6,self.poutput1.cookie(),piw.first_filter(6))
        self.kclone.set_filtered_output(7,self.poutput2.cookie(),piw.first_filter(7))
        self.kclone.set_filtered_output(8,self.poutput3.cookie(),piw.first_filter(8))
        self.kclone.set_filtered_output(9,self.poutput4.cookie(),piw.first_filter(9))

        self[9] = atom.Atom(names='controller output',domain=domain.Aniso(),init=self.courses())

        self.add_verb2(4,'maximise([],None,role(None,[mass([pedal])]))',self.__maximise)
        self.add_verb2(5,'minimise([],none,role(None,[mass([pedal])]))',self.__minimise)

        self.__timestamp = piw.tsd_time()
        self.update()
示例#32
0
    def __init__(self, address, ordinal):
        #
        agent.Agent.__init__(self, signature=version, names='osc pad', 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.osc = osc_pad(self.domain, self.output.cookie(),"localhost", "9000","9001")


        self.key_input = bundles.VectorInput(self.osc.cookie(), self.domain, signals=(1,2,3,4))
        self[2] = atom.Atom(names="inputs")
        self[2][1] = atom.Atom(domain=domain.Aniso(), policy=self.key_input.vector_policy(1,False), names='key input')
        self[2][2] = atom.Atom(domain=domain.BoundedFloat(0,1), policy=self.key_input.vector_policy(2,False), names='pressure input')
        self[2][3] = atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.key_input.vector_policy(3,False), names='roll input')
        self[2][4] = atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.key_input.vector_policy(4,False), names='yaw input')
        
        self.left = 1;
        self.width = 50;
        self.top =1;
        self.height = 25;
        
        self[3] = atom.Atom(names='view')
        self[3][1] = atom.Atom(domain=domain.BoundedInt(1,100), policy=atom.default_policy(self.__top), init=self.top, names='top')
        self[3][2] = atom.Atom(domain=domain.BoundedInt(1,100), policy=atom.default_policy(self.__height), init=self.height, names='height')
        self[3][3] = atom.Atom(domain=domain.BoundedInt(1,100), policy=atom.default_policy(self.__left), init=self.left, names='left')
        self[3][4] = atom.Atom(domain=domain.BoundedInt(1,100), policy=atom.default_policy(self.__width), init=self.width, names='width')
        
        self[4] = atom.Atom(domain=domain.BoundedInt(0,100), policy=atom.default_policy(self.__arrangement), init=0, names='arrangement')
        
        self.add_verb2(1,'reset([],None)', callback=self.__reset)
        self.add_verb2(2,'play([],None)', callback=self.__play)
        self.add_verb2(3,'stop([],None)', callback=self.__stop)
        self.add_verb2(4,'undo([],None)', callback=self.__undo)
        self.add_verb2(5,'undo([un],None)', callback=self.__redo)
        
        self.osc.set_window(self.top,self.height,self.left,self.width);