Beispiel #1
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='alpha manager',
                             protocols='has_subsys',
                             ordinal=ordinal)
        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*', 0L))

        self.__thing = piw.thing()
        piw.tsd_thing(self.__thing)
        self.__thing.set_slow_dequeue_handler(utils.changify(self.__dequeue))

        self.__base = dict()

        self.__enum = []

        lsf = lambda c: picross.make_string_functor(
            utils.make_locked_callable(c))
        self.__enum.append(
            picross.enumerator(0xbeca, 0x0102, lsf(self.add_alpha2keyboard)))
        self.__enum.append(
            picross.enumerator(0xbeca, 0x0103, lsf(self.add_taukeyboard)))
        self.__enum.append(
            picross.enumerator(0x2139, 0x0002,
                               lsf(self.download_base_station)))
        self.__enum.append(
            picross.enumerator(0x2139, 0x0003, lsf(self.download_psu)))
        self.__enum.append(
            picross.enumerator(0x2139, 0x0104, lsf(self.add_base_station),
                               lsf(self.del_base_station)))
        self.__enum.append(
            picross.enumerator(0x2139, 0x0105, lsf(self.add_base_station),
                               lsf(self.del_base_station)))
Beispiel #2
0
 def __init__(self, cdomain, policy=None, functor=None):
     self.__policy = policy or ThrottleStreamPolicy(10)
     f = functor or piw.slowchange(utils.changify(self.__dump))
     self.__backend = piw.functor_backend(1, False)
     self.__backend.set_gfunctor(utils.make_change_nb(f))
     self.__correlator = piw.correlator(cdomain, chr(1), piw.null_filter(),
                                        self.__backend.cookie(), 0, 0)
Beispiel #3
0
    def get_controller_backend(self, config):
        if self.__ctrl is None:
            self.__ctrl = FunctorController(
                self.__clock_domain,
                functor=piw.slowchange(utils.changify(self.__slow_handler)))

        return self.__ctrl.get_backend(config)
Beispiel #4
0
 def __init__(self,
              atom,
              data_domain,
              init,
              transient,
              handler,
              stream_policy=None,
              clock=True):
     self.__stream_policy = stream_policy or ThrottleStreamPolicy(500)
     self.__handler = handler
     self.__slow_handler = utils.fastchange(self.__handler)
     self.__ctl_handler = piw.change2(
         self.__slow_handler,
         piw.slowchange(utils.changify(self.__control)))
     self.__clock_domain = piw.clockdomain_ctl()
     self.__clock_domain.set_source(piw.makestring('*', 0L))
     self.__clock = piw.clocksink()
     self.__clock_domain.sink(self.__clock, 'FastPolicy')
     self.__upstream = None
     self.__backend = None
     self.__correlator = None
     self.__ctrl = None
     ConnectablePolicyImpl.__init__(self, atom, data_domain, init, clock,
                                    node.Server(transient=transient), False)
     self.data_node().set_change_handler(self.__slow_handler)
     self.data_node().set_data(self.get_domain().value2data(init))
Beispiel #5
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='labeler',
                             ordinal=ordinal)

        self.domain = piw.clockdomain_ctl()

        self[1] = atom.Atom(
            domain=domain.Aniso(hints=(logic.make_term('continuous'), )),
            names='controller output',
            policy=atom.readonly_policy())

        self[2] = atom.Atom(domain=domain.String(),
                            init='Label',
                            names='label category',
                            policy=atom.default_policy(self.__set_category))
        self[3] = atom.Atom(domain=domain.String(),
                            init='',
                            names='label',
                            policy=atom.default_policy(self.__set_label))

        self.ctl_functor = piw.functor_backend(1, True)
        self.ctl_input = bundles.VectorInput(self.ctl_functor.cookie(),
                                             self.domain,
                                             signals=(1, ))
        self[4] = atom.Atom(domain=domain.Aniso(),
                            policy=self.ctl_input.vector_policy(1, False),
                            names='controller input')
        self.ctl_functor.set_functor(
            piw.pathnull(0),
            utils.make_change_nb(
                piw.slowchange(utils.changify(self.__controller_input))))

        self.__ctl = []
Beispiel #6
0
 def __key_changed(self):
     self.agent.light_convertor.remove_status_handler(self.index)
     t = self.__make_key_coordinate()
     self.__event.set_key(t)
     self.key_mapper.set_functor(piw.d2d_const(t.make_data(0)))
     self.agent.light_convertor.set_status_handler(
         self.index, t, piw.slowchange(utils.changify(self.set_status)))
     self.agent.light_convertor.set_default_color(
         self.index,
         self.get_internal(247).get_value())
Beispiel #7
0
    def __define_fast(self, ctx, subject, value, name):
        n = action.abstract_string(name)
        v = logic.render_term(value)
        var, ind = self.create_alternative(n, v)

        def changer(dummy):
            if not dummy.is_null() and dummy.as_norm() != 0.0:
                self.set_var(n, v)

        return (piw.slowchange(utils.changify(changer)), (var, ind))
Beispiel #8
0
 def __ocreate(self, ctx, subj, dummy, arg):
     val = float(action.abstract_string(arg))
     print 'ocreate', ctx, subj, arg, val
     if val < -72 or val > 72:
         return async .failure('offset inappropriate')
     b = piw.change2(
         self.bender.set_offset(),
         piw.slowchange_polled(
             utils.changify(self[9].get_policy().set_data), 5000))
     return piw.trigger(b, piw.makefloat_nb(val, 0)), None
Beispiel #9
0
 def __init__(self,agent,controller,index):
     atom.Atom.__init__(self,creator=self.__create,wrecker=self.__wreck,ordinal=index,names='key')
     self.__event = piw.fasttrigger(const.light_unknown)
     self.__event.attach_to(controller,index)
     self.__handler = piw.change2_nb(self.__event.trigger(),utils.changify(self.event_triggered))
     self.key_aggregator = piw.aggregator(agent.light_aggregator.get_output(index+1),agent.domain)
     self.agent = agent
     self.index = index
     self.set_private(node.Server(value=piw.makelong(3,0),change=self.__change_color))
     self.set_internal(250,atom.Atom(domain=domain.Trigger(),init=False,names='activate',policy=policy.TriggerPolicy(self.__handler),transient=True))
Beispiel #10
0
    def __create_action(self, index, ctx, *arg):
        s = self.__verblist[index]

        if s.create_action:
            return s.create_action(ctx, *arg)

        def func(value):
            if not value.is_null() and value.as_norm() != 0:
                s.callback(*arg)

        downshifter = piw.slowchange(utils.changify(func))
        return (downshifter, downshifter)
Beispiel #11
0
 def create_plumber(self, init, address, filter, slot, clocked):
     if init:
         self.__backend = piw.functor_backend(1, True)
         self.__backend.set_functor(
             piw.pathnull(0),
             utils.make_change_nb(
                 piw.slowchange(utils.changify(self.__slow_handler))))
         self.__correlator = piw.correlator(self.__clock_domain, chr(1),
                                            piw.root_filter(),
                                            self.__backend.cookie(), 0, 0)
     return Plumber(self.__correlator, 1, slot, -1, Plumber.input_input,
                    self.__stream_policy, address, filter, clocked, None)
Beispiel #12
0
    def __init__(self, callback):
        node.Server.__init__(self, rtransient=True)
        self.__buffer = []
        self.__current = ''
        self.__next = 1
        self.__callback = callback
        self.__recogniser = language_native.wordrec(
            utils.changify(self.__keyinput))

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

        self.__setup()
Beispiel #13
0
    def get_data_backend(self, config):
        if self.__correlator is None:
            self.__backend = piw.functor_backend(1, True)
            self.__backend.set_functor(
                piw.pathnull(0),
                utils.make_change_nb(
                    piw.slowchange(utils.changify(self.__slow_handler))))
            self.__correlator = piw.correlator(self.__clock_domain, chr(1),
                                               piw.root_filter(),
                                               self.__backend.cookie(), 0, 0)

        return PlumberBackend(self.__correlator, self.__stream_policy, 1,
                              Plumber.input_input, -1, config.iid)
Beispiel #14
0
    def widget_rpc(self,method,arg):
        result = async.Deferred()

        def completed(rv):
            if not rv.is_string():
                result.failed()
            else:   
                result.succeeded(rv.as_string())

        darg = piw.makestring(arg,0);
        if not self.__widget.invoke_rpc(method,darg,utils.changify(completed)):
            result.failed()

        return result
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self, signature=version, names='tabulator', ordinal=ordinal)
        
        self.domain = piw.clockdomain_ctl()

        self[5] = bundles.Output(1, False, names='status output')
        self.status_output = bundles.Splitter(self.domain, self[5])
        self.lights = piw.lightsource(piw.change_nb(), 0, self.status_output.cookie())
        self.lights.set_size(1)        

        self.cfunctor = piw.functor_backend(1, False)
        self.cinput = bundles.VectorInput(self.cfunctor.cookie(), self.domain, signals=(1,))
        self[1] = atom.Atom(domain=domain.Aniso(), policy=self.cinput.vector_policy(1,False), names='controller input')
        self.cfunctor.set_gfunctor(utils.make_change_nb(piw.slowchange(utils.changify(self.__controller))))

        self.keyfunctor = piw.functor_backend(1, False)
        self.keyinput = bundles.VectorInput(self.keyfunctor.cookie(), self.domain, signals=(1,))
        self[2] = atom.Atom(domain=domain.Aniso(), policy=self.keyinput.vector_policy(1,False), names='key input')
        self.keyfunctor.set_gfunctor(utils.make_change_nb(piw.slowchange(utils.changify(self.__key))))

        self[3] = atom.Atom(domain=domain.BoundedInt(1,100), init=DEFAULT_CHORD_TIMEOUT, policy=atom.default_policy(self.__set_chordtimeout), names='chord timeout')
        self[4] = atom.Atom(domain=domain.BoundedInt(80,200), init=DEFAULT_PAGE_WIDTH, policy=atom.default_policy(self.__set_pagewidth), names='page width')
        self[6] = atom.Atom(domain=domain.Bool(), init=False, names='start', policy=atom.default_policy(self.__change_start))

        self.add_verb2(1,'start([],None)',self.__start,status_action=self.__status)
        self.add_verb2(2,'stop([],None)',self.__stop,status_action=self.__status)
        self.add_verb2(3,'start([toggle],None)',self.__toggle,status_action=self.__status)

        self.__set_chordtimeout(DEFAULT_CHORD_TIMEOUT)
        self.__set_pagewidth(DEFAULT_PAGE_WIDTH)

        self.__courselen = None
        self.__coursesqueue = None
        self.__coursesrender = None
        self.__lasttime = None
        
        self.__update_status()
Beispiel #16
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
Beispiel #17
0
    def __init__(self, scheduler, index):
        self.scheduler = scheduler
        self.index = index
        self.event = piw.event(scheduler.scheduler, False,
                               utils.changify(self.__enable_changed))
        self.event.set_self_light(const.status_selector_off)

        talker.Talker.__init__(
            self,
            scheduler.finder,
            self.event.fastdata(),
            self.scheduler.light_aggregator.get_output(index),
            names='event',
            ordinal=index,
            protocols='remove')

        self[3] = atom.Atom(domain=domain.String(),
                            policy=atom.default_policy(self.__change_schema),
                            names='schema')
        self[4] = atom.Atom(domain=domain.Bool(),
                            init=False,
                            policy=atom.default_policy(self.__change_enabled),
                            names='enabled')
Beispiel #18
0
    def __init__(self, callback, *args, **kwds):
        self.__scroller = piw.scroller2(utils.changify(callback))
        atom.Atom.__init__(self, *args, **kwds)

        self[1] = atom.Atom(domain=domain.BoundedInt(-32767, 32767),
                            names='column',
                            init=None,
                            policy=atom.default_policy(self.__change_column))
        self[2] = atom.Atom(domain=domain.BoundedInt(-32767, 32767),
                            names='row',
                            init=None,
                            policy=atom.default_policy(self.__change_row))
        self[3] = atom.Atom(domain=domain.Bool(),
                            names='column end relative',
                            init=False,
                            policy=atom.default_policy(
                                self.__change_column_endrel))
        self[4] = atom.Atom(domain=domain.Bool(),
                            names='row end relative',
                            init=False,
                            policy=atom.default_policy(
                                self.__change_row_endrel))
        self.__key_changed()
Beispiel #19
0
    def get_controller_backend(self,config):
        if self.__ctrl is None:
            f=piw.slowchange(utils.changify(self.__change))
            self.__ctrl = policy.FunctorController(self.__input.clock_domain,functor=f)

        return self.__ctrl.get_backend(config)
Beispiel #20
0
 def __create(self,i):
     self.agent.light_convertor.set_status_handler(self.index, piw.slowchange(utils.changify(self.set_status)))
     self.agent.update()
     return Event(self,self.__event.fastdata(),'',i)
Beispiel #21
0
 def __init__(self, manager):
     atom.Atom.__init__(self,domain=domain.String(),names='clip manager',transient=True,policy=atom.default_policy(self.__recv_change),protocols="widget-clipmanager")
     self.__widget = conductor_native.widget(utils.changify(self.__send_change));
     self.set_value("");
     manager.initialise_widget(self.__widget)
Beispiel #22
0
    def __init__(self, usbname, ordinal, dom, remove):
        agent.Agent.__init__(self,
                             names='keyboard micro',
                             ordinal=ordinal,
                             subsystem='kbd',
                             volatile=True,
                             signature=version,
                             container=102,
                             protocols='is_subsys')

        self.usbname = usbname
        self.remover = remove

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

        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[17] = bundles.Output(5, False, names='key output')

        self[5] = bundles.Output(1, False, names='strip position output')
        self[6] = bundles.Output(2, False, names='breath 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[2], self[3], self[4],
                                        self[17])
        self.kpoly = piw.polyctl(10, self.koutput.cookie(), False, 5)
        self.aoutput = bundles.Splitter(self.domain, self[5], 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.aoutput.cookie(),
                                        piw.first_filter(2))
        self.keyboard = ukbd_native.bundle(usbname, self.kclone.cookie(),
                                           utils.notify(self.dead),
                                           utils.changify(self.signal))

        self[100] = VirtualKey()

        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))

        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.__controllerinit())
Beispiel #23
0
 def __init__(self, func):
     piw.scroller2.__init__(self, utils.changify(func))
Beispiel #24
0
 def __init__(self,list,data=None):
     self.__list = list
     node.Server.__init__(self,change=utils.changify(self.__list.state_changed))
     if data is not None:
         self.set_data(data)
Beispiel #25
0
 def create_controller(self):
     return FunctorController(self.__clock_domain,
                              functor=piw.slowchange(
                                  utils.changify(self.__slow_handler)))
Beispiel #26
0
def sc(f):
    return piw.slowchange(utils.changify(f))
Beispiel #27
0
 def __init__(self, handler):
     node.Client.__init__(self)
     self.__handler = utils.changify(handler)
     self.__unplumber = None
Beispiel #28
0
 def create_controller(self):
     f = piw.slowchange(utils.changify(self.__change))
     return policy.FunctorController(self.__input.clock_domain, functor=f)
Beispiel #29
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='audio unit',
                             container=100,
                             ordinal=ordinal)

        self.__state = PluginState(self.__plugin_state_loaded)
        self.set_private(self.__state)

        self.__browser = PluginBrowser(self)
        self.__domain = piw.clockdomain_ctl()
        self.__audio_output = audio.AudioOutput(bundles.Splitter(
            self.__domain),
                                                1,
                                                2,
                                                names='channels')
        self.__audio_output_channels = audio.AudioChannels(self.__audio_output)
        self.__midi_output = bundles.Splitter(self.__domain)
        self.__observer = PluginObserver(self.__state, self)
        self.host = host_native.plugin_instance(
            self.__observer, self.__domain, self.__audio_output.cookie(),
            self.__midi_output.cookie(),
            utils.statusify(self.__window_state_changed))
        self.parameter_list = inputparameter.List(self.host,
                                                  self.host.clock_domain(),
                                                  self.verb_container())
        self.__audio_input = audio.AudioInput(bundles.ScalarInput(
            self.host.audio_input_cookie(),
            self.__domain,
            signals=range(1, 65)),
                                              1,
                                              2,
                                              names='channels')
        self.__audio_input_channels = audio.AudioChannels(self.__audio_input)
        self.__key_input = bundles.VectorInput(
            self.host.midi_from_belcanto_cookie(),
            self.__domain,
            signals=(1, 2))
        self.__midi_input = bundles.ScalarInput(
            self.host.midi_aggregator_cookie(), self.__domain, signals=(1, ))
        self.__metronome_input = bundles.ScalarInput(
            self.host.metronome_input_cookie(),
            self.__domain,
            signals=(1, 2, 3, 4))
        self.host.set_bypassed(True)

        # plugin browser
        self[1] = self.__browser

        # audio output
        self[2] = atom.Atom(names='audio outputs')
        self[2][1] = self.__audio_output
        self[2][2] = self.__audio_output_channels

        # audio input
        self[3] = atom.Atom(names='audio inputs')
        self[3][1] = self.__audio_input
        self[3][2] = self.__audio_input_channels

        # parameter mapping
        self[4] = self.parameter_list

        # metronome input
        self[5] = atom.Atom(names='metronome inputs')
        self[5][1] = atom.Atom(domain=domain.Aniso(),
                               policy=self.__metronome_input.nodefault_policy(
                                   1, False),
                               names='song beat input')
        self[5][2] = atom.Atom(domain=domain.Aniso(),
                               policy=self.__metronome_input.nodefault_policy(
                                   2, False),
                               names='running input')
        self[5][3] = atom.Atom(domain=domain.Aniso(),
                               policy=self.__metronome_input.nodefault_policy(
                                   3, False),
                               names='tempo input')
        self[5][4] = atom.Atom(domain=domain.Aniso(),
                               policy=self.__metronome_input.nodefault_policy(
                                   4, False),
                               names='bar beat input')

        # kbd/controller inputs
        self[6] = atom.Atom(names='musical inputs')
        self[6][1] = atom.Atom(domain=domain.Aniso(),
                               policy=self.__key_input.vector_policy(1, False),
                               names='pressure input')
        self[6][2] = atom.Atom(domain=domain.Aniso(),
                               policy=self.__key_input.merge_nodefault_policy(
                                   2, False),
                               names='frequency input')

        # midi channel
        self[7] = atom.Atom(domain=domain.BoundedInt(0, 20),
                            init=0,
                            names='midi channel',
                            policy=atom.default_policy(self.set_midi_channel))

        # velocity curve control
        vel = (T('stageinc', 0.1), T('inc', 0.1), T('biginc',
                                                    1), T('control', 'updown'))
        self[8] = atom.Atom(names='velocity curve controls')
        self[8][1] = atom.Atom(domain=domain.BoundedInt(1, 1000),
                               init=4,
                               names='velocity sample',
                               policy=atom.default_policy(
                                   self.__set_velocity_samples))
        self[8][2] = atom.Atom(domain=domain.BoundedFloat(0.1, 10, hints=vel),
                               init=4,
                               names='velocity curve',
                               policy=atom.default_policy(
                                   self.__set_velocity_curve))
        self[8][3] = atom.Atom(domain=domain.BoundedFloat(0.1, 10, hints=vel),
                               init=4,
                               names='velocity scale',
                               policy=atom.default_policy(
                                   self.__set_velocity_scale))

        self[9] = atom.Atom(domain=domain.Bool(),
                            init=True,
                            names='tail time enable',
                            policy=atom.default_policy(
                                self.__set_tail_time_enabled))
        self[10] = atom.Atom(domain=domain.BoundedFloatOrNull(0, 100000),
                             init=10,
                             names='tail time',
                             policy=atom.default_policy(self.__set_tail_time))
        self[11] = atom.Atom(domain=domain.BoundedInt(1, 16),
                             init=1,
                             names='minimum channel',
                             policy=atom.default_policy(self.set_min_channel))
        self[12] = atom.Atom(domain=domain.BoundedInt(1, 16),
                             init=16,
                             names='maximum channel',
                             policy=atom.default_policy(self.set_max_channel))

        # other global settings inputs
        self[20] = atom.Atom(domain=domain.BoundedInt(0, 100),
                             init=0,
                             names="minimum decimation",
                             policy=atom.default_policy(
                                 self.set_min_decimation))
        self[21] = atom.Atom(domain=domain.Bool(),
                             init=True,
                             names="notes enable",
                             policy=atom.default_policy(self.set_midi_notes))
        self[22] = atom.Atom(domain=domain.Bool(),
                             init=True,
                             names="pitch bend enable",
                             policy=atom.default_policy(
                                 self.set_midi_pitchbend))
        self[23] = atom.Atom(domain=domain.Bool(),
                             init=False,
                             names="high resolution velocity enable",
                             policy=atom.default_policy(
                                 self.set_midi_hires_velocity))
        self[24] = atom.Atom(domain=domain.BoundedInt(0, 96),
                             init=1,
                             names="pitch bend range upper",
                             policy=atom.default_policy(self.set_pitchbend_up))
        self[25] = atom.Atom(domain=domain.BoundedInt(0, 96),
                             init=1,
                             names="pitch bend range lower",
                             policy=atom.default_policy(
                                 self.set_pitchbend_down))

        # status output to drive the talker lights
        self[13] = bundles.Output(1, False, names='status output')
        self.light_output = bundles.Splitter(self.__domain, self[13])
        self.lights = piw.lightsource(piw.change_nb(), 0,
                                      self.light_output.cookie())
        self.lights.set_size(2)
        self.set_light(1, True)
        self.set_light(2, False)

        # midi I/O
        # midi input
        self[14] = atom.Atom(domain=domain.Aniso(),
                             policy=self.__midi_input.nodefault_policy(
                                 1, False),
                             names='midi input')
        # midi output
        self[15] = self.__midi_output.add_output(
            bundles.Output(1, False, names='midi output'))

        # controller input/output to add labels
        self[16] = atom.Atom(
            domain=domain.Aniso(hints=(logic.make_term('continuous'), )),
            names='controller output',
            policy=atom.readonly_policy())

        self[17] = atom.Atom(domain=domain.String(),
                             init='Plugin',
                             names='label category',
                             policy=atom.default_policy(self.__set_category))
        self[18] = atom.Atom(domain=domain.String(),
                             init='',
                             names='label',
                             policy=atom.default_policy(self.__set_label))

        self.ctl_functor = piw.functor_backend(1, True)
        self.ctl_input = bundles.VectorInput(self.ctl_functor.cookie(),
                                             self.__domain,
                                             signals=(1, ))
        self[19] = atom.Atom(domain=domain.Aniso(),
                             policy=self.ctl_input.vector_policy(1, False),
                             names='controller input')
        self.ctl_functor.set_functor(
            piw.pathnull(0),
            utils.make_change_nb(
                piw.slowchange(utils.changify(self.__controller_input))))

        self.__ctl = []

        # verbs
        self.add_verb2(1, 'show([],None)', callback=self.__show)
        self.add_verb2(2, 'show([un],None)', callback=self.__unshow)
        self.add_verb2(3, 'close([],None)', callback=self.__close)
        self.add_verb2(4,
                       'bypass([toggle],None)',
                       callback=self.__tog_bypass,
                       status_action=self.__status_bypass)
        self.add_verb2(5,
                       'show([toggle],None)',
                       callback=self.__tog_show,
                       status_action=self.__status_show)
        self.add_verb2(6,
                       'open([],None,role(None,[abstract]))',
                       callback=self.__open)
        self.add_verb2(7,
                       'scan([],None)',
                       callback=self.__browser.refresh_plugin_list)
        self.add_verb2(8, 'bypass([],None)', callback=self.__bypass)
        self.add_verb2(9, 'bypass([un],None)', callback=self.__unbypass)

        # control change
        self.add_verb2(
            10,
            'set([],~a,role(None,[matches([midi,program])]),role(to,[numeric]))',
            create_action=self.__set_program_change)
        self.add_verb2(
            11,
            'set([],~a,role(None,[matches([midi,bank])]),role(to,[numeric]))',
            create_action=self.__set_bank_change)
        self.add_verb2(
            12,
            'set([],~a,role(None,[mass([midi,controller])]),role(to,[numeric]))',
            create_action=self.__set_midi_control)

        self.set_ordinal(ordinal)
Beispiel #30
0
    def __init__(self, agent, controller, index):
        collection.Collection.__init__(
            self,
            creator=self.__create,
            wrecker=self.__wreck,
            ordinal=index,
            names='key',
            protocols='hidden-connection remove explicit')
        self.__event = piw.fasttrigger(const.light_unknown)
        self.__event.attach_to(controller, index)
        self.__handler = piw.change2_nb(self.__event.trigger(),
                                        utils.changify(self.event_triggered))

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

        self.agent = agent
        self.index = index

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

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

        self.agent.light_convertor.set_status_handler(
            self.index, self.__make_key_coordinate(),
            piw.slowchange(utils.changify(self.set_status)))
Beispiel #31
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='tabulator',
                             ordinal=ordinal)

        self.domain = piw.clockdomain_ctl()

        self[5] = bundles.Output(1, False, names='status output')
        self.status_output = bundles.Splitter(self.domain, self[5])
        self.lights = piw.lightsource(piw.change_nb(), 0,
                                      self.status_output.cookie())
        self.lights.set_size(1)

        self.cfunctor = piw.functor_backend(1, False)
        self.cinput = bundles.VectorInput(self.cfunctor.cookie(),
                                          self.domain,
                                          signals=(1, ))
        self[1] = atom.Atom(domain=domain.Aniso(),
                            policy=self.cinput.vector_policy(1, False),
                            names='controller input')
        self.cfunctor.set_gfunctor(
            utils.make_change_nb(
                piw.slowchange(utils.changify(self.__controller))))

        self.keyfunctor = piw.functor_backend(1, False)
        self.keyinput = bundles.VectorInput(self.keyfunctor.cookie(),
                                            self.domain,
                                            signals=(1, ))
        self[2] = atom.Atom(domain=domain.Aniso(),
                            policy=self.keyinput.vector_policy(1, False),
                            names='key input')
        self.keyfunctor.set_gfunctor(
            utils.make_change_nb(piw.slowchange(utils.changify(self.__key))))

        self[3] = atom.Atom(domain=domain.BoundedInt(1, 100),
                            init=DEFAULT_CHORD_TIMEOUT,
                            policy=atom.default_policy(
                                self.__set_chordtimeout),
                            names='chord timeout')
        self[4] = atom.Atom(domain=domain.BoundedInt(80, 200),
                            init=DEFAULT_PAGE_WIDTH,
                            policy=atom.default_policy(self.__set_pagewidth),
                            names='page width')
        self[6] = atom.Atom(domain=domain.Bool(),
                            init=False,
                            names='start',
                            policy=atom.default_policy(self.__change_start))

        self.add_verb2(1,
                       'start([],None)',
                       self.__start,
                       status_action=self.__status)
        self.add_verb2(2,
                       'stop([],None)',
                       self.__stop,
                       status_action=self.__status)
        self.add_verb2(3,
                       'start([toggle],None)',
                       self.__toggle,
                       status_action=self.__status)

        self.__set_chordtimeout(DEFAULT_CHORD_TIMEOUT)
        self.__set_pagewidth(DEFAULT_PAGE_WIDTH)

        self.__columnlen = None
        self.__columnsqueue = None
        self.__columnsrender = None
        self.__lasttime = None

        self.__update_status()