Exemplo n.º 1
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 = []
Exemplo n.º 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)
Exemplo n.º 3
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)
Exemplo n.º 4
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)
Exemplo n.º 5
0
    def get_data_backend(self, config):
        if self.__backend is None:
            self.__backend = piw.functor_backend(1, True)
            self.__backend.set_gfunctor(utils.make_change_nb(self.__handler))
            self.__correlator = piw.correlator(self.__clock_domain, chr(1),
                                               piw.null_filter(),
                                               self.__backend.cookie(), 0, 0)

        if config.clocked:
            self.__set_clock(self.__backend.get_clock())

        return PlumberBackend(self.__correlator, self.__stream_policy, 1,
                              Plumber.input_input, -1, config.iid)
Exemplo n.º 6
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.__courselen = None
        self.__coursesqueue = None
        self.__coursesrender = None
        self.__lasttime = None
        
        self.__update_status()
Exemplo n.º 7
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)
Exemplo n.º 8
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()