Ejemplo n.º 1
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='cycler',
                             container=10,
                             ordinal=ordinal)

        self.set_private(node.Server())
        self.get_private()[1] = node.Server(change=self.__cycle_set,
                                            value=piw.makebool(True, 0))
        self.get_private()[2] = node.Server(change=self.__invert_set,
                                            value=piw.makebool(False, 0))

        self[2] = atom.Atom()
        self[2][1] = bundles.Output(1, False, names='activation output')
        self[2][2] = bundles.Output(2, False, names='pressure output')
        self[2][3] = bundles.Output(3, False, names='roll output')
        self[2][4] = bundles.Output(4, False, names='yaw output')
        self[2][5] = bundles.Output(5, False, names='scale note output')
        self[2][6] = bundles.Output(6, False, names='frequency output')
        self[2][7] = bundles.Output(16, False, names='damper output')

        self.add_verb2(1, 'cycle([],None)', self.__cycle_on)
        self.add_verb2(2, 'cycle([un],None)', self.__cycle_off)

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*', 0))
        self.main_output = bundles.Splitter(self.domain, self[2][1],
                                            self[2][2], self[2][3], self[2][4],
                                            self[2][5], self[2][6])
        self.damp_output = bundles.Splitter(self.domain, self[2][7])
        self.cycler = piw.cycler(self.domain, 32, self.main_output.cookie(),
                                 self.damp_output.cookie(), False)
        self.input = bundles.VectorInput(self.cycler.main_cookie(),
                                         self.domain,
                                         signals=(1, 2, 3, 4, 5, 6, 16, 17),
                                         threshold=5)
        self.feedback = bundles.VectorInput(self.cycler.feedback_cookie(),
                                            self.domain,
                                            signals=(1, ),
                                            threshold=5)

        self.cycler.set_cycle(True)
        self.cycler.set_maxdamp(1.0)
        self.cycler.set_invert(False)
        self.cycler.set_curve(1.0)

        self[1] = atom.Atom()
        self[1][1] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.input.vector_policy(1, False),
                               names='activation input')
        self[1][2] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.input.vector_policy(2, False),
                               names='pressure input')
        self[1][3] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.vector_policy(3, False),
                               names='roll input')
        self[1][4] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.vector_policy(4, False),
                               names='yaw input')
        self[1][5] = atom.Atom(domain=domain.BoundedFloat(0, 1000),
                               policy=self.input.vector_policy(5, False),
                               names='scale note input')
        self[1][6] = atom.Atom(domain=domain.BoundedFloat(0, 96000),
                               policy=self.input.vector_policy(6, False),
                               names='frequency input')
        self[1][7] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.feedback.vector_policy(
                                   1, False, clocked=False),
                               names='feedback input')
        self[1][8] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               init=0.0,
                               policy=self.input.linger_policy(16, False),
                               names='damper pedal input',
                               container=(None, 'damper',
                                          self.verb_container()))
        self[1][10] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                                init=1.0,
                                policy=atom.default_policy(self.__setmaxdamp),
                                names='damper maximum input')
        self[1][12] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                                policy=self.input.latch_policy(17, False),
                                names='hold pedal input')
        self[1][13] = atom.Atom(domain=domain.BoundedFloat(0.1, 10),
                                init=1,
                                names="damper curve",
                                policy=atom.default_policy(self.__setdcurve))

        self[1][8].add_verb2(1, 'invert([],None)', self.__invert_on)
        self[1][8].add_verb2(2, 'invert([un],None)', self.__invert_off)
Ejemplo n.º 2
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self, signature=version, names='kmapper', icon='plg_simple/kgroup.png',container=17,ordinal=ordinal)

        self.__cur_size = 0
        self.__choices=[]
        self.__coursekeys=[]
        self.__course=1

        self.__private = node.Server(value=piw.makestring('[]',0),change=self.__set_members)
        self.set_private(self.__private)

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

        self.mapper = piw.kgroup_mapper()

        self[1] = bundles.Output(1,False, names='light output',protocols='revconnect')

        self.loutput = bundles.Splitter(self.domain,self[1])
        self.lmapper = piw.clone(True)
        self.lmapper.set_filtered_output(1,self.loutput.cookie(),self.mapper.light_filter())
        self.lmux = piw.multiplexer(self.lmapper.cookie(),self.domain)

        self.linput = bundles.VectorInput(self.lmux.get_input(1),self.domain,signals=(1,))

        self[2] = atom.Atom(names='light input',protocols='revconnect',policy=self.linput.vector_policy(1,False,False),domain=domain.Aniso())

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

        self.soutput = bundles.Splitter(self.domain,self[3],self[4],self[5])
        self.sgate = piw.gate(self.soutput.cookie(),True)
        self.sinput = bundles.VectorInput(self.sgate.cookie(),self.domain,signals=(1,2,3))

        self[6] = atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.sinput.vector_policy(1,False),names='strip position input',ordinal=1)
        self[7] = atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.sinput.vector_policy(2,False),names='strip position input',ordinal=2)
        self[8] = atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.sinput.vector_policy(3,False),names='breath input')

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

        self.koutput = bundles.Splitter(self.domain,self[9],self[10],self[11],self[12])
        self.kpoly = piw.polyctl(10,self.koutput.cookie(),False,5)

        self.kclone = piw.clone(True)
        self.kclone.set_policy(False)
        self.kinput = bundles.VectorInput(self.kclone.cookie(),self.domain,signals=(1,2,3,4),filter=self.mapper.key_filter())

        self[13] = atom.Atom(domain=domain.BoundedFloat(0,1), policy=self.kinput.vector_policy(1,False), names='activation input')
        self[14] = atom.Atom(domain=domain.BoundedFloat(0,1), policy=self.kinput.vector_policy(2,False), names='pressure input')
        self[15] = atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.kinput.vector_policy(3,False), names='roll input')
        self[16] = atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.kinput.vector_policy(4,False), names='yaw input')

        self.kclone.set_output(1,self.kpoly.cookie())

        #self.add_verb2(2,'choose([],None,role(None,[matches([k])]),option(from,[numeric,singular]))',self.__choose2)
        #self.add_verb2(3,'choose([],None,role(None,[mass([k])]))',self.__choose3)
        #self.add_verb2(4,'clear([],None)',self.__clear)
        #self.add_verb2(5,'add([],None,role(None,[mass([k])]))',self.__add)

        self.add_verb2(7,'choose([],None,role(None,[matches([k])]),option(as,[numeric]))',self.__choose)
        self.add_verb2(8,'set([],None,role(None,[tagged_ideal([~server,course],[offset])]),role(to,[mass([semitone])]))',callback=self.__set_course_semi)
        self.add_verb2(9,'set([],None,role(None,[tagged_ideal([~server,course],[offset])]),role(to,[mass([interval])]))',callback=self.__set_course_int)
        self.add_verb2(12,'clear([],None,option(None,[mass([course])]))',self.__kclear)
        self.add_verb2(13,'add([],None,role(None,[mass([k])]),option(to,[mass([course])]))',self.__kadd)
        self.add_verb2(14,'add([],None,role(None,[mass([k])]),role(to,[mass([k])]),option(as,[mass([course])]))',self.__radd)

        self[20] = VirtualKey(lambda: self.__cur_size)

        self.statusbuffer = piw.statusbuffer(self.lmux.gate_input(),2,self.lmux.get_input(2))
        self.selgate = piw.functor_backend(1,True)
        self.kclone.set_output(2,self.selgate.cookie())

        self.statusbuffer.enable(1)
        self.kclone.enable(1,True)
        self.sgate.enable(True)

        self.__upstream_size = 0
        self.__set_poly()
        self[21] = atom.Atom(domain=domain.Aniso(),policy=atom.default_policy(self.__upstream),names='controller input')

        self[22] = VirtualChannel()
        
        self[23] = bundles.Output(1,False, names='controller output', continuous=True)
        self.coutput = bundles.Splitter(self.domain,self[23])
        self.controller = Controller(self.coutput.cookie())
        self.__private[2]=self.controller.state()
        self.cgate = piw.gate(self.controller.cookie(),True)
        self.cinput = bundles.ScalarInput(self.cgate.cookie(),self.domain,signals=(1,))
        self[24] = atom.Atom(domain=domain.Aniso(), policy=self.cinput.nodefault_policy(1,False),names='controller input')
        self[25] = VirtualCourse(self.controller)
Ejemplo n.º 3
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self, signature=version,names='ahdsr',ordinal=ordinal)

        self[2] = atom.Atom(names='outputs')
        self[2][1] = bundles.Output(1,True,names='volume output')
        self[2][2] = bundles.Output(2,False,names='activation output')
        self[2][3] = bundles.Output(8,False,names='pressure output')

        self.domain = piw.clockdomain_ctl()
        self.output = bundles.Splitter(self.domain,self[2][1],self[2][2],self[2][3])
        self.adsr = synth_native.adsr2(self.output.cookie(),self.domain)
        self.vdetect = piw.velocitydetect(self.adsr.cookie(),8,1)

        vel=(T('stageinc',0.1),T('inc',0.1),T('biginc',1),T('control','updown'))
        self[3] = atom.Atom(domain=domain.BoundedInt(1,1000),init=4,names="velocity sample",policy=atom.default_policy(self.__set_samples))
        self[4] = atom.Atom(domain=domain.BoundedFloat(0.1,10,hints=vel),init=4,names="velocity curve",policy=atom.default_policy(self.__set_curve))
        self[5] = atom.Atom(domain=domain.BoundedFloat(0.1,10,hints=vel),init=4,names="velocity scale",policy=atom.default_policy(self.__set_scale))
        self.input = bundles.VectorInput(self.vdetect.cookie(), self.domain,signals=(2,3,4,5,6,7,8,9,10,11,12,13,14),threshold=5)

        time=(T('stageinc',0.01),T('inc',0.01),T('biginc',0.2),T('control','updown'))
        self[1] = atom.Atom(names='inputs')
        self[1][1]=atom.Atom(domain=domain.BoundedFloat(0,1), init=1.0, names="activation input", policy=self.input.merge_policy(13,False), protocols="nostage")
        self[1][2]=atom.Atom(domain=domain.BoundedFloat(0,60,hints=time),init=0, names="delay input", policy=self.input.merge_policy(2,False))
        self[1][3]=atom.Atom(domain=domain.BoundedFloat(0,60,hints=time),init=0.01, names="attack input", policy=self.input.merge_policy(3,False))
        self[1][4]=atom.Atom(domain=domain.BoundedFloat(0,60,hints=time),init=0, names="hold input", policy=self.input.merge_policy(4,False))
        self[1][5]=atom.Atom(domain=domain.BoundedFloat(0,60,hints=time),init=0.05, names="decay input", policy=self.input.merge_policy(5,False))
        self[1][6]=atom.Atom(domain=domain.BoundedFloat(0,1), init=1.0, names="sustain input", policy=self.input.merge_policy(6,False))
        self[1][7]=atom.Atom(domain=domain.BoundedFloat(0,60,hints=time),init=0.5, names="release input", policy=self.input.merge_policy(7,False))
        self[1][8]=atom.Atom(domain=domain.BoundedFloat(0,1), init=0, names="pressure input", ordinal=1, policy=self.input.vector_policy(8,False))
        self[1][9]=atom.Atom(domain=domain.BoundedFloat(0,1), init=0, names="pressure input", ordinal=2, policy=self.input.vector_policy(9,policy.IsoStreamPolicy(1,0,0)))
        self[1][10]=atom.Atom(domain=domain.BoundedFloat(0,1), init=0, names="velocity sensitivity input", policy=self.input.merge_policy(10,False))
        self[1][11]=atom.Atom(domain=domain.BoundedFloat(0,1), init=0, names="aftertouch input", policy=self.input.merge_policy(11,False))
        self[1][12]=atom.Atom(domain=domain.BoundedFloat(0,1), init=0, names="pedal input", policy=self.input.latch_policy(12,False))
        self[1][13]=atom.Atom(domain=domain.BoundedFloat(0,1), init=0.5, names="damper input", policy=self.input.linger_policy(14,False))

        self.__set_samples(4)
        self.__set_curve(4)
        self.__set_scale(4)
Ejemplo n.º 4
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='metronome',
                             container=4,
                             protocols='browse metronome',
                             ordinal=ordinal)

        self[1] = atom.Atom(names='outputs')
        self[1][1] = bundles.Output(1, False, names='bar beat output')
        self[1][2] = bundles.Output(2, False, names='song beat output')
        self[1][3] = bundles.Output(3, False, names='running output')
        self[1][4] = bundles.Output(4, False, names='bar output')
        self[1][5] = bundles.Output(5, False, names='tempo output')
        self[14] = bundles.Output(1, False, names='status output')

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

        self.clk_output = bundles.Splitter(self.domain, self[1][1], self[1][2],
                                           self[1][3], self[1][4])
        self.tempo_output = bundles.Splitter(self.domain, self[1][5])
        self.status_output = bundles.Splitter(self.domain, self[14])

        self.pinger = loop_native.pinger(self.clk_output.cookie(),
                                         self.tempo_output.cookie(),
                                         self.status_output.cookie(),
                                         self.domain, sc(self.__tempo_set),
                                         sc(self.__beats_set),
                                         sc(self.__preroll_set))
        self.aggregator = piw.aggregator(self.pinger.cookie(), self.domain)

        self.tap_input = bundles.ScalarInput(self.aggregator.get_output(1),
                                             self.domain,
                                             signals=(1, 2))
        self.midi_clock_input = bundles.ScalarInput(
            self.aggregator.get_output(2), self.domain, signals=(1, ))

        self[2] = atom.Atom(domain=domain.BoundedFloat(
            0,
            500,
            hints=(T('stageinc',
                     1), T('inc', 1), T('biginc', 10), T('control',
                                                         'updown'))),
                            init=120,
                            names='tempo input',
                            policy=atom.default_policy(self.__set_tempo))
        self[3] = atom.Atom(domain=domain.BoundedFloat(0,
                                                       100,
                                                       rest=4,
                                                       hints=(
                                                           T('stageinc', 1),
                                                           T('inc', 1),
                                                       )),
                            names='beat input',
                            policy=atom.default_policy(self.__set_beats))
        # self[4] is the verb container
        self[5] = atom.Atom(domain=domain.BoundedFloat(0,
                                                       1,
                                                       rest=0,
                                                       hints=(T(
                                                           'control',
                                                           'trigger'), )),
                            policy=self.tap_input.nodefault_policy(
                                1, policy.ImpulseStreamPolicy()),
                            names='beat trigger',
                            transient=True)
        self[6] = atom.Atom(domain=domain.BoundedFloat(0,
                                                       1,
                                                       rest=0,
                                                       hints=(T(
                                                           'control',
                                                           'trigger'), )),
                            policy=self.tap_input.nodefault_policy(
                                2, policy.ImpulseStreamPolicy()),
                            names='bar trigger',
                            transient=True)
        self[7] = atom.Atom(domain=domain.BoundedFloat(1, 500),
                            init=30,
                            names='tap tempo minimum',
                            policy=atom.default_policy(
                                self.__set_tempo_lbound))
        self[8] = atom.Atom(domain=domain.BoundedFloat(1, 500),
                            init=240,
                            names='tap tempo maximum',
                            policy=atom.default_policy(
                                self.__set_tempo_ubound))
        self[9] = atom.Atom(
            domain=domain.Bool(hints=(T('control', 'toggle'), )),
            policy=atom.default_policy(self.__preroll),
            names='preroll trigger',
            transient=True)
        self[10] = atom.Atom(domain=domain.BoundedInt(1, 32),
                             init=4,
                             names='preroll',
                             policy=atom.default_policy(
                                 self.__set_preroll_count))

        self[15] = atom.Atom(domain=domain.Aniso(),
                             policy=self.midi_clock_input.nodefault_policy(
                                 1, False),
                             names='midi clock input')
        self[16] = toggle.Toggle(self.__set_midi_clock_enable,
                                 self.domain,
                                 container=(None, 'midi clock enable',
                                            self.verb_container()),
                                 names='midi clock enable')
        self[17] = atom.Atom(
            domain=domain.BoundedFloat(-1000,
                                       1000,
                                       hints=(T('inc',
                                                1), T('control', 'updown'))),
            init=0,
            names='midi clock latency',
            policy=atom.default_policy(self.__midi_clock_set_latency))
        self[18] = atom.Atom(domain=domain.BoundedIntOrNull(0, 2000),
                             init=0,
                             names='beat flash persistence',
                             policy=atom.default_policy(
                                 self.__set_beat_flash_persistence))

        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)

        print 'init tempo=', self[2].get_value()
        self.pinger.set_tempo(self[2].get_value())
        self.pinger.set_beats(self[3].get_value())
        self.pinger.set_range(self[8].get_value(), self[7].get_value())

        self.__playing = False

        self.__timestamp = piw.tsd_time()
        self.__selected = None
        self.update()
Ejemplo n.º 5
0
    def __init__(self, address, ordinal):
        #
        # Agents are constructed with the address and ordinal.  Each
        # agent will have a unique address and an ordinal unique for
        # that type of agent.
        #
        # We also pass in the automatically generated version to go into
        # the metadata.
        #
        agent.Agent.__init__(self,
                             signature=version,
                             names='osc output',
                             ordinal=ordinal)

        #
        # Create a clock domain.  A clock domain is a collection of clock
        # sinks all of which share common properties.  Domains can be isochronous
        # or anisochronous.  Currently, sinks in iso domains can be connected
        # only to other iso domains using the same source.
        #
        self.domain = piw.clockdomain_ctl()

        #
        # Make our domain anisochronous (aniso is used for everything except audio)
        #
        self.domain.set_source(piw.makestring('*', 0))

        #
        # Create an OSC server, implemented in our C++ library, imported through
        # the osc_plg_native module.
        #
        self.osc = osc_server(self.domain, "keyboard_%d" % ordinal)

        #
        # Create an OSC output within the OSC server, which will correlate 4
        # streams.  These will be used for keyboard data.  We group like this
        # so that we can send all the keyboard parameters together.
        # these will be under the /key OSC path
        #
        # The return value from create_output is a piw.cookie, which represents
        # a connection endpoint. This can be used by another component to send
        # events for OSC output. The OSC output will place the first 4 signals
        # into each OSC output packet.
        #
        self.key_output = self.osc.create_output("key", True, 4)

        #
        # Create an input.  An input does the work of correlating the events on a
        # number of signals, grouping them together.
        #
        # A Vector input is a proper multiple channel input. This one is being
        # constructed to handle 4 signals, numbered 1,2,3 and 4. The events will
        # be sent to the OSC output stage through the use of the key_output cookie.
        #
        self.key_input = bundles.VectorInput(self.key_output,
                                             self.domain,
                                             signals=(1, 2, 3, 4))

        #
        # Create a null atom just to group our inputs. We still name this atom so that it
        # shows up with a meaningful name through introspection by tools like Workbench.
        #
        self[1] = atom.Atom(names="inputs")

        #
        # Now create our inputs. The data policy for the atom is created by our vector input.
        # There are lots of corner cases when we invert our model from signal-contains-events
        # to event-contains-signals. In particular, this happens when events on individual
        # signals dont start and and stop together.
        #
        # Any input with a vector_policy will create or join an existing event.
        # merge_policy will never create events, just join onto existing events created by
        # a vector policy.
        #
        # We create 4 inputs, with vector policies routing them to signals 1,2,3 and 4 on
        # our bundle. These are all non-iso inputs.
        #
        self[1][1] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.key_input.vector_policy(1, False),
                               names='activation input')
        self[1][2] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.key_input.vector_policy(2, False),
                               names='pressure input')
        self[1][3] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.key_input.vector_policy(3, False),
                               names='roll input')
        self[1][4] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.key_input.vector_policy(4, False),
                               names='yaw input')

        #
        # Create another OSC output for the breath pipe.
        #
        self.breath_output = self.osc.create_output("breath", False, 1)

        #
        # And another input. We use separate inputs for breath and keys, because we want
        # all the key signals to be correlated together (so we can output pressure roll and
        # yaw as 1 packet), the breath pipe is completely independent from the keys though.
        #
        # Using the breath_output cookie, the input data will be send to the breath output created
        # in the native OSC transport.
        #
        self.breath_input = bundles.VectorInput(self.breath_output,
                                                self.domain,
                                                signals=(1, ))
        self[1][5] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.breath_input.vector_policy(
                                   1, False),
                               names='breath input')

        #
        # Lastly, create an atom called 'decimation' to store our current decimation rate.
        # This will appear in Stage and can be set using Belcanto. When it changes, our
        # __decimation method will be called with a Python numeric argument (because its a
        # numeric domain).
        #
        self[3] = atom.Atom(domain=domain.BoundedInt(0, 100),
                            policy=atom.default_policy(self.__decimation),
                            names='decimation')
Ejemplo n.º 6
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)
Ejemplo n.º 7
0
    def __init__(self, address, ordinal):
        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*', 0))

        agent.Agent.__init__(self,
                             signature=version,
                             names='strummer',
                             protocols='',
                             ordinal=ordinal)

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

        self.output = bundles.Splitter(self.domain, *self[1].values())
        self.strummer = piw.strummer(self.output.cookie(), self.domain)
        self.ctl_input = bundles.VectorInput(self.strummer.ctl_cookie(),
                                             self.domain,
                                             signals=(1, ))
        self.data_input = bundles.VectorInput(self.strummer.data_cookie(),
                                              self.domain,
                                              signals=(1, ))

        self[4] = atom.Atom()
        self[4][1] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.ctl_input.vector_policy(1, False),
                               names='controller input')
        self[4][2] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.data_input.vector_policy(1, False),
                               names='pressure input')

        self[2] = atom.Atom()
        self[2][1] = atom.Atom(domain=domain.Bool(),
                               init=False,
                               names='enable',
                               policy=atom.default_policy(
                                   self.strummer.enable))
        self[2][2] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               init=0.01,
                               names='on threshold',
                               policy=atom.default_policy(
                                   self.strummer.set_on_threshold))
        self[2][3] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               init=0.08,
                               names='off threshold',
                               policy=atom.default_policy(
                                   self.strummer.set_off_threshold))
        self[2][4] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               init=0.0,
                               names='k mix',
                               policy=atom.default_policy(
                                   self.strummer.set_key_mix))
        self[2][5] = atom.Atom(domain=domain.BoundedInt(0, 2000),
                               init=400,
                               names='trigger window',
                               policy=atom.default_policy(
                                   self.strummer.set_trigger_window))

        self.strummer.enable(False)
        self.strummer.set_on_threshold(0.2)
        self.strummer.set_off_threshold(0.1)
        self.strummer.set_key_mix(0.0)
        self.strummer.set_trigger_window(400)
Ejemplo n.º 8
0
    def __init__(self, address, ordinal):
        self.domain = piw.clockdomain_ctl()
        agent.Agent.__init__(self, signature=version, names='recorder', protocols='bind',icon='plg_recorder/recorder.png',container=(3,'agent',atom.VerbContainer(clock_domain=self.domain)),ordinal=ordinal)

        self[2] = atom.Atom()
        self[2][1] = bundles.Output(1,False,names='activation output', protocols='')
        self[2][2] = bundles.Output(2,False,names='pressure output', protocols='')
        self[2][3] = bundles.Output(3,False,names='roll output', protocols='')
        self[2][4] = bundles.Output(4,False,names='yaw output', protocols='')
        self[2][5] = bundles.Output(1,False,names='auxilliary output', ordinal=1, protocols='')
        self[2][6] = bundles.Output(1,False,names='auxilliary output', ordinal=2, protocols='')
        self[2][7] = bundles.Output(1,False,names='auxilliary output', ordinal=3, protocols='')
        self[2][8] = bundles.Output(1,False,names='auxilliary output', ordinal=4, protocols='')
        self[2][9] = bundles.Output(1,False,names='auxilliary output', ordinal=5, protocols='')
        self[2][10] = bundles.Output(1,False,names='auxilliary output', ordinal=6, protocols='')
        self[2][11] = bundles.Output(1,False,names='auxilliary output', ordinal=7, protocols='')
        self[2][12] = bundles.Output(1,False,names='auxilliary output', ordinal=8, protocols='')
        self[2][13] = bundles.Output(1,False,names='auxilliary output', ordinal=9, protocols='')
        self[2][14] = bundles.Output(1,False,names='auxilliary output', ordinal=10, protocols='')

        self.output_data = bundles.Splitter(self.domain,self[2][1],self[2][2],self[2][3],self[2][4])
        self.output_aux1 = bundles.Splitter(self.domain,self[2][5])
        self.output_aux2 = bundles.Splitter(self.domain,self[2][6])
        self.output_aux3 = bundles.Splitter(self.domain,self[2][7])
        self.output_aux4 = bundles.Splitter(self.domain,self[2][8])
        self.output_aux5 = bundles.Splitter(self.domain,self[2][9])
        self.output_aux6 = bundles.Splitter(self.domain,self[2][10])
        self.output_aux7 = bundles.Splitter(self.domain,self[2][11])
        self.output_aux8 = bundles.Splitter(self.domain,self[2][12])
        self.output_aux9 = bundles.Splitter(self.domain,self[2][13])
        self.output_aux10 = bundles.Splitter(self.domain,self[2][14])

        self.poly_data = piw.polyctl(poly_data_initial,self.output_data.cookie(),False,poly_data_headroom)
        self.poly_aux1 = piw.polyctl(poly_aux_initial,self.output_aux1.cookie(),False,poly_aux_headroom)
        self.poly_aux2 = piw.polyctl(poly_aux_initial,self.output_aux2.cookie(),False,poly_aux_headroom)
        self.poly_aux3 = piw.polyctl(poly_aux_initial,self.output_aux3.cookie(),False,poly_aux_headroom)
        self.poly_aux4 = piw.polyctl(poly_aux_initial,self.output_aux4.cookie(),False,poly_aux_headroom)
        self.poly_aux5 = piw.polyctl(poly_aux_initial,self.output_aux5.cookie(),False,poly_aux_headroom)
        self.poly_aux6 = piw.polyctl(poly_aux_initial,self.output_aux6.cookie(),False,poly_aux_headroom)
        self.poly_aux7 = piw.polyctl(poly_aux_initial,self.output_aux7.cookie(),False,poly_aux_headroom)
        self.poly_aux8 = piw.polyctl(poly_aux_initial,self.output_aux8.cookie(),False,poly_aux_headroom)
        self.poly_aux9 = piw.polyctl(poly_aux_initial,self.output_aux9.cookie(),False,poly_aux_headroom)
        self.poly_aux10 = piw.polyctl(poly_aux_initial,self.output_aux10.cookie(),False,poly_aux_headroom)

        self.output_clone = piw.clone(True)
        self.output_clone.set_filtered_output(2,self.poly_data.cookie(),piw.grist_deaggregation_filter2(2,100))
        self.output_clone.set_filtered_output(3,self.poly_aux1.cookie(),piw.grist_deaggregation_filter(3))
        self.output_clone.set_filtered_output(4,self.poly_aux2.cookie(),piw.grist_deaggregation_filter(4))
        self.output_clone.set_filtered_output(5,self.poly_aux3.cookie(),piw.grist_deaggregation_filter(5))
        self.output_clone.set_filtered_output(6,self.poly_aux4.cookie(),piw.grist_deaggregation_filter(6))
        self.output_clone.set_filtered_output(7,self.poly_aux5.cookie(),piw.grist_deaggregation_filter(7))
        self.output_clone.set_filtered_output(8,self.poly_aux6.cookie(),piw.grist_deaggregation_filter(8))
        self.output_clone.set_filtered_output(9,self.poly_aux7.cookie(),piw.grist_deaggregation_filter(9))
        self.output_clone.set_filtered_output(10,self.poly_aux8.cookie(),piw.grist_deaggregation_filter(10))
        self.output_clone.set_filtered_output(11,self.poly_aux9.cookie(),piw.grist_deaggregation_filter(11))
        self.output_clone.set_filtered_output(12,self.poly_aux10.cookie(),piw.grist_deaggregation_filter(12))

        self.output_aggregator = piw.aggregator(self.output_clone.cookie(), self.domain)

        self.player = recorder_native.kplayer(self.domain, 16, 9, self.output_aggregator.get_output(2))
        self.recorder = Recorder(self.domain,9)

        self.input_clone = piw.clone(True)
        self.input_clone.set_output(1,self.output_aggregator.get_output(1))
        self.input_clone.set_output(2,self.player.cookie())
        self.input_clone.set_output(3,self.recorder.cookie())

        self.input_aggregator = piw.aggregator(self.input_clone.cookie(), self.domain)

        self.input_clock = bundles.ScalarInput(self.input_aggregator.get_filtered_output(1,piw.grist_aggregation_filter(1)), self.domain, signals=(1,2,3))
        self.input_clock.add_upstream(self.verb_container().clock)

        self.input_poly = piw.polyctl(10,self.input_aggregator.get_filtered_output(2,piw.grist_aggregation_filter(2)), False,5)
        self.input_data = bundles.VectorInput(self.input_poly.cookie(), self.domain, signals=(1,2,3,4))

        self.input_aux1 = bundles.VectorInput(self.input_aggregator.get_filtered_output(3,piw.grist_aggregation_filter(3)), self.domain, signals=(1,))
        self.input_aux2 = bundles.VectorInput(self.input_aggregator.get_filtered_output(4,piw.grist_aggregation_filter(4)), self.domain, signals=(1,))
        self.input_aux3 = bundles.VectorInput(self.input_aggregator.get_filtered_output(5,piw.grist_aggregation_filter(5)), self.domain, signals=(1,))
        self.input_aux4 = bundles.VectorInput(self.input_aggregator.get_filtered_output(6,piw.grist_aggregation_filter(6)), self.domain, signals=(1,))
        self.input_aux5 = bundles.VectorInput(self.input_aggregator.get_filtered_output(7,piw.grist_aggregation_filter(7)), self.domain, signals=(1,))
        self.input_aux6 = bundles.VectorInput(self.input_aggregator.get_filtered_output(8,piw.grist_aggregation_filter(8)), self.domain, signals=(1,))
        self.input_aux7 = bundles.VectorInput(self.input_aggregator.get_filtered_output(9,piw.grist_aggregation_filter(9)), self.domain, signals=(1,))
        self.input_aux8 = bundles.VectorInput(self.input_aggregator.get_filtered_output(10,piw.grist_aggregation_filter(10)), self.domain, signals=(1,))
        self.input_aux9 = bundles.VectorInput(self.input_aggregator.get_filtered_output(11,piw.grist_aggregation_filter(11)), self.domain, signals=(1,))
        self.input_aux10 = bundles.VectorInput(self.input_aggregator.get_filtered_output(12,piw.grist_aggregation_filter(12)), self.domain, signals=(1,))

        self.nplayer = recorder_native.nplayer(self.output_aggregator.get_filtered_output(3,piw.gristchaff_aggregation_filter(100,3)),16,2,self.domain)
        self.input_clock.add_upstream(self.nplayer.get_clock())

        self[1] = atom.Atom()

        self[1][1]=atom.Atom(domain=domain.BoundedFloat(0,1), policy=self.input_data.vector_policy(1,False),names='activation input')
        self[1][2]=atom.Atom(domain=domain.BoundedFloat(0,1), policy=self.input_data.vector_policy(2,False),names='pressure input')
        self[1][3]=atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.input_data.vector_policy(3,False),names='roll input')
        self[1][4]=atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.input_data.vector_policy(4,False),names='yaw input')

        self[1][5]=atom.Atom(domain=domain.Aniso(), policy=self.input_aux1.vector_policy(1,False),names='auxilliary input', ordinal=1)
        self[1][6]=atom.Atom(domain=domain.Aniso(), policy=self.input_aux2.vector_policy(1,False),names='auxilliary input', ordinal=2)
        self[1][7]=atom.Atom(domain=domain.Aniso(), policy=self.input_aux3.vector_policy(1,False),names='auxilliary input', ordinal=3)
        self[1][8]=atom.Atom(domain=domain.Aniso(), policy=self.input_aux4.vector_policy(1,False),names='auxilliary input', ordinal=4)
        self[1][9]=atom.Atom(domain=domain.Aniso(), policy=self.input_aux5.vector_policy(1,False),names='auxilliary input', ordinal=5)
        self[1][10]=atom.Atom(domain=domain.Aniso(), policy=self.input_aux6.vector_policy(1,False),names='auxilliary input', ordinal=6)
        self[1][11]=atom.Atom(domain=domain.Aniso(), policy=self.input_aux7.vector_policy(1,False),names='auxilliary input', ordinal=7)
        self[1][12]=atom.Atom(domain=domain.Aniso(), policy=self.input_aux8.vector_policy(1,False),names='auxilliary input', ordinal=8)
        self[1][13]=atom.Atom(domain=domain.Aniso(), policy=self.input_aux9.vector_policy(1,False),names='auxilliary input', ordinal=9)
        self[1][14]=atom.Atom(domain=domain.Aniso(), policy=self.input_aux10.vector_policy(1,False),names='auxilliary input', ordinal=10)

        self[1][16]=atom.Atom(domain=domain.BoundedFloat(0,10000000), policy=self.input_clock.nodefault_policy(1,False),names='song beat input')
        self[1][17]=atom.Atom(domain=domain.BoundedFloat(0,100), policy=self.input_clock.nodefault_policy(2,False),names='bar beat input')
        self[1][18]=atom.Atom(domain=domain.Bool(), init=False, policy=self.input_clock.nodefault_policy(3,False),names='running input')

        c = dict(c=schedproxy.get_constraints(),
                 x='[ideal([~server,take]),singular]',
                 o='option(with,[or([[matches([stretch],stretch)],[matches([un,stretch],unstretch)],[matches([chop],chop)]])])'
            )

        a = dict(create_action=self.__create_deferred, destroy_action=self.__destroy_deferred,clock=True)

        self.add_verb2(1,'record([],None,role(None,[mass([bar])]),%(o)s)'%c,self.__record)
        self.add_verb2(2,'play([un],None,option(None,%(x)s))'%c,self.__unplay)
        self.add_verb2(3,'play([],None,role(None,%(x)s),%(o)s)'%c,callback=self.__play_now,**a)
        self.add_verb2(4,'play([],None,role(None,%(x)s),role(at,%(c)s),option(until,%(c)s),option(every,%(c)s),%(o)s)'%c,callback=self.__play_aue,**a)
        self.add_verb2(5,'play([],None,role(None,%(x)s),role(until,%(c)s),option(every,%(c)s),%(o)s)'%c,callback=self.__play_ue,**a)
        self.add_verb2(6,'play([],None,role(None,%(x)s),role(every,%(c)s),%(o)s)'%c,callback=self.__play_e,**a)
        self.add_verb2(7,'play([dont],None,option(None,%(x)s))'%c,self.__unplay)
        self.add_verb2(8,'repeat([],None,role(None,%(x)s),%(o)s)'%c,callback=self.__repeat,**a)
        self.add_verb2(9,'name([],None,role(None,[ideal([~server,take]),singular]),role(to,[abstract]))',self.__name)
        self.add_verb2(10,'copy([],None,role(None,[gideal(take),singular]))',callback=self.__copy)
        self.add_verb2(11,'use([],None,role(None,[concrete,proto(scheduler),singular]))',callback=self.__usesched)
        self.add_verb2(12,'delete([],None,role(None,[ideal([~server,take]),singular]))',self.__delete)
        self.add_verb2(13,'play([],None,role(None,[mass([note])]),role(with,[mass([velocity])]))',create_action=self.__playnv,clock=True)
        self.add_verb2(14,'play([],None,role(None,[mass([note])]),role(with,[mass([velocity])]),role(for,[mass([second])]))',create_action=self.__playnvl,clock=True)

        self.add_verb2(15,'play([toggle],None,role(None,%(x)s),%(o)s)'%c,callback=self.__tog_play_now,**a)
        self.add_verb2(16,'play([toggle],None,role(None,%(x)s),role(at,%(c)s),option(until,%(c)s),option(every,%(c)s),%(o)s)'%c,callback=self.__tog_play_aue,**a)
        self.add_verb2(17,'play([toggle],None,role(None,%(x)s),role(until,%(c)s),option(every,%(c)s),%(o)s)'%c,callback=self.__tog_play_ue,**a)
        self.add_verb2(18,'play([toggle],None,role(None,%(x)s),role(every,%(c)s),%(o)s)'%c,callback=self.__tog_play_e,**a)
        self.add_verb2(19,'repeat([toggle],None,role(None,%(x)s),%(o)s)'%c,callback=self.__tog_repeat,**a)

        self.add_verb2(20,'cancel([],None)',self.__cancel)

        self[4] = TakeBrowser(self)
        self.library = TakeLibrary(self)

        self.__scheduler = schedproxy.SchedProxy(delegate=self)
        self.set_private(node.server(value=piw.makestring('',0),change=self.__schedchange))

        self.__schedready = False

        self[5] = Voice(self)

        # don't use self[6], it was previously used by a legacy status output that was removed in 1.2

        self[7]=toggle.Toggle(None,self.domain,container=(None,'overdub',self.verb_container()),init=False,names='overdub',transient=True)
Ejemplo n.º 9
0
    def __init__(self, address, ordinal):
        self.domain = piw.clockdomain_ctl()
        agent.Agent.__init__(
            self,
            signature=version,
            names='synth filter',
            container=(10, 'agent',
                       atom.VerbContainer(clock_domain=self.domain)),
            ordinal=ordinal)

        self[1] = bundles.Output(1, True, names="low pass output")
        self[2] = bundles.Output(2, True, names="high pass output")
        self[3] = bundles.Output(3, True, names="band pass output")

        self.output = bundles.Splitter(self.domain, self[1], self[2], self[3])
        self.filter = synth_native.synthfilter(self.output.cookie(),
                                               self.domain)
        self.bend_filter = piw.function2(
            True, 3, 4, 1, piw.makefloat_bounded(96000, 0, 0, 440, 0),
            piw.makefloat_bounded(1, -1, 0, 0, 0), self.filter.cookie())
        self.bender = piw.fast_pitchbender()
        self.bend_filter.set_functor(self.bender.bend_functor())
        self.input = bundles.VectorInput(self.bend_filter.cookie(),
                                         self.domain,
                                         signals=(5, 2, 3, 4),
                                         threshold=5)
        self.input.add_upstream(self.verb_container().clock)

        self[4] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                            names="audio input",
                            policy=self.input.vector_policy(5, True))
        self[5] = atom.Atom(domain=domain.BoundedFloat(
            0,
            1,
            rest=0.5,
            hints=(T('control',
                     'updown'), T('stageinc',
                                  0.01), T('inc', 0.01), T('biginc', 0.05))),
                            names="resonance input",
                            policy=self.input.merge_policy(2, False))
        self[6] = atom.Atom(domain=domain.BoundedFloat(0, 96000),
                            init=5000,
                            names="cutoff frequency input",
                            policy=self.input.merge_policy(3, False))
        self[7] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                            names="bend input",
                            policy=self.input.merge_policy(4, False))

        self[8] = atom.Atom(domain=domain.BoundedFloat(0, 72),
                            init=24,
                            policy=atom.default_policy(self.__rchange),
                            names='frequency range',
                            protocols='bind set',
                            container=(None, 'range', self.verb_container()))
        self[8].add_verb2(
            1,
            'set([],None,role(None,[instance(~self)]),role(to,[]))',
            create_action=self.__rcreate,
            clock=True)

        self[9] = atom.Atom(domain=domain.BoundedFloat(-144, 144, rest=0),
                            init=24,
                            policy=atom.default_policy(self.__ochange),
                            names='frequency offset',
                            protocols='bind set',
                            container=(None, 'offset', self.verb_container()))
        self[9].add_verb2(
            2,
            'set([],None,role(None,[instance(~self)]),role(to,[]))',
            create_action=self.__ocreate,
            clock=True)

        self.__rchange(24)
        self.__ochange(24)
Ejemplo n.º 10
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='system input events',
                             ordinal=ordinal)

        self.domain = piw.clockdomain_ctl()

        self.sysin_events = sysin_events_native.sysin_events(self.domain)

        self.__input = bundles.VectorInput(self.sysin_events.mouse_input(),
                                           self.domain,
                                           signals=(1, 2, 3, 4))

        self[1] = atom.Atom(names='mouse inputs')
        self[1][1] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               names="mouse horizontal input",
                               policy=self.__input.vector_policy(1, True))
        self[1][2] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               names="mouse vertical input",
                               policy=self.__input.vector_policy(2, True))
        self[1][3] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               names="left mouse button input",
                               policy=self.__input.vector_policy(3, True))
        self[1][4] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               names="right mouse button input",
                               policy=self.__input.vector_policy(4, True))

        self[2] = KeyPresses(self)

        self[3] = atom.Atom(names='velocity curve controls')
        self[3][1] = atom.Atom(domain=domain.BoundedInt(1, 1000),
                               init=4,
                               names="velocity sample",
                               policy=atom.default_policy(self.__set_samples))
        self[3][2] = atom.Atom(domain=domain.BoundedFloat(0.1, 10),
                               init=4,
                               names="velocity curve",
                               policy=atom.default_policy(self.__set_curve))
        self[3][3] = atom.Atom(domain=domain.BoundedFloat(0.1, 10),
                               init=4,
                               names="velocity scale",
                               policy=atom.default_policy(self.__set_scale))

        self[4] = atom.Atom(names='mouse controls')
        self[4][1] = atom.Atom(domain=domain.BoundedFloat(-10, 10),
                               init=2.0,
                               policy=atom.default_policy(
                                   self.__set_mouse_x_scale),
                               names='mouse horizontal scale')
        self[4][2] = atom.Atom(domain=domain.BoundedFloat(-10, 10),
                               init=-1.0,
                               policy=atom.default_policy(
                                   self.__set_mouse_y_scale),
                               names='mouse vertical scale')
        self[4][3] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               init=0.1,
                               policy=atom.default_policy(
                                   self.__set_mouse_x_deadband),
                               names='mouse horizontal deadband')
        self[4][4] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               init=0.1,
                               policy=atom.default_policy(
                                   self.__set_mouse_y_deadband),
                               names='mouse vertical deadband')
        self[4][5] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               names='mouse button threshold 1',
                               init=0.0,
                               policy=atom.default_policy(
                                   self.__set_mouse_button_threshold1))
        self[4][6] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               names='mouse button threshold 2',
                               init=0.0,
                               policy=atom.default_policy(
                                   self.__set_mouse_button_threshold2))
        self[4][7] = atom.Atom(domain=domain.Bool(),
                               names='mouse button velocity 1',
                               init=False,
                               policy=atom.default_policy(
                                   self.__set_mouse_button_velocity1))
        self[4][8] = atom.Atom(domain=domain.Bool(),
                               names='mouse button velocity 2',
                               init=False,
                               policy=atom.default_policy(
                                   self.__set_mouse_button_velocity2))

        self.add_verb2(
            1,
            'press([],~a,role(None,[matches([key])]),role(as,[numeric]))',
            create_action=self.__press_key)
        self.add_verb2(
            2,
            'press([],~a,role(None,[matches([character])]),role(as,[abstract]))',
            create_action=self.__press_character)
        self.add_verb2(
            3,
            'move([],~a,role(None,[matches([mouse])]),role(to,[numeric]),role(with,[numeric]))',
            create_action=self.__move_mouse)
Ejemplo n.º 11
0
 def __init__(self,agent,index):
     atom.Atom.__init__(self,domain=domain.BoundedFloat(-1,1),names='audio input',policy=agent.input.nodefault_policy(index,True),ordinal=index,protocols='remove nostage')
Ejemplo n.º 12
0
    def __init__(self, address, ordinal):
        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*', 0))

        agent.Agent.__init__(self,
                             signature=version,
                             names='strummer',
                             protocols='',
                             ordinal=ordinal)

        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.output = bundles.Splitter(self.domain, *self[1].values())
        self.strummer = strummer_native.cstrummer(self.output.cookie(),
                                                  self.domain)
        self.aggregator = piw.aggregator(self.strummer.cookie(), self.domain)
        self.strum_input = bundles.VectorInput(
            self.aggregator.get_filtered_output(1, piw.null_filter()),
            self.domain,
            signals=(
                1,
                2,
                3,
                4,
                5,
            ))
        self.data_input = bundles.VectorInput(
            self.aggregator.get_filtered_output(2, piw.null_filter()),
            self.domain,
            signals=(
                1,
                2,
                3,
                4,
            ))

        self[4] = atom.Atom(names='inputs')

        self[4][1] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.strum_input.vector_policy(1, False),
                               names='strum breath input',
                               protocols='nostage')
        self[4][2] = atom.Atom(domain=domain.Aniso(),
                               policy=self.strum_input.vector_policy(2, False),
                               names='strum key input',
                               protocols='nostage')
        self[4][3] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.strum_input.merge_policy(3, False),
                               names='strum pressure input',
                               protocols='nostage')
        self[4][4] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.strum_input.merge_policy(4, False),
                               names='strum roll input',
                               protocols='nostage')
        self[4][5] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.strum_input.merge_policy(5, False),
                               names='strum yaw input',
                               protocols='nostage')

        self[4][6] = atom.Atom(domain=domain.Aniso(),
                               policy=self.data_input.vector_policy(1, False),
                               names='course key input',
                               protocols='nostage')
        self[4][7] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.data_input.merge_policy(2, False),
                               names='course pressure input',
                               protocols='nostage')
        self[4][8] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.data_input.merge_policy(3, False),
                               names='course roll input',
                               protocols='nostage')
        self[4][9] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.data_input.merge_policy(4, False),
                               names='course yaw input',
                               protocols='nostage')

        self[2] = atom.Atom(names='controls')
        self[2][1] = atom.Atom(domain=domain.Bool(),
                               init=True,
                               names='enable',
                               policy=atom.default_policy(self.__enable))
        self[2][2] = atom.Atom(domain=domain.BoundedInt(0, 2000),
                               init=0,
                               names='trigger window',
                               policy=atom.default_policy(
                                   self.__set_trigger_window))
        self[2][3] = atom.Atom(domain=domain.BoundedFloat(0, 10),
                               init=0.0,
                               names='course pressure scale',
                               policy=atom.default_policy(
                                   self.__set_course_pressure_scale))
        self[2][4] = atom.Atom(domain=domain.BoundedFloat(0, 10),
                               init=1.0,
                               names='course roll scale',
                               policy=atom.default_policy(
                                   self.__set_course_roll_scale))
        self[2][5] = atom.Atom(domain=domain.BoundedFloat(0, 10),
                               init=1.0,
                               names='course yaw scale',
                               policy=atom.default_policy(
                                   self.__set_course_yaw_scale))
        self[2][6] = atom.Atom(domain=domain.BoundedFloat(0, 10),
                               init=1.0,
                               names='strum breath scale',
                               policy=atom.default_policy(
                                   self.__set_strum_breath_scale))
        self[2][7] = atom.Atom(domain=domain.BoundedFloat(0, 10),
                               init=1.0,
                               names='strum pressure scale',
                               policy=atom.default_policy(
                                   self.__set_strum_pressure_scale))
        self[2][8] = atom.Atom(domain=domain.BoundedFloat(0, 10),
                               init=0.0,
                               names='strum roll scale',
                               policy=atom.default_policy(
                                   self.__set_strum_roll_scale))
        self[2][9] = atom.Atom(domain=domain.BoundedFloat(0, 10),
                               init=0.0,
                               names='strum yaw scale',
                               policy=atom.default_policy(
                                   self.__set_strum_yaw_scale))
        self[2][10] = atom.Atom(domain=domain.Bool(),
                                init=True,
                                names='strum note end',
                                policy=atom.default_policy(
                                    self.__set_strum_note_end))
        self[2][11] = atom.Atom(domain=domain.Bool(),
                                init=False,
                                names='open course enable',
                                policy=atom.default_policy(
                                    self.__open_course_enable))
        self[2][12] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                                init=0.0,
                                names='open course pressure default',
                                policy=atom.default_policy(
                                    self.__open_course_pressure_default))
        self[2][13] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                                init=0.0,
                                names='open course roll default',
                                policy=atom.default_policy(
                                    self.__open_course_roll_default))
        self[2][14] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                                init=0.0,
                                names='open course yaw default',
                                policy=atom.default_policy(
                                    self.__open_course_yaw_default))
        self[2][15] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                                init=0.0,
                                names='strum roll pressure mix',
                                policy=atom.default_policy(
                                    self.__set_strum_roll_pressure_mix))
        self[2][16] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                                init=0.0,
                                names='strum yaw pressure mix',
                                policy=atom.default_policy(
                                    self.__set_strum_yaw_pressure_mix))
        self[2][17] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                                init=0.1,
                                names='course mute threshold',
                                policy=atom.default_policy(
                                    self.__set_course_mute_threshold))
        self[2][18] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                                init=0.1,
                                names='strum mute threshold',
                                policy=atom.default_policy(
                                    self.__set_strum_mute_threshold))
        self[2][19] = atom.Atom(domain=domain.BoundedInt(0, 1000),
                                init=20,
                                names='course mute interval',
                                policy=atom.default_policy(
                                    self.__set_course_mute_interval))
        self[2][20] = atom.Atom(domain=domain.BoundedInt(0, 1000),
                                init=20,
                                names='strum mute interval',
                                policy=atom.default_policy(
                                    self.__set_strum_mute_interval))
        self[2][21] = atom.Atom(domain=domain.Bool(),
                                init=True,
                                names='polyphonic courses enable',
                                policy=atom.default_policy(
                                    self.__set_poly_courses_enable))
        self[2][22] = atom.Atom(domain=domain.Bool(),
                                init=True,
                                names='course mute enable',
                                policy=atom.default_policy(
                                    self.__set_course_mute_enable))
        self[2][23] = atom.Atom(domain=domain.Bool(),
                                init=True,
                                names='strum mute enable',
                                policy=atom.default_policy(
                                    self.__set_strum_mute_enable))
        self[2][24] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                                init=0.6,
                                names='pulloff threshold',
                                policy=atom.default_policy(
                                    self.__set_pulloff_threshold))
        self[2][25] = atom.Atom(domain=domain.BoundedInt(0, 1000),
                                init=10,
                                names='pulloff interval',
                                policy=atom.default_policy(
                                    self.__set_pulloff_interval))
        self[2][26] = atom.Atom(domain=domain.Bool(),
                                init=True,
                                names='pulloff enable',
                                policy=atom.default_policy(
                                    self.__set_pulloff_enable))

        self[3] = atom.Atom(domain=domain.String(),
                            init='[]',
                            names='courses',
                            policy=atom.default_policy(self.__set_courses),
                            protocols='course_editor')

        self.add_verb2(
            1,
            'set([],~a,role(None,[matches([breath,modulation])]),role(for,[mass([course])]))',
            callback=self.__set_breath_modulation)
        self.add_verb2(
            2,
            'set([un],~a,role(None,[matches([breath,modulation])]),role(for,[mass([course])]))',
            callback=self.__unset_breath_modulation)
        self.add_verb2(
            3,
            'set([],~a,role(None,[matches([open])]),role(as,[mass([key])]),role(for,[mass([course])]))',
            callback=self.__set_open_course_key)
        self.add_verb2(
            4,
            'set([],~a,role(None,[matches([open])]),role(as,[coord(physical,[column],[row])]),role(for,[mass([course])]))',
            callback=self.__set_open_course_physical)
        self.add_verb2(
            5,
            'add([],~a,role(None,[matches([strum,key])]),role(with,[coord(physical,[column],[row])]),role(for,[mass([course])]))',
            callback=self.__add_strum_key)
        self.add_verb2(
            6,
            'clear([],~a,role(None,[matches([all,strum,key])]),role(for,[mass([course])]))',
            callback=self.__clear_strum_key)

        self.strumconfig = strummer_native.strumconfig()
Ejemplo n.º 13
0
    def __init__(self, address, ordinal):
        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*', 0))

        agent.Agent.__init__(
            self,
            signature=version,
            names='stringer',
            protocols='bind set',
            container=(5, 'stringer',
                       atom.VerbContainer(clock_domain=self.domain)),
            ordinal=ordinal)

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

        self[2] = bundles.Output(1,
                                 False,
                                 names='controller output',
                                 continuous=True)

        self.output = bundles.Splitter(self.domain, *self[1].values())
        self.coutput = bundles.Splitter(self.domain, self[2])

        # stringer
        self.stringer = piw.stringer(self.output.cookie())

        # clone controller input to copy it to an output and the stringer
        self.cclone = piw.clone(True)
        self.cclone.set_output(1, self.coutput.cookie())
        self.cclone.set_output(2, self.stringer.ctl_cookie())

        self.ctl_input = bundles.VectorInput(self.cclone.cookie(),
                                             self.domain,
                                             signals=(1, ))
        self.data_input = bundles.VectorInput(self.stringer.data_cookie(),
                                              self.domain,
                                              signals=(1, 2, 3, 4))

        self[4] = atom.Atom()
        self[4][1] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.data_input.merge_policy(1, False),
                               names='activation input',
                               protocols='nostage')
        self[4][2] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.data_input.vector_policy(2, False),
                               names='pressure input',
                               protocols='nostage')
        self[4][3] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.data_input.merge_policy(3, False),
                               names='roll input',
                               protocols='nostage')
        self[4][4] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.data_input.merge_policy(4, False),
                               names='yaw input',
                               protocols='nostage')
        self[4][5] = atom.Atom(domain=domain.Aniso(),
                               policy=self.ctl_input.vector_policy(1, False),
                               names='controller input')

        # self[5] is the verb container

        # enable, to deactivate the stringer
        self[6] = atom.Atom(domain=domain.Bool(),
                            init=True,
                            names="enable",
                            policy=atom.default_policy(self.__enable))

        # status output to drive the talker lights
        self[7] = bundles.Output(1, False, names='status output')
        self.light_output = bundles.Splitter(self.domain, self[7])
        self.lights = piw.lightsource(piw.change_nb(), 0,
                                      self.light_output.cookie())
        self.lights.set_size(1)
        self.__set_lights(self[6].get_value())

        # toggle enable verb, has status action to ensure the status output will be connected to a talker
        self.add_verb2(1,
                       'enable([toggle],None)',
                       callback=self.__toggle_enable,
                       status_action=self.__status)
Ejemplo n.º 14
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='interpreter',
                             protocols='langagent has_subsys',
                             container=10,
                             ordinal=ordinal)
        self.__transcript = resource.open_logfile('transcript')

        self.database = database.Database()
        self.help_manager = help_manager.HelpManager()

        self.__plumber = builtin_conn.Plumber(self, self.database, ordinal)
        self.__builtin = builtin_misc.Builtins(self, self.database)
        self[12] = script.ScriptManager(self, self.__runner)

        self.__ctxmgr = context.ContextManager(self)
        self.__statemgr = node.Server(value=piw.makestring('', 0),
                                      change=self.__setstatemgr)

        self.__state = node.Server()
        self.__state[1] = self.__statemgr
        self.__state[2] = container.PersistentFactory(
            asserted=self.__ctlassert, retracted=self.__ctlretract)
        self.__state[3] = self.__ctxmgr

        self.set_private(self.__state)

        self.__interpreters = {}
        self.interpreter = interpreter.Interpreter(
            self, self.database, self, ctx=self.__ctxmgr.default_context())
        self.register_interpreter(self.interpreter)
        self.queue = interpreter.Queue(self.interpreter)

        self[11] = atom.Atom(rtransient=True)
        self.__history = feedback.History(self)
        self[11].set_private(self.__history)

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

        self.cloner = piw.clone(True)
        self.input = bundles.VectorInput(self.cloner.cookie(),
                                         self.domain,
                                         signals=(1, 2, 3, 4),
                                         filter=piw.last_filter())

        self[1] = atom.Atom()

        self[1][1] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.input.vector_policy(1, False),
                               names='activation input')
        self[1][2] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.vector_policy(2, False),
                               names='roll input')
        self[1][3] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.vector_policy(3, False),
                               names='yaw input')
        self[1][4] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.input.vector_policy(4, False),
                               names='pressure input')

        self.cloner.set_output(1, self.__history.cookie())

        self[2] = atom.Atom(init='',
                            names='word output',
                            domain=domain.String())

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

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

        self.output1 = bundles.Splitter(self.domain, *self[5].values())
        self.output2 = bundles.Splitter(self.domain, *self[9].values())

        self.cloner.set_filtered_output(3, self.output1.cookie(),
                                        piw.last_lt_filter(9))
        self.cloner.set_filtered_output(4, self.output2.cookie(),
                                        piw.last_gt_filter(10))

        self.add_verb2(100,
                       'create([],None,role(None,[matches([controller])]))',
                       self.__ctlcreate)
        self.add_verb2(
            101,
            'create([un],None,role(None,[concrete,singular,issubject(create,[role(by,[cnc(~self)])])]))',
            self.__ctluncreate)
        self.add_verb2(30, 'message([],None,role(None,[abstract]))',
                       self.__message)
        self.add_verb2(150, 'execute([],None,role(None,[abstract]))',
                       self.__runscript)
        self.add_verb2(151, 'load([],None,role(None,[matches([help])]))',
                       self.__loadhelp)

        self.add_builtins(self.__builtin)
        self.add_builtins(self.__ctxmgr)

        self.database.add_module(builtin_conn)
        self.database.add_module(context)
        self.database.add_module(controller)

        self.__messages_on = True
        self[4] = atom.Atom(names='messages',
                            policy=atom.default_policy(self.__messages),
                            domain=domain.Bool(),
                            init=True)
        self[3] = variable.VariableManager(self)

        self.add_builtins(self[3])

        self.add_subsystem('plumber', self.__plumber)

        # TODO: how should the port number be chosen to avoid clashes with multiple eigenDs?
        # perhaps could get a free socket like this:
        # import socket
        #s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        #s.bind(('',0))
        #port = s.getsockname()[1]
        #s.close()

        self.xmlrpc_server_port = 55553

        self.widgets = widget.WidgetManager(self, self.xmlrpc_server_port)
        self.database.set_widget_manager(self.widgets)

        # Stage tab data
        self[14] = stage_server.TabList(self)
        self.tabs = self[14]

        self[15] = self.widgets

        self.add_verb2(
            102,
            'create([],None,role(None,[matches([widget])]),role(for,[concrete,singular]))',
            callback=self.__add_widget)
        self.add_verb2(
            103,
            'create([un],None,role(None,[matches([widget])]),role(for,[concrete,singular]))',
            callback=self.__del_widget)
Ejemplo n.º 15
0
    def __init__(self, address, ordinal):
        self.domain = piw.clockdomain_ctl()
        agent.Agent.__init__(
            self,
            signature=version,
            names='ladder filter',
            container=(2, 'agent',
                       atom.VerbContainer(clock_domain=self.domain)),
            ordinal=ordinal)

        self[1] = bundles.Output(1, True, names="low pass output")

        self.output = bundles.Splitter(self.domain, self[1])
        self.filter = synth_native.synthfilter2(self.output.cookie(),
                                                self.domain)
        self.bend_filter = piw.function2(
            True, 3, 4, 1, piw.makefloat_bounded(96000, 0, 0, 440, 0),
            piw.makefloat_bounded(1, -1, 0, 0, 0), self.filter.cookie())
        self.bender = piw.fast_pitchbender()
        self.bend_filter.set_functor(self.bender.bend_functor())
        self.input = bundles.VectorInput(self.bend_filter.cookie(),
                                         self.domain,
                                         signals=(2, 3, 4, 5, 6),
                                         threshold=5)
        self.input.add_upstream(self.verb_container().clock)

        self[4] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                            names="audio input",
                            policy=self.input.vector_policy(5, True))
        self[5] = atom.Atom(domain=domain.BoundedFloat(
            0,
            1,
            rest=0.5,
            hints=(T('control', 'updown'), T('inc', 0.01), T('biginc', 0.05))),
                            init=0.8,
                            names="resonance input",
                            policy=self.input.merge_policy(2, False))
        self[6] = atom.Atom(domain=domain.BoundedFloat(0, 96000),
                            init=5000,
                            names="cutoff frequency input",
                            policy=self.input.merge_policy(3, False))
        self[7] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                            names="bend input",
                            policy=self.input.merge_policy(4, False))

        self[8] = atom.Atom(domain=domain.BoundedFloat(0, 72),
                            init=24,
                            policy=atom.default_policy(self.__rchange),
                            names='frequency range',
                            protocols='bind',
                            container=(None, 'range', self.verb_container()))

        self[9] = atom.Atom(domain=domain.BoundedFloat(-72, 72, rest=0),
                            init=24,
                            policy=atom.default_policy(self.__ochange),
                            names='frequency offset',
                            protocols='bind',
                            container=(None, 'offset', self.verb_container()))

        self[10] = atom.Atom(domain=domain.BoundedFloat(1, 100),
                             init=50,
                             policy=self.input.merge_policy(6, False),
                             names='temperature')

        self.__rchange(24)
        self.__ochange(24)
Ejemplo n.º 16
0
    def __init__(self, address, ordinal):

        agent.Agent.__init__(self,
                             names='midi converter',
                             signature=version,
                             container=100,
                             ordinal=ordinal)

        self.__domain = piw.clockdomain_ctl()

        self.__state = AgentState(self.__agent_state_loaded)
        self.set_private(self.__state)

        # the MIDI stream output
        self[1] = bundles.Output(1, False, names="midi output")
        self.__output = bundles.Splitter(self.__domain, self[1])

        self.__observer = MappingObserver(self.__state, self)
        self.__channel_delegate = MidiChannelDelegate(self)
        self.__midi_from_belcanto = piw.midi_from_belcanto(
            self.__output.cookie(), self.__domain)
        self.__midi_converter = piw.midi_converter(self.__observer,
                                                   self.__channel_delegate,
                                                   self.__domain,
                                                   self.__midi_from_belcanto,
                                                   self.__get_title())

        self.parameter_list = inputparameter.List(
            self.__midi_converter, self.__midi_converter.clock_domain(),
            self.verb_container())

        # velocity detector, reads pressure input (signal 1) and generates a note on velocity (signal 4), passes thru all other signals in bundle
        self.__kvelo = piw.velocitydetect(self.__midi_from_belcanto.cookie(),
                                          1, 4)

        # Inputs for generating keyboard driven MIDI signals
        # MIDI controllers are merged down with signals from keys (driven by pressure)
        self.__kinpt = bundles.VectorInput(self.__kvelo.cookie(),
                                           self.__domain,
                                           signals=(1, 2, 3, 5, 6, 7, 8, 9, 10,
                                                    11, 12, 13))
        self[2] = atom.Atom()
        self[2][1] = atom.Atom(domain=domain.Aniso(),
                               policy=self.__kinpt.vector_policy(1, False),
                               names='pressure input')
        self[2][2] = atom.Atom(domain=domain.Aniso(),
                               policy=self.__kinpt.merge_nodefault_policy(
                                   2, False),
                               names='frequency input')

        # input to set the MIDI channel
        self[3] = atom.Atom(domain=domain.BoundedInt(0, 16),
                            init=0,
                            names="midi channel",
                            policy=atom.default_policy(self.set_midi_channel))

        # inputs to control the velocity curve
        self[4] = atom.Atom()
        self[4][1] = atom.Atom(domain=domain.BoundedInt(1, 1000),
                               init=4,
                               names="velocity sample",
                               policy=atom.default_policy(self.__set_samples))
        self[4][2] = atom.Atom(domain=domain.BoundedFloat(0.1, 10),
                               init=4,
                               names="velocity curve",
                               policy=atom.default_policy(self.__set_curve))
        self[4][3] = atom.Atom(domain=domain.BoundedFloat(0.1, 10),
                               init=4,
                               names="velocity scale",
                               policy=atom.default_policy(self.__set_scale))

        # inputs to set the minimum and maximum MIDI channel when in poly mode
        self[7] = atom.Atom(domain=domain.BoundedInt(1, 16),
                            init=1,
                            names="minimum channel",
                            policy=atom.default_policy(self.set_min_channel))
        self[8] = atom.Atom(domain=domain.BoundedInt(1, 16),
                            init=16,
                            names="maximum channel",
                            policy=atom.default_policy(self.set_max_channel))

        # parameter mapping
        self[12] = self.parameter_list

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

        self.set_midi_channel(0)
Ejemplo n.º 17
0
 def __init__(self, min, max, init, **kwd):
     Atom.__init__(self,
                   init=init,
                   domain=domain.BoundedFloat(min, max),
                   **kwd)
Ejemplo n.º 18
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='cello oscillator',
                             ordinal=ordinal)
        self.domain = piw.clockdomain_ctl()

        self[1] = bundles.Output(1, True, names="audio output")

        self.output = bundles.Splitter(self.domain, self[1])
        self.inst = stk_native.cello(self.output.cookie(), self.domain)
        self.input = bundles.VectorInput(self.inst.cookie(),
                                         self.domain,
                                         signals=(2, 3, 4, 5, 6, 7, 8, 9, 10,
                                                  11, 12, 13, 14, 15, 16, 17,
                                                  18, 19, 20, 21, 22, 23, 24))

        #self.bow_input = bundles.ScalarInput(self.inst.bow_cookie(), self.domain, signals=(1,2))

        self[2] = atom.Atom(names='inputs')
        # playing inputs
        # frequency
        self[2][2] = atom.Atom(names='frequency input',
                               domain=domain.BoundedFloat(1, 96000),
                               policy=self.input.vector_policy(2, False))
        # bow pressure
        self[2][3] = atom.Atom(names='pressure input',
                               domain=domain.BoundedFloat(0, 1),
                               policy=self.input.merge_policy(3, False),
                               protocols='nostage')
        # bow position, tranverse position of bow relative to string
        self[2][4] = atom.Atom(names='bow position input',
                               domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.merge_nodefault_policy(
                                   22, False))
        # bow velocity
        self[2][5] = atom.Atom(names='bow velocity input',
                               domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.merge_nodefault_policy(
                                   23, False))
        # pitch sweep time (portomento) for mono mode
        self[2][6] = atom.Atom(names='pitch time input',
                               domain=domain.BoundedFloat(
                                   0,
                                   100000,
                                   hints=(T('stageinc', 10), T('inc', 10),
                                          T('biginc',
                                            1000), T('control', 'updown'))),
                               init=10,
                               policy=self.input.merge_policy(4, False))

        # TODO: remove
        # bow width
        #self[2][7] = atom.Atom(names='bow width input', domain=domain.BoundedFloat(0,1), init=0, policy=self.input.merge_policy(5,False))

        # minimum frequency limit
        self[2][8] = atom.Atom(names='minimum frequency',
                               domain=domain.BoundedFloat(
                                   0.1,
                                   20,
                                   hints=(T('stageinc', 0.1), T('inc', 0.1),
                                          T('biginc',
                                            0.2), T('control', 'updown'))),
                               init=20,
                               policy=self.input.merge_policy(6, False))

        # TODO: remove
        # string junction mode
        #self[2][9] = atom.Atom(names="mode", domain=domain.BoundedFloat(1,2), init=1, policy=self.input.merge_policy(7,False))

        # string to body filter parameters
        fh = (T('stageinc', 100), T('inc',
                                    100), T('biginc',
                                            10000), T('control', 'updown'))
        gh = (T('stageinc', 1), T('inc', 1), T('biginc',
                                               10), T('control', 'updown'))
        wh = (T('stageinc', 1), T('inc', 1), T('biginc',
                                               10), T('control', 'updown'))
        self[2][10] = atom.Atom(names="low filter frequency",
                                domain=domain.BoundedFloat(0, 96000, hints=fh),
                                init=400,
                                policy=self.input.merge_policy(8, False))
        self[2][11] = atom.Atom(names="low filter gain",
                                domain=domain.BoundedFloat(-96, 24, hints=gh),
                                init=0,
                                policy=self.input.merge_policy(9, False))
        self[2][12] = atom.Atom(names="low filter width",
                                domain=domain.BoundedFloat(0.01,
                                                           100,
                                                           1,
                                                           hints=wh),
                                init=1,
                                policy=self.input.merge_policy(10, False))
        self[2][13] = atom.Atom(names="mid filter frequency",
                                domain=domain.BoundedFloat(0, 96000, hints=fh),
                                init=1000,
                                policy=self.input.merge_policy(11, False))
        self[2][14] = atom.Atom(names="mid filter gain",
                                domain=domain.BoundedFloat(-96, 24, hints=gh),
                                init=-24,
                                policy=self.input.merge_policy(12, False))
        self[2][15] = atom.Atom(names="mid filter width",
                                domain=domain.BoundedFloat(0.01,
                                                           100,
                                                           1,
                                                           hints=wh),
                                init=1,
                                policy=self.input.merge_policy(13, False))
        self[2][16] = atom.Atom(names="high filter frequency",
                                domain=domain.BoundedFloat(0, 96000, hints=fh),
                                init=10000,
                                policy=self.input.merge_policy(14, False))
        self[2][17] = atom.Atom(names="high filter gain",
                                domain=domain.BoundedFloat(-96, 24, hints=gh),
                                init=-40,
                                policy=self.input.merge_policy(15, False))
        self[2][18] = atom.Atom(names="high filter width",
                                domain=domain.BoundedFloat(0.01,
                                                           100,
                                                           1,
                                                           hints=wh),
                                init=1,
                                policy=self.input.merge_policy(16, False))

        # string filter parameters
        # TODO: remove
        #self[2][19] = atom.Atom(names="string filter frequency", domain=domain.BoundedFloat(0,96000,1), init=800, policy=self.input.merge_policy(17,False))
        # TODO: remove
        #self[2][20] = atom.Atom(names="string filter width", domain=domain.BoundedFloat(0.01,100,1), init=0.8, policy=self.input.merge_policy(18,False))
        # polyphonic bow velocity, to bow independently with keys
        # TODO: remove
        #self[2][21] = atom.Atom(names='poly bow velocity input', domain=domain.BoundedFloat(-1,1,0), policy=self.input.merge_policy(19,False))
        # TODO: remove
        #self[2][22] = atom.Atom(names='poly bow enable', domain=domain.Bool(), init=False, policy=self.input.merge_policy(20,False))

        # velocity factor, determines velocity of bow from position difference
        self[2][23] = atom.Atom(names='bow velocity factor',
                                domain=domain.BoundedFloat(
                                    0,
                                    100,
                                    1,
                                    hints=(T('stageinc',
                                             1), T('inc', 1), T('biginc', 10),
                                           T('control', 'updown'))),
                                init=1,
                                policy=self.input.merge_policy(21, False))
Ejemplo n.º 19
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='audio',
                             icon='plg_macosx/audio.png',
                             container=9,
                             ordinal=ordinal)

        self.domain = piw.clockdomain_ctl()
        self.clone = piw.clone(True)
        self.audio = AudioDelegate(self, self.domain)
        self.recorder = piw.wavrecorder(self.domain)
        self.clone.set_output(1, self.audio.cookie())
        self.clone.set_output(2, self.recorder.cookie())
        self.input = bundles.ScalarInput(self.clone.cookie(),
                                         self.domain,
                                         signals=(1, 2),
                                         threshold=0)
        self.__loading = False

        self[1] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                            names='left input',
                            policy=self.input.nodefault_policy(1, True))
        self[2] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                            names='right input',
                            policy=self.input.nodefault_policy(2, True))
        self[3] = atom.Atom(
            domain=domain.EnumOrNull(44100, 48000, 96000),
            names='sample rate',
            protocols='bind set',
            policy=atom.default_policy(self.__change_sample_rate),
            container=(None, 'sample rate', self.verb_container()))
        self[3].add_verb2(
            1,
            'set([],~a,role(None,[instance(~self)]),role(to,[numeric]))',
            callback=self.__set_sample_rate)
        self[3].add_verb2(2,
                          'set([un],~a,role(None,[instance(~self)]))',
                          callback=self.__unset_sample_rate)
        self[7] = Port(self)
        self[8] = atom.Atom(
            domain=domain.BoundedIntOrNull(0, 3072, 0),
            names='buffer size',
            protocols='bind set',
            policy=atom.default_policy(self.__change_buffer_size),
            container=(None, 'buffer size', self.verb_container()))
        self[8].add_verb2(
            1,
            'set([],~a,role(None,[instance(~self)]),role(to,[numeric]))',
            callback=self.__set_buffer_size)
        self[8].add_verb2(2,
                          'set([un],~a,role(None,[instance(~self)]))',
                          callback=self.__unset_buffer_size)

        self.add_verb2(1, 'mute([],None)', self.__mute)
        self.add_verb2(2, 'mute([un],None)', self.__unmute)
        self.add_verb2(
            3, 'choose([],None,role(None,[ideal([~server,port]),singular]))',
            self.__choose)

        self.enum()

        self.__filename = resource.new_resource_file('audio', 'audio.wav')
        self.recorder.setfile(self.__filename)

        self[10] = atom.Atom(domain=domain.Bool(),
                             init=False,
                             transient=True,
                             policy=policy.FastPolicy(
                                 self.recorder.record(),
                                 policy.TriggerStreamPolicy()),
                             names='recorder running input')
Ejemplo n.º 20
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,signature=version, names='interpreter',protocols='langagent has_subsys',container=10,ordinal=ordinal)
        self.__transcript = resource.open_logfile('transcript')

        self.database = database.Database(lexicon_changed=self.__lexicon_changed)
        self.help_manager = help_manager.HelpManager()
        self.__db_started = False

        self.set_property_string('timestamp',self.database.get_lexicon().get_timestamp())

        self.__builtin = builtin_misc.Builtins(self,self.database)
        self[12] = script.ScriptManager(self,self.__runner)

        self.__plumber = plumber.Plumber(self,self.database)

        self.__ctxmgr = context.ContextManager(self)
        self.__statemgr = node.Server(value=piw.makestring('',0), change=self.__setstatemgr)

        self.__state = node.Server()
        self.__state[1] = self.__statemgr
        self.__state[3] = self.__ctxmgr
        
        self.set_private(self.__state)

        self.__interpreters = {}
        self.interpreter = interpreter.Interpreter(self, self.database, self, ctx=self.__ctxmgr.default_context())
        self.register_interpreter(self.interpreter)
        self.queue = interpreter.Queue(self.interpreter)

        self[11] = atom.Atom(rtransient=True)
        self.__history = feedback.History(self)
        self[11].set_private(self.__history)

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

        self.cloner = piw.clone(True)
        self.input = bundles.VectorInput(self.cloner.cookie(),self.domain,signals=(1,2,3,4),filter=piw.last_filter())

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

        self[1][1] = atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.input.vector_policy(1,False),names='key input')
        self[1][2] = atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.input.vector_policy(2,False),names='roll input')
        self[1][3] = atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.input.vector_policy(3,False),names='yaw input')
        self[1][4] = atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.input.vector_policy(4,False),names='pressure input')

        self.cloner.set_output(1,self.__history.cookie())

        self[2] = atom.Atom(init='',names='word output',domain=domain.String())

        self[5] = atom.Atom(names='outputs')
        self[5][1] = bundles.Output(1,False, names='key output')
        self[5][2] = bundles.Output(2,False, names='roll output')
        self[5][3] = bundles.Output(3,False, names='yaw output')
        self[5][4] = bundles.Output(4,False, names='pressure output')

        self.output1 = bundles.Splitter(self.domain,*self[5].values())

        self.cloner.set_output(2,self.output1.cookie())

        self.add_verb2(30,'message([],None,role(None,[abstract]))', self.__message)
        self.add_verb2(150,'execute([],None,role(None,[abstract]))',self.__runscript)
        self.add_verb2(151,'load([],None,role(None,[matches([help])]))',self.__loadhelp)
        self.add_verb2(152,'identify([],None,role(None,[concrete]))',self.__identify)

        self.add_builtins(self.__builtin)
        self.add_builtins(self.__ctxmgr)
        self.add_builtins(self.__plumber)

        self.__messages_on = True
        self[4] = atom.Atom(names='messages',policy=atom.default_policy(self.__messages),domain=domain.Bool(),init=True)
        self[3] = variable.VariableManager(self)

        self.add_builtins(self[3])

        # TODO: how should the port number be chosen to avoid clashes with multiple eigenDs?
        # perhaps could get a free socket like this:
        # import socket
        #s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        #s.bind(('',0))
        #port = s.getsockname()[1]
        #s.close()

        self.xmlrpc_server_port = 55553;

        self.widgets = widget.WidgetManager(self, self.xmlrpc_server_port)
        self.database.set_widget_manager(self.widgets)

        # Stage tab data
        self[14] = stage_server.TabList(self)
        self.tabs = self[14]

        self[15] = self.widgets
Ejemplo n.º 21
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='scaler',
                             protocols='bind set',
                             container=5,
                             ordinal=ordinal)
        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*', 0))

        self.__fixed = False
        self.set_private(
            node.Server(value=piw.makebool(False, 0), change=self.__changefix))

        self[1] = atom.Atom(names='outputs')
        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][7] = bundles.Output(5, False, names='key output')
        self[1][5] = bundles.Output(6, False, names='scale note output')
        self[1][6] = bundles.Output(7, False, names='frequency output')

        self[2] = bundles.Output(1,
                                 False,
                                 names='light output',
                                 protocols='revconnect')
        self.lights = bundles.Splitter(self.domain, self[2])

        self.ctl = piw.scaler_controller(self.lights.cookie())
        self.ctl_input = bundles.VectorInput(self.ctl.cookie(),
                                             self.domain,
                                             signals=(1, ))

        self.output = bundles.Splitter(self.domain, *self[1].values())
        self.filter = piw.scaler(self.ctl, self.output.cookie(), cubic())
        self.input = bundles.VectorInput(self.filter.cookie(),
                                         self.domain,
                                         signals=(2, 3, 4, 5, 6, 7, 8, 9, 10,
                                                  11, 12, 13, 14, 15, 16, 17,
                                                  18))
        self.input.correlator.clocksink().add_upstream(
            self.ctl_input.correlator.clocksink())

        self[4] = atom.Atom(names='inputs')

        self[4][2] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.input.merge_policy(2, False),
                               names='pressure input',
                               protocols='nostage')
        self[4][3] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.merge_policy(3, False),
                               names='roll input',
                               protocols='nostage')
        self[4][4] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.merge_policy(4, False),
                               names='yaw input',
                               protocols='nostage')
        self[4][22] = atom.Atom(domain=domain.Aniso(),
                                policy=self.input.vector_policy(5, False),
                                names='key input')

        th = (T('stageinc', 1), T('inc', 1), T('biginc',
                                               1), T('control', 'updown'))
        bh = (T('stageinc', 0.5), T('inc', 0.5), T('biginc',
                                                   12), T('control', 'updown'))
        sh = (T('choices', '[0,2,4,5,7,9,11,12]',
                '[0,1,2,3,4,5,6,7,8,9,10,11,12]', '[0,2,4,6,8,10,12]',
                '[0,2,3,5,7,8,10,12]', '[0,3,5,6,7,10,12]',
                '[0,2,3,6,7,8,11,12]', '[0,3,5,7,10,12]', '[0,2,4,7,9,12]'),
              T('control', 'selector'))
        self[4][5] = atom.Atom(domain=domain.BoundedFloat(0, 12, hints=th),
                               policy=self.input.merge_policy(6, False),
                               names='tonic input',
                               protocols='bind set',
                               container=(None, 'tonic',
                                          self.verb_container()))
        self[4][6] = atom.Atom(domain=domain.BoundedFloat(-20, 20, hints=th),
                               policy=self.input.merge_policy(7, False),
                               names='base note input',
                               protocols='bind')
        self[4][7] = atom.Atom(domain=domain.String(hints=sh),
                               init='[0,2,4,5,7,9,11,12]',
                               policy=self.input.merge_policy(8, False),
                               names='scale input',
                               protocols='bind set',
                               container=(None, 'scale',
                                          self.verb_container()))
        self[4][8] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.merge_policy(
                                   9, policy.LopassStreamPolicy(200, 0.6)),
                               names='key pitch bend input',
                               protocols='explicit')
        self[4][9] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.merge_policy(10, False),
                               names='global pitch bend input')
        self[4][10] = atom.Atom(domain=domain.BoundedFloat(0, 72, hints=bh),
                                init=1,
                                policy=self.input.merge_policy(11, False),
                                names='key bend range input',
                                protocols='bind explicit')
        self[4][11] = atom.Atom(domain=domain.BoundedFloat(0, 72, hints=bh),
                                init=12,
                                policy=self.input.merge_policy(12, False),
                                names='global bend range input',
                                protocols='bind')
        self[4][12] = atom.Atom(domain=domain.Aniso(),
                                policy=self.ctl_input.vector_policy(1, False),
                                names='controller input')
        self[4][13] = atom.Atom(domain=domain.Bool(),
                                policy=self.input.merge_policy(14, False),
                                names='override',
                                protocols='bind')
        self[4][14] = atom.Atom(domain=domain.BoundedFloat(-1, 9, hints=th),
                                init=3,
                                policy=self.input.merge_policy(15, False),
                                names='octave input',
                                protocols='bind',
                                container=(None, 'octave',
                                           self.verb_container()))
        self[4][15] = atom.Atom(domain=domain.BoundedInt(1, 4),
                                init=2,
                                policy=atom.default_policy(self.__set_curve),
                                names='curve',
                                protocols='bind')
        self[4][17] = atom.Atom(domain=domain.BoundedFloat(-10, 10, hints=th),
                                init=0,
                                policy=self.input.merge_policy(17, False),
                                names='relative octave input',
                                protocols='bind')
        self[4][18] = atom.Atom(domain=domain.BoundedFloat(-96, 96, hints=th),
                                policy=self.input.merge_policy(18, False),
                                names='modifier input')

        self.add_verb2(
            3,
            'choose([],None,role(none,[ideal([None,scale]),singular]))',
            callback=self.__tune_scale)
        self.add_verb2(5, 'fix([],None)', callback=self.__fix)
        self.add_verb2(6, 'fix([un],None)', callback=self.__unfix)

        self[4][5].add_verb2(
            1,
            'set([],~a,role(None,[instance(~self)]),role(to,[ideal([None,note]),singular]))',
            callback=self.__tune_tonic)
        self[4][7].add_verb2(
            2,
            'set([],~a,role(None,[instance(~self)]),role(to,[ideal([None,scale]),singular]))',
            callback=self.__tune_scale)
Ejemplo n.º 22
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='talker',
                             container=5,
                             ordinal=ordinal)

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

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

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

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

        self[2] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                            policy=self.activation_input.local_policy(
                                1, False),
                            names='activation input',
                            protocols='nostage')
        self[3] = atom.Atom(creator=self.__create, wrecker=self.__wreck)
        self[4] = PhraseBrowser(self.__eventbykey, self.__keylist)
Ejemplo n.º 23
0
    def __init__(self, address, ordinal):
        #
        # Agents are constructed with the address and ordinal.  Each
        # agent will have a unique address and an ordinal unique for
        # that type of agent.
        #
        # We also pass in the automatically generated version to go into
        # the metadata.
        #
        agent.Agent.__init__(self, signature=version, names='latch', ordinal=ordinal)

        #
        # Create a clock domain.  A clock domain is a collection of clock
        # sinks all of which share common properties.  Domains can be isochronous
        # or anisochronous.  Currently, sinks in iso domains can be connected
        # only to other iso domains using the same source.
        #
        self.domain = piw.clockdomain_ctl()

        #
        # Make our domain anisochronous (aniso is used for everything except audio)
        #
        self.domain.set_source(piw.makestring('*',0))

		#
		# Create an atom to bundle the outputs also create sub-atoms that correspond to
		# each of the input streams.
        # An output is created on each sub-atom with a dedicated signal number and name.
        # Setting the second argument to false means that they're not isochronous data streams.
		#
        self[2] = atom.Atom(names="outputs")
        self[2][1] = bundles.Output(1, False, names='activation output')
        self[2][2] = bundles.Output(2, False, names='pressure output')
        self[2][3] = bundles.Output(3, False, names='roll output')
        self[2][4] = bundles.Output(4, False, names='yaw output')

        #
        # bundles.Splitter is a bundle component which demultiplexes the events onto separate
        # Outputs, 1 output per signal.  The bundle, which carries events containing signals,
        # is represented on the output as signals containing events.
		#
        self.output = bundles.Splitter(self.domain,*self[2].values())
        
        #
        # Create an instance of the native Latch implementation and pass it the clock domain
        # and the upstream cookie for the output data.
        #
        self.native = latch(self.domain, self.output.cookie())

        #
        # Create an input.  An input does the work of correlating the events on a 
        # number of signals, grouping them together.
        # 
        # A Vector input is a proper multiple channel input. This one is being
        # constructed to handle 4 signals, numbered 1,2,3 and 4. The events will
        # be sent to the output stage through the use of the native implementation's cookie.
        #
        self.key_input = bundles.VectorInput(self.native.cookie(), self.domain, signals=(1,2,3,4))

		#
        # Create a null atom just to group our inputs. We still name this atom so that it
        # shows up with a meaningful name through introspection by tools like Workbench.
        #
        self[1] = atom.Atom(names="inputs")

        #
        # Now create our inputs. The data policy for the atom is created by our vector input.
        # There are lots of corner cases when we invert our model from signal-contains-events
        # to event-contains-signals. In particular, this happens when events on individual
        # signals dont start and and stop together.
        #
        # Any input with a vector_policy will create or join an existing event.
        # merge_policy will never create events, just join onto existing events created by
        # a vector policy.
        #
        # We create 4 inputs, with vector policies routing them to signals 1,2,3 and 4 on
        # our bundle. These are all non-iso inputs.
        #
        self[1][1] = atom.Atom(domain=domain.BoundedFloat(0,1), policy=self.key_input.vector_policy(1,False), names='activation input')
        self[1][2] = atom.Atom(domain=domain.BoundedFloat(0,1), policy=self.key_input.vector_policy(2,False), names='pressure input')
        self[1][3] = atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.key_input.vector_policy(3,False), names='roll input')
        self[1][4] = atom.Atom(domain=domain.BoundedFloat(-1,1), policy=self.key_input.vector_policy(4,False), names='yaw input')

        #
        # Lastly, create atoms called 'minimum' and 'controller' to store values for those.
        # These will appear in Stage and can be set using Belcanto. When they changes, the 
        # methods __minimum and __controller will be called with a Python numeric argument
        # (because its a numeric domain).
        #
        self[3] = atom.Atom(domain=domain.BoundedFloat(0,1), init=0.5, policy=atom.default_policy(self.__minimum), names='minimum')
        self[4] = atom.Atom(domain=domain.BoundedInt(2,4), init=2, policy=atom.default_policy(self.__controller), names='controller')
Ejemplo n.º 24
0
    def __init__(self, name):
        agent.Agent.__init__(self,
                             signature=upgrade.Signature(),
                             volatile=True,
                             names='eigencommander',
                             ordinal=1)

        self.name = name
        self.node = random.randrange(0, 1 << 48L) | 0x010000000000L

        self.langModel = gui.call_bg_sync(self.__create_lang)
        self.historyModel = history.HistoryModel(self.langModel)
        self.commandModel = command.CommandModel(self.langModel)
        self.dictionaryModel = dictionary.DictionaryModel(self.langModel)

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

        self[25] = scroller.Scroller(self.__scroll1,
                                     self.__tap1,
                                     names="scroller",
                                     ordinal=1)  # scrolls the dictionary pane
        self[26] = scroller.Scroller(self.__scroll2,
                                     self.__tap2,
                                     names="scroller",
                                     ordinal=2)  # scrolls the history pane

        self.scroller_clone = piw.clone(True)
        self.scroller_clone.set_output(1, self[25].cookie())
        self.scroller_clone.set_output(2, self[26].cookie())

        self.scroller_in = bundles.VectorInput(self.scroller_clone.cookie(),
                                               self.cdomain,
                                               signals=(1, 2, 3, 4))

        self[28] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                             init=0,
                             names='roll',
                             policy=self.scroller_in.merge_policy(2, False))
        self[29] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                             init=0,
                             names='yaw',
                             policy=self.scroller_in.merge_policy(1, False))
        self[30] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                             init=0,
                             names='key',
                             policy=self.scroller_in.vector_policy(3, False))
        self[31] = atom.Atom(domain=domain.Aniso(),
                             names='controller',
                             policy=self.scroller_in.merge_policy(4, False))

        self[9] = dictionary.DictionaryAgent(self, dictionary.getName())

        self.add_verb2(2, 'minimise([],None)', callback=self.__minimise)
        self.add_verb2(3, 'maximise([],None)', callback=self.__maximise)

        self.font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)
        self.font.SetPointSize(fonts.DEFAULT_PTS)

        self[12] = atom.Atom(domain=domain.BoundedInt(5, 20, rest=11),
                             names='text',
                             protocols='nostage',
                             policy=atom.default_policy(self.__set_fontsize))

        self.__size = node.Server(change=self.__size_changed)
        self.set_private(node.Server())
        self.get_private()[1] = self.__size
        self.__x = 100
        self.__y = 100
        self.__setup_size()

        self.__minX = 60
        self.__minY = 80
        self.__maxX = 100
        self.__maxY = 100

        self.__rootFrame = None
        self.__createRootFrame()

        self[25].reset(1, -1)
        self[26].reset(-1, 1)

        self[25].enable()
        self[26].enable()
Ejemplo n.º 25
0
    def __init__(self, address, ordinal):
        # the agent event clock
        self.domain = piw.clockdomain_ctl()

        # verb container, used by all taps
        agent.Agent.__init__(self,
                             signature=version,
                             names='convolver',
                             container=3,
                             ordinal=ordinal)

        self.vol = piw.make_f2f_table(
            -24, 24, 1000, picross.make_f2f_functor(volume_function))

        # outputs
        self[1] = bundles.Output(1, True, names="left audio output")
        self[2] = bundles.Output(2, True, names="right audio output")
        self.output = bundles.Splitter(self.domain, self[1], self[2])

        # the convolver class
        self.convolver = convolver_native.convolver(self.vol,
                                                    self.output.cookie(),
                                                    self.domain)

        # input has the correlator and a bundle style output
        self.input = bundles.ScalarInput(self.convolver.cookie(),
                                         self.domain,
                                         signals=(1, 2, 3, 4))

        # self[3] = verb container

        self[4] = ImpulseBrowser(self)

        # audio inputs
        # use vector policy inputs
        self[5] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                            names="left audio input",
                            policy=self.input.nodefault_policy(1, True))
        self[6] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                            names="right audio input",
                            policy=self.input.nodefault_policy(2, True))

        # wet/dry mix
        self[7] = atom.Atom(domain=domain.BoundedFloat(
            -24,
            24,
            hints=(T('stageinc', 0.1), T('inc',
                                         0.1), T('biginc',
                                                 1), T('control', 'updown'))),
                            init=0,
                            names="dry gain",
                            protocols='input',
                            policy=self.input.merge_policy(3, False))
        self[11] = atom.Atom(domain=domain.BoundedFloat(
            -24,
            24,
            hints=(T('stageinc', 0.1), T('inc',
                                         0.1), T('biginc',
                                                 1), T('control', 'updown'))),
                             init=0,
                             names="wet gain",
                             protocols='input',
                             policy=self.input.merge_policy(4, False))
        # effect enable
        self[8] = atom.Atom(domain=domain.Bool(),
                            init=True,
                            names="enable",
                            protocols='input',
                            policy=atom.default_policy(self.__set_enable))
        # mono processing mode
        self[9] = atom.Atom(domain=domain.Bool(),
                            init=False,
                            names="mono",
                            policy=atom.default_policy(
                                self.__set_mono_processing))
        # enable time, time to fade in and out when enabling in ms
        self[10] = atom.Atom(
            names='enable time input',
            domain=domain.BoundedFloat(0,
                                       100000,
                                       hints=(T('stageinc', 1), T('inc', 1),
                                              T('biginc',
                                                10), T('control', 'updown'))),
            init=100,
            policy=atom.default_policy(self.__set_enable_time))

        self.__set_enable(self[8].get_value())
        self.__set_mono_processing(self[9].get_value())
        self.__set_enable_time(self[10].get_value())

        self.add_verb2(
            1,
            'choose([],None,role(None,[ideal([~server,impulse]),singular]))',
            self.__choose)
Ejemplo n.º 26
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',
                              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())
Ejemplo n.º 27
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,signature=version,names='audio unit',container=100)
        self.set_property_long('cordinal',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)
        self.__audio_output_channels = audio.AudioChannels(self.__audio_output)
        self.__midi_output = bundles.Splitter(self.__domain)
        self.__observer = PluginObserver(self.__state,self)
        self.__channel_delegate = MidiChannelDelegate(self)
        self.__host = host_native.plugin_instance(
            self.__observer, self.__channel_delegate,
            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(),self.__domain,signals=range(1,65)),1,2)
        self.__audio_input_channels = audio.AudioChannels(self.__audio_input)
        self.__velocity_detector = piw.velocitydetect(self.__host.midi_from_belcanto(),1,4)
        self.__key_input = bundles.VectorInput(self.__velocity_detector.cookie(),self.__domain,signals=(1,2))
        self.__midi_input = bundles.ScalarInput(self.__host.midi_aggregator(),self.__domain,signals=(1,))
        self.__metronome_input = bundles.ScalarInput(self.__host.metronome_input(),self.__domain,signals=(1,2,3,4))
        self.__host.set_bypassed(True)

        # plugin browser
        self[1] = self.__browser

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

        # audio input
        self[3] = atom.Atom()
        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()
        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()
        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,16),init=0,names='midi channel',policy=atom.default_policy(self.set_midi_channel))

        # velocity curve control
        self[8] = atom.Atom()
        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),init=4,names='velocity curve',policy=atom.default_policy(self.__set_velocity_curve))
        self[8][3] = atom.Atom(domain=domain.BoundedFloat(0.1,10),init=4,names='velocity scale',policy=atom.default_policy(self.__set_velocity_scale))

        self[10] = atom.Atom(domain=domain.BoundedFloatOrNull(0,100000),init=None,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))

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

        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)

        self.set_ordinal(ordinal)
Ejemplo n.º 28
0
    def set_threshhold(self):
        self[241] = atom.Atom(
            domain=domain.BoundedInt(0, 4095),
            init=self.keyboard.get_pedal_min(1),
            protocols='input output explicit',
            names='pedal minimum threshold',
            ordinal=1,
            policy=atom.default_policy(lambda v: self.__set_min(1, v)))
        self[242] = atom.Atom(
            domain=domain.BoundedInt(0, 4095),
            init=self.keyboard.get_pedal_max(1),
            protocols='input output explicit',
            names='pedal maximum threshold',
            ordinal=1,
            policy=atom.default_policy(lambda v: self.__set_max(1, v)))
        self[243] = atom.Atom(
            domain=domain.BoundedInt(0, 4095),
            init=self.keyboard.get_pedal_min(2),
            protocols='input output explicit',
            names='pedal minimum threshold',
            ordinal=2,
            policy=atom.default_policy(lambda v: self.__set_min(2, v)))
        self[244] = atom.Atom(
            domain=domain.BoundedInt(0, 4095),
            init=self.keyboard.get_pedal_max(2),
            protocols='input output explicit',
            names='pedal maximum threshold',
            ordinal=2,
            policy=atom.default_policy(lambda v: self.__set_max(2, v)))
        self[245] = atom.Atom(
            domain=domain.BoundedInt(0, 4095),
            init=self.keyboard.get_pedal_min(3),
            protocols='input output explicit',
            names='pedal minimum threshold',
            ordinal=3,
            policy=atom.default_policy(lambda v: self.__set_min(3, v)))
        self[246] = atom.Atom(
            domain=domain.BoundedInt(0, 4095),
            init=self.keyboard.get_pedal_max(3),
            protocols='input output explicit',
            names='pedal maximum threshold',
            ordinal=3,
            policy=atom.default_policy(lambda v: self.__set_max(3, v)))
        self[247] = atom.Atom(
            domain=domain.BoundedInt(0, 4095),
            init=self.keyboard.get_pedal_min(4),
            protocols='input output explicit',
            names='pedal minimum threshold',
            ordinal=4,
            policy=atom.default_policy(lambda v: self.__set_min(4, v)))
        self[248] = atom.Atom(
            domain=domain.BoundedInt(0, 4095),
            init=self.keyboard.get_pedal_max(4),
            protocols='input output explicit',
            names='pedal maximum threshold',
            ordinal=4,
            policy=atom.default_policy(lambda v: self.__set_max(4, v)))

        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[252] = 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[253] = 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))
Ejemplo n.º 29
0
    def __init__(self, name):
        agent.Agent.__init__(self,
                             signature=upgrade.Signature(),
                             names='eigenbrowser',
                             volatile=True)

        self.name = name
        self.node = random.randrange(0, 1 << 48L) | 0x010000000000L

        self.langModel = gui.call_bg_sync(self.__create_lang)
        self.historyModel = history.HistoryModel(self.langModel)
        self.cdomain = piw.clockdomain_ctl()
        self.cdomain.set_source(piw.makestring('*', 0))

        self.scroller1 = Scroller2(
            self.__scroll1)  # scrolls the left hand pane
        self.scroller2 = Scroller(
            self.__scroll2, self.__tap2)  # scrolls the right hand (dinfo) pane
        self.scroller3 = Scroller(self.__scroll3,
                                  self.__tap3)  # scrolls the path pane

        self.scroller_in1 = bundles.VectorInput(self.scroller1.cookie(),
                                                self.cdomain,
                                                signals=(1, 2, 3))
        self.scroller_in2 = bundles.VectorInput(self.scroller2.cookie(),
                                                self.cdomain,
                                                signals=(1, 2, 3))
        self.scroller_in3 = bundles.VectorInput(self.scroller3.cookie(),
                                                self.cdomain,
                                                signals=(1, 2, 3))

        nudge = (T('inc', 0.1), )
        self[1] = atom.Atom(domain=domain.BoundedFloat(-1, 1, hints=nudge),
                            init=0,
                            names='sideways nudger',
                            ordinal=1,
                            policy=self.scroller_in1.vector_policy(1, False))
        #self[2] = atom.Atom(domain=domain.BoundedFloat(-1,1,hints=nudge), init=0, names='vertical nudger', ordinal=1, policy=self.scroller_in1.vector_policy(2,False),rtransient=True)
        self[2] = atom.Atom(domain=domain.BoundedFloat(-1, 1, hints=nudge),
                            init=0,
                            names='vertical nudger',
                            ordinal=1,
                            policy=self.scroller_in1.vector_policy(2, False))

        self[3] = atom.Atom(domain=domain.BoundedFloat(-1, 1, hints=nudge),
                            init=0,
                            names='sideways nudger',
                            ordinal=2,
                            policy=self.scroller_in2.vector_policy(1, False))
        self[4] = atom.Atom(domain=domain.BoundedFloat(-1, 1, hints=nudge),
                            init=0,
                            names='vertical nudger',
                            ordinal=2,
                            policy=self.scroller_in2.vector_policy(2, False))

        self[8] = browse.BrowseAgent(self, browse.getName())

        self.add_verb2(1,
                       'browse([],None,role(None,[proto(browse),singular]))',
                       callback=self.__do_browse)
        self.add_verb2(2, 'minimise([],None)', callback=self.__minimise)
        self.add_verb2(3, 'maximise([],None)', callback=self.__maximise)

        self.font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)
        self.font.SetPointSize(fonts.DEFAULT_PTS)

        self[12] = atom.Atom(domain=domain.BoundedInt(5, 20, rest=11),
                             names='text',
                             policy=atom.default_policy(self.__set_fontsize))
        self[15] = atom.Atom(domain=domain.BoundedFloat(-1, 1, hints=nudge),
                             init=-1,
                             names='sideways nudger',
                             ordinal=3,
                             policy=self.scroller_in3.vector_policy(1, False))
        self[16] = atom.Atom(domain=domain.BoundedFloat(-1, 1, hints=nudge),
                             init=-1,
                             names='vertical nudger',
                             ordinal=3,
                             policy=self.scroller_in3.vector_policy(2, False))
        self[17] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                             init=0,
                             names='tapper',
                             ordinal=1,
                             policy=self.scroller_in1.vector_policy(3, False))
        self[18] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                             init=0,
                             names='tapper',
                             ordinal=2,
                             policy=self.scroller_in2.vector_policy(3, False))
        self[19] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                             init=0,
                             names='tapper',
                             ordinal=3,
                             policy=self.scroller_in3.vector_policy(3, False))

        self.__size = node.Server(change=self.__size_changed)
        self.set_private(node.Server())
        self.get_private()[1] = self.__size
        self.__x = 100
        self.__y = 100
        self.__setup_size()

        self.__minX = 60
        self.__minY = 80
        self.__maxX = 100
        self.__maxY = 100

        self.__rootFrame = None
        self.__createRootFrame()

        #        self.scroller2.reset(-1,-1)
        self.scroller3.reset(-1, 1)
        self.scroller1.set_scheme(1)

        self.scroller1.enable()
        self.scroller2.enable()
        self.scroller3.enable()
Ejemplo n.º 30
0
    def __init__(self, address, ordinal):
        self.domain = piw.clockdomain_ctl()
        vc = atom.VerbContainer(clock_domain=self.domain)

        agent.Agent.__init__(self,
                             signature=version,
                             names='arranger',
                             protocols='bind',
                             container=(9, 'agent', vc),
                             ordinal=ordinal)

        self[1] = self.verb_container()

        self.model = arranger_native.model(self.domain)

        self.light_output = bundles.Output(1,
                                           False,
                                           names='light output',
                                           protocols='revconnect')
        self.light_splitter = bundles.Splitter(self.domain, self.light_output)
        self.light_convertor = piw.lightconvertor(self.light_splitter.cookie())
        self.view = arranger_native.view(self.model,
                                         self.light_convertor.cookie())

        self.ctlr_fb = piw.functor_backend(1, True)
        self.ctlr_fb.set_functor(piw.pathnull(0), self.view.control())
        self.ctlr_input = bundles.ScalarInput(self.ctlr_fb.cookie(),
                                              self.domain,
                                              signals=(1, ))
        self[2] = atom.Atom(domain=domain.Aniso(),
                            policy=self.ctlr_input.policy(1, False),
                            names='controller input')

        self.kinput = bundles.VectorInput(self.view.cookie(),
                                          self.domain,
                                          signals=(1, 2, 3))
        self[3] = atom.Atom()
        self[3][1] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.kinput.vector_policy(1, False),
                               names='pressure input',
                               protocols='nostage')
        self[3][2] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.kinput.merge_policy(2, False),
                               names='roll input',
                               protocols='nostage')
        self[3][3] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.kinput.merge_policy(3, False),
                               names='yaw input',
                               protocols='nostage')
        self[3][4] = self.light_output

        self.cinput = bundles.ScalarInput(self.model.cookie(),
                                          self.domain,
                                          signals=(1, 2))
        self.cinput.add_upstream(self.verb_container().clock)
        self[4] = atom.Atom()
        self[4][1] = atom.Atom(domain=domain.Aniso(),
                               policy=self.cinput.nodefault_policy(1, False),
                               names='song beat input')
        self[4][2] = atom.Atom(domain=domain.Aniso(),
                               policy=self.cinput.nodefault_policy(2, False),
                               names='running input')

        self[5] = atom.Atom(creator=self.__createtarget,
                            wrecker=self.__wrecktarget)
        self.add_mode2(
            1,
            'mode([],role(when,[numeric,singular]),option(using,[instance(~server)]))',
            self.__mode, self.__query, self.__cancel_mode)

        self[7] = Parameters(self)

        self.__eventlist = EventList(self)
        self.__playstop = node.Server(change=self.__play_change)
        self.__playstop[1] = self.__eventlist

        self.set_private(self.__playstop)

        self.add_verb2(1,
                       'play([],~self)',
                       create_action=self.__play,
                       clock=True)
        self.add_verb2(2,
                       'play([un],~self)',
                       create_action=self.__unplay,
                       clock=True)
        self.add_verb2(3, 'cancel([],~self,role(None,[numeric,singular]))',
                       self.__cancel_verb)
        self.add_verb2(4, 'clear([],~self)', self.__clear_verb)
        self.model.playstop_set(
            piw.make_change_nb(utils.slowchange(self.__play_set)))