Exemple #1
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()
Exemple #2
0
    def __init__(self, address, ordinal):
        self.domain = piw.clockdomain_ctl()
        agent.Agent.__init__(self, signature=version,names='drummer',icon='plg_loop/bass_drum_64.png',container=(4,'drummer',atom.VerbContainer(clock_domain=self.domain)),protocols='browse',ordinal=ordinal)

        self.updater = Updater()
        self.loopdb = loopdb.LoopDatabase()
        self.__timestamp = 0

        self[1] = atom.Atom()
        self[1][1] = bundles.Output(1,True,names='left audio output')
        self[1][2] = bundles.Output(2,True,names='right audio output')

        self.output = bundles.Splitter(self.domain,*self[1].values())
        self.summer = piw.stereosummer(self.domain,self.output.cookie(),2)
        self.aggregator = piw.aggregator(self.summer.cookie(),self.domain)

        self.clock_cloner = piw.sclone()
        self.input = bundles.ScalarInput(self.clock_cloner.cookie(), self.domain,signals=(1,2))
        self.input.add_upstream(self.verb_container().clock)

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

        self[3] = LoopBrowser(self)

        vc = '[or([partof(~(s)"#5")],[numeric])]'

        self.add_verb2(1,'first([],None)',self.__first)
        self.add_verb2(2,'next([],None)',self.__next)
        self.add_verb2(3,'name([],None,role(None,[ideal([~server,loop]),singular]),role(to,[abstract]))',self.__name)
        self.add_verb2(4,'choose([],None,role(None,[ideal([~server,loop]),singular]))',self.__choose)
        self.add_verb2(5,'play([],None)',create_action=self.__play,clock=True)
        self.add_verb2(6,'play([un],None)',create_action=self.__unplay,clock=True)
        self.add_verb2(7,'add([],None,option(None,[ideal([~server,loop]),singular]))',self.__add)
        self.add_verb2(8,'remove([],None,option(None,%s))' % vc,self.__remove)
        self.add_verb2(9,'select([],None,role(None,%s))' % vc,self.__select)
        self.add_verb2(10,'play([],None,role(None,%s))' % vc,create_action=self.__play_voice,clock=True,status_action=self.__status)
        self.add_verb2(11,'play([un],None,role(None,%s))' % vc,create_action=self.__unplay_voice,clock=True,status_action=self.__status)
        self.add_verb2(15,'first([],None,role(None,%s))' % vc,self.__firstv)
        self.add_verb2(16,'next([],None,role(None,%s))' % vc,self.__nextv)
        self.add_verb2(17,'play([once],None,role(None,%s))' % vc,create_action=self.__once,clock=True,status_action=self.__status)
        self.add_verb2(21,'scan([],~self)',self.__rescan)
        self.add_verb2(22,'play([toggle],~self,role(None,%s))' % vc,create_action=self.__toggle_voice,clock=True,status_action=self.__status)
        self.add_verb2(23,'play([toggle],None)',create_action=self.__toggle,clock=True)
        
        self.loop_on = piw.changelist()
        self.loop_off = piw.changelist()
        self.loop_toggle = piw.changelist()

        self[6]=bundles.Output(1,False,names='status output')
        self.light_output=bundles.Splitter(self.domain,self[6])
        self.lights=piw.lightsource(piw.change_nb(),0,self.light_output.cookie())
        self[5] = VoiceList(self)
        self[5].populate([1])
        self.__first(None)
Exemple #3
0
    def __init__(self,usbname,ordinal,dom,remove):
        agent.Agent.__init__(self,names='keyboard pico',ordinal=ordinal,signature=version,subsystem='kbd',volatile=True,container=102,protocols='is_subsys')

        self.usbname=usbname
        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')
        self[6] = bundles.Output(1,False, names='breath output')
        self[8] = bundles.Output(2,False, names='absolute strip output')
        
        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[7] = atom.Atom(names='light input',protocols='revconnect',policy=self.led_input.vector_policy(1,False,False,auto_slot=True),domain=domain.Aniso())

        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.soutput = bundles.Splitter(self.domain,self[5],self[8])
        self.boutput = bundles.Splitter(self.domain,self[6])

        self.kclone=piw.sclone()
        self.kclone.set_filtered_output(1,self.kpoly.cookie(),piw.first_filter(1))
        self.kclone.set_filtered_output(2,self.soutput.cookie(),piw.first_filter(2))
        self.kclone.set_filtered_output(3,self.boutput.cookie(),piw.first_filter(3))
        self.keyboard=pkbd_native.bundle(usbname,self.kclone.cookie(),utils.notify(self.dead),utils.changify(self.signal))

        self[100] = VirtualKey()
        #self[102] = vc

        self[251] = atom.Atom(domain=domain.BoundedFloat(0,1), init=self.keyboard.get_threshold1(), protocols='input output', names='soft threshold', policy=atom.default_policy(self.keyboard.set_threshold1))
        self[249] = atom.Atom(domain=domain.BoundedFloat(0,1), init=self.keyboard.get_threshold2(), protocols='input output', names='hard threshold', policy=atom.default_policy(self.keyboard.set_threshold2))
        self[240] = atom.Atom(domain=domain.BoundedFloat(0,1), init=self.keyboard.get_roll_axis_window(), protocols='input output', names='roll axis window', policy=atom.default_policy(self.keyboard.set_roll_axis_window))
        self[241] = atom.Atom(domain=domain.BoundedFloat(0,1), init=self.keyboard.get_yaw_axis_window(), protocols='input output', names='yaw axis window', policy=atom.default_policy(self.keyboard.set_yaw_axis_window))
        self[242] = atom.Atom(domain=domain.Bool(), init=False, protocols='input output nostage', names='k logging', policy=atom.default_policy(self.keyboard.enable_key_logging))

        f=self.keyboard.led_functor()
        self.led_backend.set_functor(piw.pathnull(0),f)

        self[9] = atom.Atom(names='controller output',domain=domain.Aniso(),init=self.__courses())
Exemple #4
0
    def __init__(self, address, ordinal):
        #
        agent.Agent.__init__(self,
                             signature=version,
                             names='t3d device',
                             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(1, False, names='key output')
        self[1][2] = bundles.Output(2, False, names='pressure output')
        self[1][3] = bundles.Output(3, False, names='roll output')
        self[1][4] = bundles.Output(4, False, names='yaw output')
        self[1][5] = bundles.Output(5, False, names='frequency')

        self[1][6] = bundles.Output(1, False, names='breath output')

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

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

        # key outputs
        self.koutput = bundles.Splitter(self.domain, self[1][1], self[1][2],
                                        self[1][3], self[1][4], self[1][5])
        self.kpoly = piw.polyctl(10, self.koutput.cookie(), False, 6)
        # breath
        self.boutput = bundles.Splitter(self.domain, self[1][6])
        # strips
        self.s1output = bundles.Splitter(self.domain, self[1][7], self[1][8])
        self.s2output = bundles.Splitter(self.domain, self[1][9], self[1][10])
        # pedals
        self.poutput1 = bundles.Splitter(self.domain, self[1][11])
        self.poutput2 = bundles.Splitter(self.domain, self[1][12])
        self.poutput3 = bundles.Splitter(self.domain, self[1][13])
        self.poutput4 = bundles.Splitter(self.domain, self[1][14])

        # now we need to set of outputs
        self.output = piw.sclone()
        self.output.set_filtered_output(OUT_KEY, self.kpoly.cookie(),
                                        piw.first_filter(OUT_KEY))
        self.output.set_filtered_output(OUT_STRIP_1, self.s1output.cookie(),
                                        piw.first_filter(OUT_STRIP_1))
        self.output.set_filtered_output(OUT_STRIP_2, self.s2output.cookie(),
                                        piw.first_filter(OUT_STRIP_2))
        self.output.set_filtered_output(OUT_BREATH, self.boutput.cookie(),
                                        piw.first_filter(OUT_BREATH))
        self.output.set_filtered_output(OUT_PEDAL_1, self.poutput1.cookie(),
                                        piw.first_filter(OUT_PEDAL_1))
        self.output.set_filtered_output(OUT_PEDAL_2, self.poutput2.cookie(),
                                        piw.first_filter(OUT_PEDAL_2))
        self.output.set_filtered_output(OUT_PEDAL_3, self.poutput3.cookie(),
                                        piw.first_filter(OUT_PEDAL_4))
        self.output.set_filtered_output(OUT_PEDAL_4, self.poutput4.cookie(),
                                        piw.first_filter(OUT_PEDAL_4))

        self.device = t3d_device(self.domain, self.output.cookie())

        self[1][15] = atom.Atom(names='controller output',
                                domain=domain.Aniso(),
                                init=self.controllerinit())

        self[3] = atom.Atom(domain=domain.BoundedInt(1, 30),
                            init=30,
                            policy=atom.default_policy(self.__row_size),
                            names='row size')
        self[4] = atom.Atom(domain=domain.BoundedInt(1, 5),
                            init=5,
                            policy=atom.default_policy(self.__col_size),
                            names='col size')
        self[5] = atom.Atom(domain=domain.Bool(),
                            init=False,
                            policy=atom.default_policy(self.__whole_roll),
                            names='whole roll')
        self[6] = atom.Atom(domain=domain.Bool(),
                            init=False,
                            policy=atom.default_policy(self.__whole_yaw),
                            names='whole yaw')
        self[7] = atom.Atom(domain=domain.BoundedInt(0, 9999),
                            init=3123,
                            policy=atom.default_policy(self.__server_port),
                            names='server port')

        self.input = bundles.VectorInput(self.device.cookie(),
                                         self.domain,
                                         signals=(IN_LIGHT, ))
        self[8] = atom.Atom(domain=domain.BoundedInt(0, 9999),
                            init=0,
                            policy=atom.default_policy(self.__light_port),
                            names='light port')
        self[9] = atom.Atom(domain=domain.Aniso(),
                            protocols='revconnect',
                            policy=self.input.vector_policy(IN_LIGHT,
                                                            False,
                                                            clocked=False),
                            names="light input")
        self[10] = atom.Atom(domain=domain.Bool(),
                             init=False,
                             policy=atom.default_policy(self.__continuous_key),
                             names='continuous key')
        self[11] = atom.Atom(domain=domain.Bool(),
                             init=True,
                             policy=atom.default_policy(self.__touch_mode),
                             names='touch mode')
        self[12] = atom.Atom(domain=domain.Bool(),
                             init=True,
                             policy=atom.default_policy(self.__quantize),
                             names='quantize')

        print "t3d device connect ", self[7], ",", self[8]
        self.device.connect(self[7].get_value(), self[8].get_value())
    def __init__(self, address, ordinal):
        #
        agent.Agent.__init__(self,
                             signature=version,
                             names='ableton push',
                             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(1, False, names='key output')
        self[1][2] = bundles.Output(2, False, names='pressure output')
        self[1][3] = bundles.Output(3, False, names='roll output')
        self[1][4] = bundles.Output(4, False, names='yaw output')

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

        self[1][6] = bundles.Output(1,
                                    False,
                                    names='strip position output',
                                    ordinal=1)
        self[1][7] = bundles.Output(2,
                                    False,
                                    names='absolute strip output',
                                    ordinal=1)
        self[1][8] = bundles.Output(1,
                                    False,
                                    names='strip position output',
                                    ordinal=2)
        self[1][9] = bundles.Output(2,
                                    False,
                                    names='absolute strip output',
                                    ordinal=2)

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

        # key outputs
        self.koutput = bundles.Splitter(self.domain, self[1][1], self[1][2],
                                        self[1][3], self[1][4])
        self.kpoly = piw.polyctl(10, self.koutput.cookie(), False, 5)
        # breath
        self.boutput = bundles.Splitter(self.domain, self[1][5])
        # strips
        self.s1output = bundles.Splitter(self.domain, self[1][6], self[1][7])
        self.s2output = bundles.Splitter(self.domain, self[1][8], self[1][9])
        # pedals
        self.poutput1 = bundles.Splitter(self.domain, self[1][10])
        self.poutput2 = bundles.Splitter(self.domain, self[1][11])
        self.poutput3 = bundles.Splitter(self.domain, self[1][12])
        self.poutput4 = bundles.Splitter(self.domain, self[1][13])

        self[5] = bundles.Output(OUT_MIDI, False, names="midi output")
        self.midi_output = bundles.Splitter(self.domain, self[5])

        # now we need to set of outputs
        self.output = piw.sclone()
        self.output.set_filtered_output(OUT_KEY, self.kpoly.cookie(),
                                        piw.first_filter(OUT_KEY))
        self.output.set_filtered_output(OUT_STRIP_1, self.s1output.cookie(),
                                        piw.first_filter(OUT_STRIP_1))
        self.output.set_filtered_output(OUT_STRIP_2, self.s2output.cookie(),
                                        piw.first_filter(OUT_STRIP_2))
        self.output.set_filtered_output(OUT_BREATH, self.boutput.cookie(),
                                        piw.first_filter(OUT_BREATH))
        self.output.set_filtered_output(OUT_PEDAL_1, self.poutput1.cookie(),
                                        piw.first_filter(OUT_PEDAL_1))
        self.output.set_filtered_output(OUT_PEDAL_2, self.poutput2.cookie(),
                                        piw.first_filter(OUT_PEDAL_2))
        self.output.set_filtered_output(OUT_PEDAL_3, self.poutput3.cookie(),
                                        piw.first_filter(OUT_PEDAL_4))
        self.output.set_filtered_output(OUT_PEDAL_4, self.poutput4.cookie(),
                                        piw.first_filter(OUT_PEDAL_4))
        self.output.set_filtered_output(OUT_MIDI, self.midi_output.cookie(),
                                        piw.first_filter(OUT_MIDI))

        self.device = midi_device(self.domain, self.output.cookie())

        self[1][14] = atom.Atom(names='controller output',
                                domain=domain.Aniso(),
                                init=self.controllerinit())

        self.input = bundles.VectorInput(self.device.cookie(),
                                         self.domain,
                                         signals=(
                                             IN_MIDI,
                                             IN_LIGHT,
                                         ))
        self[2] = atom.Atom(domain=domain.Aniso(),
                            policy=self.input.vector_policy(IN_MIDI, False),
                            names="midi input")
        self[4] = atom.Atom(domain=domain.Aniso(),
                            protocols='revconnect',
                            policy=self.input.vector_policy(IN_LIGHT,
                                                            False,
                                                            clocked=False),
                            names="light input")

        #values required for push
        self.device.channel(1)
        self.device.velocity_sample(4)
        self.device.enable_notes(True)
        self.device.enable_velocity(True)
        self.device.enable_poly_at(PRESSURE, True)
        self.device.set_data_freq(0)
        self.device.enable_control_notes(True)
        self.device.set_colour(1, 87)  # green
        self.device.set_colour(2, 4)  # red
        self.device.set_colour(3, 124)  #orange
        self.device.set_pb_map(STRIP_1, True)
Exemple #6
0
    def __init__(self, address, ordinal):
        #
        agent.Agent.__init__(self,
                             signature=version,
                             names='continuum',
                             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(1, False, names='key output')
        self[1][2] = bundles.Output(2, False, names='pressure output')
        self[1][3] = bundles.Output(3, False, names='roll output')
        self[1][4] = bundles.Output(4, False, names='yaw output')

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

        self[1][6] = bundles.Output(1,
                                    False,
                                    names='strip position output',
                                    ordinal=1)
        self[1][7] = bundles.Output(2,
                                    False,
                                    names='absolute strip output',
                                    ordinal=1)
        self[1][8] = bundles.Output(1,
                                    False,
                                    names='strip position output',
                                    ordinal=2)
        self[1][9] = bundles.Output(2,
                                    False,
                                    names='absolute strip output',
                                    ordinal=2)

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

        # key outputs
        self.koutput = bundles.Splitter(self.domain, self[1][1], self[1][2],
                                        self[1][3], self[1][4])
        self.kpoly = piw.polyctl(10, self.koutput.cookie(), False, 5)
        # breath
        self.boutput = bundles.Splitter(self.domain, self[1][5])
        # strips
        self.s1output = bundles.Splitter(self.domain, self[1][6], self[1][7])
        self.s2output = bundles.Splitter(self.domain, self[1][8], self[1][9])
        # pedals
        self.poutput1 = bundles.Splitter(self.domain, self[1][10])
        self.poutput2 = bundles.Splitter(self.domain, self[1][11])
        self.poutput3 = bundles.Splitter(self.domain, self[1][12])
        self.poutput4 = bundles.Splitter(self.domain, self[1][13])

        self[5] = bundles.Output(OUT_MIDI, False, names="midi output")
        self.midi_output = bundles.Splitter(self.domain, self[5])

        # now we need to set of outputs
        self.output = piw.sclone()
        self.output.set_filtered_output(OUT_KEY, self.kpoly.cookie(),
                                        piw.first_filter(OUT_KEY))
        self.output.set_filtered_output(OUT_STRIP_1, self.s1output.cookie(),
                                        piw.first_filter(OUT_STRIP_1))
        self.output.set_filtered_output(OUT_STRIP_2, self.s2output.cookie(),
                                        piw.first_filter(OUT_STRIP_2))
        self.output.set_filtered_output(OUT_BREATH, self.boutput.cookie(),
                                        piw.first_filter(OUT_BREATH))
        self.output.set_filtered_output(OUT_PEDAL_1, self.poutput1.cookie(),
                                        piw.first_filter(OUT_PEDAL_1))
        self.output.set_filtered_output(OUT_PEDAL_2, self.poutput2.cookie(),
                                        piw.first_filter(OUT_PEDAL_2))
        self.output.set_filtered_output(OUT_PEDAL_3, self.poutput3.cookie(),
                                        piw.first_filter(OUT_PEDAL_4))
        self.output.set_filtered_output(OUT_PEDAL_4, self.poutput4.cookie(),
                                        piw.first_filter(OUT_PEDAL_4))
        self.output.set_filtered_output(OUT_MIDI, self.midi_output.cookie(),
                                        piw.first_filter(OUT_MIDI))

        self.device = midi_device(self.domain, self.output.cookie())

        self[1][14] = atom.Atom(names='controller output',
                                domain=domain.Aniso(),
                                init=self.controllerinit())

        self.input = bundles.VectorInput(self.device.cookie(),
                                         self.domain,
                                         signals=(IN_MIDI, ))
        self[2] = atom.Atom(domain=domain.Aniso(),
                            policy=self.input.vector_policy(IN_MIDI, False),
                            names="midi input")

        self[3] = atom.Atom(names="inputs")
        self[3][1] = atom.Atom(domain=domain.BoundedInt(0, 16),
                               init=0,
                               policy=atom.default_policy(self.__channel),
                               names='midi channel')

        self.device.set_data_freq(500)
        self.device.enable_notes(True)
        self.device.enable_velocity(True)
        self.device.velocity_sample(
            0
        )  #? Id have thought this should be >1, but perhaps we were using pressure only
        self.device.set_pb_map(ROLL, True)
        self.device.set_hires_pb_map(ROLL, 85)

        self.device.enable_hires_cc(True)
        self.device.enable_chan_at(PRESSURE, False)
        self.device.enable_poly_at(PRESSURE, False)

        self.device.set_cc_map(PRESSURE, 11)
        self.device.set_hires_cc_map(PRESSURE, 86)
        self.device.set_cc_map(ROLL, -1)
        self.device.set_hires_cc_map(ROLL, -1)
        self.device.set_cc_map(YAW, 74)
        self.device.set_hires_cc_map(YAW, 87)
        self.device.set_cc_map(STRIP_1, 1)
        self.device.set_cc_map(STRIP_2, 6)
        self.device.set_cc_map(PEDAL_1, -1)
        self.device.set_cc_map(PEDAL_2, -1)
        self.device.set_cc_map(PEDAL_3, -1)
        self.device.set_cc_map(PEDAL_4, -1)
Exemple #7
0
    def __init__(self, address, ordinal):
        #
        agent.Agent.__init__(self,
                             signature=version,
                             names='midi device',
                             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(1, False, names='key output')
        self[1][2] = bundles.Output(2, False, names='pressure output')
        self[1][3] = bundles.Output(3, False, names='roll output')
        self[1][4] = bundles.Output(4, False, names='yaw output')

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

        self[1][6] = bundles.Output(1,
                                    False,
                                    names='strip position output',
                                    ordinal=1)
        self[1][7] = bundles.Output(2,
                                    False,
                                    names='absolute strip output',
                                    ordinal=1)
        self[1][8] = bundles.Output(1,
                                    False,
                                    names='strip position output',
                                    ordinal=2)
        self[1][9] = bundles.Output(2,
                                    False,
                                    names='absolute strip output',
                                    ordinal=2)

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

        # key outputs
        self.koutput = bundles.Splitter(self.domain, self[1][1], self[1][2],
                                        self[1][3], self[1][4])
        self.kpoly = piw.polyctl(10, self.koutput.cookie(), False, 5)
        # breath
        self.boutput = bundles.Splitter(self.domain, self[1][5])
        # strips
        self.s1output = bundles.Splitter(self.domain, self[1][6], self[1][7])
        self.s2output = bundles.Splitter(self.domain, self[1][8], self[1][9])
        # pedals
        self.poutput1 = bundles.Splitter(self.domain, self[1][10])
        self.poutput2 = bundles.Splitter(self.domain, self[1][11])
        self.poutput3 = bundles.Splitter(self.domain, self[1][12])
        self.poutput4 = bundles.Splitter(self.domain, self[1][13])

        self[5] = bundles.Output(OUT_MIDI, False, names="midi output")
        self.midi_output = bundles.Splitter(self.domain, self[5])

        # now we need to set of outputs
        self.output = piw.sclone()
        self.output.set_filtered_output(OUT_KEY, self.kpoly.cookie(),
                                        piw.first_filter(OUT_KEY))
        self.output.set_filtered_output(OUT_STRIP_1, self.s1output.cookie(),
                                        piw.first_filter(OUT_STRIP_1))
        self.output.set_filtered_output(OUT_STRIP_2, self.s2output.cookie(),
                                        piw.first_filter(OUT_STRIP_2))
        self.output.set_filtered_output(OUT_BREATH, self.boutput.cookie(),
                                        piw.first_filter(OUT_BREATH))
        self.output.set_filtered_output(OUT_PEDAL_1, self.poutput1.cookie(),
                                        piw.first_filter(OUT_PEDAL_1))
        self.output.set_filtered_output(OUT_PEDAL_2, self.poutput2.cookie(),
                                        piw.first_filter(OUT_PEDAL_2))
        self.output.set_filtered_output(OUT_PEDAL_3, self.poutput3.cookie(),
                                        piw.first_filter(OUT_PEDAL_4))
        self.output.set_filtered_output(OUT_PEDAL_4, self.poutput4.cookie(),
                                        piw.first_filter(OUT_PEDAL_4))
        self.output.set_filtered_output(OUT_MIDI, self.midi_output.cookie(),
                                        piw.first_filter(OUT_MIDI))

        self.device = midi_device(self.domain, self.output.cookie())

        self[1][14] = atom.Atom(names='controller output',
                                domain=domain.Aniso(),
                                init=self.controllerinit())

        self.input = bundles.VectorInput(self.device.cookie(),
                                         self.domain,
                                         signals=(
                                             IN_MIDI,
                                             IN_LIGHT,
                                         ))
        self[2] = atom.Atom(domain=domain.Aniso(),
                            policy=self.input.vector_policy(IN_MIDI, False),
                            names="midi input")
        self[4] = atom.Atom(domain=domain.Aniso(),
                            protocols='revconnect',
                            policy=self.input.vector_policy(IN_LIGHT,
                                                            False,
                                                            clocked=False),
                            names="light input")

        self[3] = atom.Atom(names="inputs")
        self[3][1] = atom.Atom(domain=domain.BoundedInt(0, 16),
                               init=0,
                               policy=atom.default_policy(self.__channel),
                               names='midi channel')
        self[3][2] = atom.Atom(domain=domain.BoundedInt(0, 64),
                               init=4,
                               policy=atom.default_policy(
                                   self.__velocity_sample),
                               names='velocity sample')
        self[3][3] = atom.Atom(domain=domain.Bool(),
                               init=True,
                               policy=atom.default_policy(self.__enable_notes),
                               names='notes enable')
        self[3][4] = atom.Atom(domain=domain.Bool(),
                               init=True,
                               policy=atom.default_policy(
                                   self.__enable_velocity),
                               names='notes velocity enable')
        self[3][5] = atom.Atom(domain=domain.BoundedInt(-1, 127),
                               init=-1,
                               policy=atom.default_policy(self.__set_note_cc),
                               names='note control')
        self[3][6] = atom.Atom(domain=domain.BoundedInt(-1, 127),
                               init=-1,
                               policy=atom.default_policy(
                                   self.__set_note_cc_pressure),
                               names='note pressure control')
        # here we are just setting up some common ones to start with, and reasonable defaults
        self[3][7] = atom.Atom(domain=domain.Bool(),
                               init=True,
                               policy=atom.default_policy(
                                   self.__enable_pb_roll),
                               names='pitch bend roll enable')
        self[3][8] = atom.Atom(domain=domain.BoundedInt(-1, 127),
                               init=-1,
                               policy=atom.default_policy(
                                   self.__set_yaw_control),
                               names='yaw control')
        self[3][9] = atom.Atom(domain=domain.Bool(),
                               init=False,
                               policy=atom.default_policy(
                                   self.__set_chan_at_cc),
                               names='channel pressure')
        self[3][10] = atom.Atom(domain=domain.Bool(),
                                init=False,
                                policy=atom.default_policy(
                                    self.__set_poly_at_cc),
                                names='polyphonic pressure')
        self[3][11] = atom.Atom(domain=domain.Bool(),
                                init=False,
                                policy=atom.default_policy(
                                    self.__set_hires_cc),
                                names='high resolution control')

        self[3][12] = atom.Atom(domain=domain.BoundedInt(-1, 127),
                                init=2,
                                policy=atom.default_policy(
                                    self.__set_breath_control),
                                names='breath control')
        self[3][13] = atom.Atom(domain=domain.Bool(),
                                init=True,
                                policy=atom.default_policy(
                                    self.__set_breath_release),
                                names='breath release')
        self[3][14] = atom.Atom(domain=domain.Bool(),
                                init=True,
                                policy=atom.default_policy(
                                    self.__set_breath_bipolar),
                                names='breath bipolar')
        self[3][15] = atom.Atom(domain=domain.Bool(),
                                init=False,
                                policy=atom.default_policy(
                                    self.__set_breath_relative),
                                names='breath relative')
        self[3][16] = atom.Atom(domain=domain.BoundedInt(-1, 127),
                                init=1,
                                policy=atom.default_policy(
                                    self.__set_strip_1_control),
                                names='strip 1 control')
        self[3][17] = atom.Atom(domain=domain.Bool(),
                                init=True,
                                policy=atom.default_policy(
                                    self.__set_strip_1_release),
                                names='strip 1 release')
        self[3][18] = atom.Atom(domain=domain.Bool(),
                                init=True,
                                policy=atom.default_policy(
                                    self.__set_strip_1_bipolar),
                                names='strip 1 bipolar')
        # self[3][19]  = atom.Atom(domain=domain.Bool(),init=False,policy=atom.default_policy(self.__set_strip_1_relative),names='strip 1 relative')
        self[3][20] = atom.Atom(domain=domain.BoundedInt(-1, 127),
                                init=-1,
                                policy=atom.default_policy(
                                    self.__set_strip_2_control),
                                names='strip 2 control')
        self[3][21] = atom.Atom(domain=domain.Bool(),
                                init=True,
                                policy=atom.default_policy(
                                    self.__set_strip_2_release),
                                names='strip 2 release')
        self[3][22] = atom.Atom(domain=domain.Bool(),
                                init=False,
                                policy=atom.default_policy(
                                    self.__set_strip_2_bipolar),
                                names='strip 2 bipolar')
        # self[3][23]  = atom.Atom(domain=domain.Bool(),init=True,policy=atom.default_policy(self.__set_strip_2_relative),names='strip 1 relative')

        self[3][24] = atom.Atom(domain=domain.BoundedInt(-1, 127),
                                init=-1,
                                policy=atom.default_policy(
                                    self.__set_roll_control),
                                names='roll control')
        self[3][25] = atom.Atom(domain=domain.BoundedInt(0, 5000),
                                init=0,
                                policy=atom.default_policy(
                                    self.__set_data_freq),
                                names='data frequency')
        self[3][26] = atom.Atom(domain=domain.BoundedInt(-1, 127),
                                init=-1,
                                policy=atom.default_policy(
                                    self.__set_pressure_control),
                                names='pressure control')

        self[3][27] = atom.Atom(domain=domain.BoundedInt(-1, 127),
                                init=-1,
                                policy=atom.default_policy(
                                    self.__set_hires_pressure_control),
                                names='pressure high control')
        self[3][28] = atom.Atom(domain=domain.BoundedInt(-1, 127),
                                init=-1,
                                policy=atom.default_policy(
                                    self.__set_hires_roll_control),
                                names='roll high control')
        self[3][29] = atom.Atom(domain=domain.BoundedInt(-1, 127),
                                init=-1,
                                policy=atom.default_policy(
                                    self.__set_hires_yaw_control),
                                names='yaw high control')
        self[3][30] = atom.Atom(domain=domain.BoundedInt(-1, 127),
                                init=-1,
                                policy=atom.default_policy(
                                    self.__set_hires_pb_control),
                                names='pitch bend high control')

        self[3][31] = atom.Atom(domain=domain.Bool(),
                                init=False,
                                policy=atom.default_policy(
                                    self.__enable_control_notes),
                                names='notes control enable')
        self[3][32] = atom.Atom(domain=domain.BoundedInt(-1, 127),
                                init=-1,
                                policy=atom.default_policy(
                                    self.__set_pedal_1_control),
                                names='pedal 1 control')
        self[3][33] = atom.Atom(domain=domain.BoundedInt(-1, 127),
                                init=-1,
                                policy=atom.default_policy(
                                    self.__set_pedal_2_control),
                                names='pedal 2 control')
        self[3][34] = atom.Atom(domain=domain.BoundedInt(-1, 127),
                                init=-1,
                                policy=atom.default_policy(
                                    self.__set_pedal_3_control),
                                names='pedal 3 control')
        self[3][35] = atom.Atom(domain=domain.BoundedInt(-1, 127),
                                init=-1,
                                policy=atom.default_policy(
                                    self.__set_pedal_4_control),
                                names='pedal 4 control')

        self[3][36] = atom.Atom(domain=domain.BoundedInt(-1, 127),
                                init=0,
                                policy=atom.default_policy(
                                    self.__set_off_colour),
                                names='off colour')
        self[3][37] = atom.Atom(domain=domain.BoundedInt(-1, 127),
                                init=4,
                                policy=atom.default_policy(
                                    self.__set_red_colour),
                                names='red colour')
        self[3][38] = atom.Atom(domain=domain.BoundedInt(-1, 127),
                                init=124,
                                policy=atom.default_policy(
                                    self.__set_orange_colour),
                                names='orange colour')
        self[3][39] = atom.Atom(domain=domain.BoundedInt(-1, 127),
                                init=87,
                                policy=atom.default_policy(
                                    self.__set_green_colour),
                                names='green colour')
        self[3][40] = atom.Atom(domain=domain.Bool(),
                                init=True,
                                policy=atom.default_policy(
                                    self.__enable_pb_strip_1),
                                names='pitch bend strip 1 enable')
        self[3][41] = atom.Atom(domain=domain.Bool(),
                                init=True,
                                policy=atom.default_policy(
                                    self.__enable_pb_strip_2),
                                names='pitch bend strip 2 enable')