コード例 #1
0
ファイル: cycler_plg.py プロジェクト: tylerwood/EigenD
 def upgrade_2_0_to_3_0(self, tools, address):
     root = tools.root(address)
     root.ensure_node(255, 17)
     p = root.ensure_node(255, 6)
     oc = p.get_data()
     if not oc.is_bool(): oc = piw.makebool(False, 0)
     p.set_data(piw.data())
     p.ensure_node(1).set_data(oc)
     p.ensure_node(2).set_data(piw.makebool(False, 0))
     return True
コード例 #2
0
    def upgrade_0_0_to_1_0(self, tools, address):
        root = tools.root(address)

        root.ensure_node(9, 255, 1)
        root.ensure_node(9, 255, 8).set_string('auto channel pressure')
        root.ensure_node(9, 255, 3)
        root.ensure_node(9, 254).set_data(piw.makebool(False, 0))

        root.ensure_node(10, 255, 1)
        root.ensure_node(10, 255, 8).set_string('auto poly pressure')
        root.ensure_node(10, 255, 3)
        root.ensure_node(10, 254).set_data(piw.makebool(False, 0))

        return True
コード例 #3
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
コード例 #4
0
 def upgrade_5_0_to_6_0(self,tools,address):
     root = tools.root(address)
     root.ensure_node(6,255,1).set_string('bool([])')
     root.ensure_node(6,255,8).set_string('fade enable')
     root.ensure_node(6,255,3)
     root.ensure_node(6,254).set_data(piw.makebool(False,0))
     return True
コード例 #5
0
ファイル: upgrade_v0.py プロジェクト: tylerwood/EigenD
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))
コード例 #6
0
 def upgrade_5_0_to_6_0(self, tools, address):
     root = tools.root(address)
     events = root.get_node(3)
     for e in events.iter():
         schema = e.get_node(255, 6).get_data()
         e.ensure_node(255, 6).set_data(piw.makenull(0))
         e.ensure_node(255, 6, 1).set_data(schema)
         e.ensure_node(255, 6, 2).set_data(piw.makebool(False, 0))
     return True
コード例 #7
0
ファイル: scaler_plg.py プロジェクト: jschpmn/EigenD
    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)
コード例 #8
0
ファイル: cycler_plg.py プロジェクト: shamharoth/EigenD
    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))
コード例 #9
0
ファイル: agentd.py プロジェクト: jschpmn/EigenD
def find_user_setups_flat():
    rd = resource.user_resource_dir(resource.setup_dir)

    t = piw.term("tree",0)
    t.add_arg(-1,piw.term(piw.makestring('user setups',0)))

    for (sp,sd,sn) in os.walk(rd):
        for s in filter(filter_valid_setup,sn):
            t3 = piw.term('leaf',0)
            s3 = split_setup(s)
            # unencode url encoded illegal chars to display them properly
            name = piw.term(piw.makestring(urllib.unquote(s3[0]),0)) if s3[0] else piw.term()
            slot = piw.term(piw.makestring(s3[1],0))
            t3.add_arg(-1,name)
            t3.add_arg(-1,slot)
            t3.add_arg(-1,piw.term(piw.makestring(os.path.join(rd,s),0)))
            t3.add_arg(-1,piw.term(piw.makebool(False,0)))
            t3.add_arg(-1,piw.term(piw.makebool(True,0)))
            t.add_arg(-1,t3)

    return t
コード例 #10
0
 def upgrade_1_0_4_to_1_0_5(self, tools, address):
     print 'upgrading host', address
     root = tools.get_root(address)
     state = root.get_node(255, 5)
     if state.get_data().is_string():
         mapping = state.get_data().as_string()
         if mapping != '[]':
             term = logic.parse_term(mapping)
             for t in term.args:
                 if "s" == t.pred:
                     decimation = 0
                     notes = True
                     pitchbend = True
                     hiresvel = True
                     pbup = 1.0
                     pbdown = 1.0
                     if t.arity >= 3:
                         decimation = float(t.args[0])
                         notes = bool(t.args[1])
                         pitchbend = bool(t.args[2])
                     if t.arity >= 4:
                         hiresvel = bool(t.args[3])
                     if t.arity >= 6:
                         pbup = float(t.args[4])
                         pbdown = float(t.args[5])
                     root.ensure_node(20, 254).set_data(
                         piw.makefloat_bounded(100, 0, 0, decimation, 0))
                     root.ensure_node(21,
                                      254).set_data(piw.makebool(notes, 0))
                     root.ensure_node(22, 254).set_data(
                         piw.makebool(pitchbend, 0))
                     root.ensure_node(23, 254).set_data(
                         piw.makebool(hiresvel, 0))
                     root.ensure_node(24, 254).set_data(
                         piw.makefloat_bounded(48, 0, 0, pbup, 0))
                     root.ensure_node(25, 254).set_data(
                         piw.makefloat_bounded(48, 0, 0, pbdown, 0))
                     break
コード例 #11
0
ファイル: agentd.py プロジェクト: jschpmn/EigenD
    def term(self):
        names = self.setups.keys()
        names.sort()

        for n in names:
            m = self.get_submenu(n.split())
            m.leaf = self.setups[n]

        children = piw.term(0)

        for c in self.children:
            children.add_arg(-1,c.term())

        k = self.children2.keys()
        k.sort()

        for c in k:
            children.add_arg(-1,self.children2[c].term())

        l = self.leaf

        if l:
            t = piw.term('n',7)
            t.set_arg(0,piw.term(piw.makestring(self.label,0)))
            t.set_arg(1,children)
            t.set_arg(2,piw.term(piw.makestring(l[0],0)))
            t.set_arg(3,piw.term(piw.makestring(l[1],0)))
            t.set_arg(4,piw.term(piw.makestring(l[2],0)))
            t.set_arg(5,piw.term(piw.makebool(l[3],0)))
            t.set_arg(6,piw.term(piw.makebool(l[4],0)))
        else:
            t = piw.term('n',2)
            t.set_arg(0,piw.term(piw.makestring(self.label,0)))
            t.set_arg(1,children)

        return t
コード例 #12
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
コード例 #13
0
ファイル: arranger_plg.py プロジェクト: tylerwood/EigenD
    def upgrade_0_0_to_1_0(self, tools, address):
        root = tools.root(address)

        loopstart = piw.makelong(
            1 + root.get_node(7, 255, 6, 1).get_data().as_long(), 0)
        loopend = piw.makelong(
            1 + root.get_node(7, 255, 6, 2).get_data().as_long(), 0)
        step = root.get_node(8, 1)
        frac = root.get_node(8, 2)

        root.remove(7)
        root.remove(8)

        root.ensure_node(7, 1, 255, 1).set_string('bint(1,10000,1,[])')
        root.ensure_node(7, 1, 255, 8).set_string('loopstart')
        root.ensure_node(7, 1, 255, 17)
        root.ensure_node(7, 1, 255, 18)
        root.ensure_node(7, 1, 254).set_data(loopstart)

        root.ensure_node(7, 2, 255, 1).set_string('bint(1,10000,1,[])')
        root.ensure_node(7, 2, 255, 8).set_string('loopend')
        root.ensure_node(7, 2, 255, 17)
        root.ensure_node(7, 2, 255, 18)
        root.ensure_node(7, 2, 254).set_data(loopend)

        root.ensure_node(7, 3).copy(step)
        root.ensure_node(7, 3, 255, 17)
        root.ensure_node(7, 3, 255, 18)

        root.ensure_node(7, 4).copy(frac)
        root.ensure_node(7, 4, 255, 17)
        root.ensure_node(7, 4, 255, 18)

        root.remove(8)

        root.ensure_node(255, 6).set_data(piw.makebool(True, 0))

        return True
コード例 #14
0
 def upgrade_9_0_to_10_0(self, tools, address):
     root = tools.root(address)
     if root.get_node(11):
         root.get_node(11).erase()
     if root.get_node(12):
         root.get_node(12).erase()
     if root.get_node(13):
         root.get_node(13).erase()
     root.ensure_node(15)
     root.ensure_node(15, 254)
     root.ensure_node(15, 255)
     root.ensure_node(15, 255, 1)
     root.ensure_node(15, 255, 3)
     root.ensure_node(15).setmeta(8, 'midi', 'clock', 'input')
     root.ensure_node(16)
     root.ensure_node(16, 1)
     root.ensure_node(16, 1, 254)
     root.ensure_node(16, 1, 255)
     root.ensure_node(16, 1, 255, 1)
     root.ensure_node(16, 1, 255, 3)
     root.ensure_node(16, 1).setmeta(8, 'status', 'output')
     root.ensure_node(16, 1, 255, 9)
     root.ensure_node(16, 254).set_data(piw.makebool(False, 0))
     root.ensure_node(16, 255)
     root.ensure_node(16, 255, 1)
     root.ensure_node(16, 255, 3)
     root.ensure_node(16).setmeta(8, 'midi', 'clock', 'enable')
     root.ensure_node(16, 255, 17)
     root.ensure_node(16, 255, 18)
     root.ensure_node(17)
     root.ensure_node(17, 254).set_data(piw.makefloat(0.0, 0))
     root.ensure_node(17, 255)
     root.ensure_node(17, 255, 1)
     root.ensure_node(17, 255, 3)
     root.ensure_node(17).setmeta(8, 'midi', 'clock', 'latency')
     return True
コード例 #15
0
ファイル: host_plg.py プロジェクト: jschpmn/EigenD
 def showing_changed(self,show):
     self.__state[1].set_data(piw.makebool(show,0))
     self.__agent.set_light(2,show)
コード例 #16
0
ファイル: domain.py プロジェクト: tylerwood/EigenD
 def value2data(self, v, t=0L):
     v = bool(v)
     return piw.makebool(v, t)
コード例 #17
0
ファイル: scaler_plg.py プロジェクト: shamharoth/EigenD
 def __unfix(self, subject):
     self.__fixed = False
     self.get_private().set_data(piw.makebool(False, 0))
     return action.nosync_return()
コード例 #18
0
ファイル: upgrade_tools_v0.py プロジェクト: tylerwood/EigenD
 def set_bool(self, value, ts=0):
     self.dbnode.set_data(piw.makebool(value, ts))
コード例 #19
0
ファイル: cycler_plg.py プロジェクト: tylerwood/EigenD
 def __cycle_on(self, subj):
     self.cycler.set_cycle(True)
     self.get_private()[1].set_data(piw.makebool(True, 0))
コード例 #20
0
def set_upgrade(snap, upg=True):
    a = snap.get_agent_address(255, 'meta', True)
    a.get_root().get_child(4).set_data(piw.makebool(upg, 0))
コード例 #21
0
ファイル: cycler_plg.py プロジェクト: tylerwood/EigenD
 def __invert_on(self, subj):
     self.cycler.set_invert(True)
     self.get_private()[2].set_data(piw.makebool(True, 0))
コード例 #22
0
ファイル: clicker_plg.py プロジェクト: shamharoth/EigenD
 def __setup_playstate(self, playing):
     self.__playstate.set_data(piw.makebool(playing, 0))
     self.__playing = playing
コード例 #23
0
ファイル: cycler_plg.py プロジェクト: tylerwood/EigenD
 def __invert_off(self, subj):
     self.cycler.set_invert(False)
     self.get_private()[2].set_data(piw.makebool(False, 0))
コード例 #24
0
ファイル: host_plg.py プロジェクト: jschpmn/EigenD
 def bypassed_changed(self,bypassed):
     self.__state[4].set_data(piw.makebool(bypassed,0))
コード例 #25
0
 def upgrade_5_0_to_6_0(self, tools, address):
     root = tools.root(address)
     root.ensure_node(255, 6).set_data(piw.makebool(False, 0))
     return True
コード例 #26
0
ファイル: cycler_plg.py プロジェクト: tylerwood/EigenD
 def __cycle_off(self, subj):
     self.cycler.set_cycle(False)
     self.get_private()[1].set_data(piw.makebool(False, 0))