Beispiel #1
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,signature=version,names='clicker',container=3,ordinal=ordinal)
        self.domain = piw.clockdomain_ctl()
        accent = wav_resource('accent.wav')
        beat = wav_resource('beat.wav')

        self[1] = bundles.Output(1,True,names='audio output')
        self.output = bundles.Splitter(self.domain, self[1])
        self.clicker = loop_native.clicker(self.output.cookie(),self.domain,accent,beat)
        self.input = bundles.ScalarInput(self.clicker.cookie(), self.domain, signals=(1,2))

        self[2] = atom.Atom()
        self[2][1] = atom.Atom(domain=domain.Aniso(),policy=self.input.policy(1,False),names='running input')
        self[2][2] = atom.Atom(domain=domain.Aniso(),policy=self.input.policy(2,False),names='bar beat input')

        self.add_verb2(1,'play([],None)',self.__play,status_action=self.__status)
        self.add_verb2(2,'play([un],None)',self.__unplay,status_action=self.__status)
        self.add_verb2(3,'play([toggle],None)',self.__toggle,status_action=self.__status)
        
        self[4]=bundles.Output(1,False,names='status output')
        self.light_output=bundles.Splitter(self.domain,self[4])
        self.lights=piw.lightsource(piw.change_nb(),0,self.light_output.cookie())
        self.lights.set_size(1)
        self.lights.set_status(1,const.status_inactive)
        self.__playstate = node.Server(value=piw.makebool(True,0),change=self.__playchanged)
        self.set_private(self.__playstate)
        self.__playing=False
Beispiel #2
0
def changify_nb(c):
    if c is None:
        return piw.change_nb()
    if isinstance(c,piw.change):
        c = make_change_nb(c)
    if not isinstance(c,piw.change_nb):
        c = piw.make_change_nb_functor(c)
    return c
Beispiel #3
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self, signature=version, names='illuminator', ordinal=ordinal)

        self.domain = piw.clockdomain_ctl()

        self[7] = bundles.Output(1, False, names='server status output')
        self.server_status_output = bundles.Splitter(self.domain, self[7])
        self.server_lights = piw.lightsource(piw.change_nb(), 0, self.server_status_output.cookie())
        self.server_lights.set_size(1)        

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

        self.status_buffer = piw.statusbuffer(self.output.cookie())
        self.status_buffer.autosend(False)
 
        self[2] = atom.Atom(domain=domain.String(), init='[]', names='physical light mapping', policy=atom.default_policy(self.__physical_light_map))
        self[3] = atom.Atom(domain=domain.String(), init='[]', names='musical light mapping', policy=atom.default_policy(self.__musical_light_map))
        self[5] = atom.Atom(domain=domain.BoundedIntOrNull(0,65535,0), names='server port', policy=atom.default_policy(self.__server_port))
        self[6] = atom.Atom(domain=domain.Bool(), init=False, names='server start', policy=atom.default_policy(self.__server_start))

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

        self[8] = StoredLightMaps(self)

        self.add_verb2(1,'clear([],None)', callback=self.__clear)
        self.add_verb2(2,'clear([],None,role(None,[matches([physical])]))', callback=self.__clear_physical)
        self.add_verb2(3,'clear([],None,role(None,[matches([musical])]))', callback=self.__clear_musical)
        self.add_verb2(4,'set([],None,role(None,[coord(physical,[column],[row])]),role(to,[abstract,matches([red])]))', callback=self.__set_physical)
        self.add_verb2(5,'set([],None,role(None,[coord(physical,[column],[row])]),role(to,[abstract,matches([green])]))', callback=self.__set_physical)
        self.add_verb2(6,'set([],None,role(None,[coord(physical,[column],[row])]),role(to,[abstract,matches([orange])]))', callback=self.__set_physical)
        self.add_verb2(7,'set([],None,role(None,[coord(musical,[course],[key])]),role(to,[abstract,matches([red])]))', callback=self.__set_musical)
        self.add_verb2(8,'set([],None,role(None,[coord(musical,[course],[key])]),role(to,[abstract,matches([green])]))', callback=self.__set_musical)
        self.add_verb2(9,'set([],None,role(None,[coord(musical,[course],[key])]),role(to,[abstract,matches([orange])]))', callback=self.__set_musical)
        self.add_verb2(10,'set([un],None,role(None,[coord(physical,[column],[row])]))', callback=self.__unset_physical)
        self.add_verb2(11,'set([un],None,role(None,[coord(musical,[course],[key])]))', callback=self.__unset_musical)
        self.add_verb2(12,'choose([],None,role(None,[matches([physical])]),role(as,[abstract,matches([red])]))',self.__choose_physical)
        self.add_verb2(13,'choose([],None,role(None,[matches([physical])]),role(as,[abstract,matches([green])]))',self.__choose_physical)
        self.add_verb2(14,'choose([],None,role(None,[matches([physical])]),role(as,[abstract,matches([orange])]))',self.__choose_physical)
        self.add_verb2(15,'choose([],None,role(None,[matches([musical])]),role(as,[abstract,matches([red])]))',self.__choose_musical)
        self.add_verb2(16,'choose([],None,role(None,[matches([musical])]),role(as,[abstract,matches([green])]))',self.__choose_musical)
        self.add_verb2(17,'choose([],None,role(None,[matches([musical])]),role(as,[abstract,matches([orange])]))',self.__choose_musical)
        self.add_verb2(18,'choose([un],None)',self.__unchoose)
        self.add_verb2(19,'start([],None,role(None,[matches([server])]))',self.__start_server,status_action=self.__status_server)
        self.add_verb2(20,'stop([],None,role(None,[matches([server])]))',self.__stop_server,status_action=self.__status_server)
        self.add_verb2(21,'start([toggle],None,role(None,[matches([server])]))',self.__toggle_server,status_action=self.__status_server)
        self.add_verb2(22,'load([],None,role(None,[concrete,singular,partof(~(a)#8)]))', self.__load_lightmap)
        self.add_verb2(23,'delete([],None,role(None,[concrete,singular,partof(~(a)#8)]))', self.__delete_lightmap)
        self.add_verb2(24,'save([],None,role(None,[abstract]))', self.__save_lightmap)
        self.add_verb2(25,'save([],None)', self.__save_lightmap)

        self.httpServer = None

        self.__update_server_status()
Beispiel #4
0
    def __init__(self, address, ordinal):
        self.domain = piw.clockdomain_ctl()
        agent.Agent.__init__(self, signature=version,names='drummer',icon='plg_loop/bass_drum_64.png',container=(4,'drummer',atom.VerbContainer(clock_domain=self.domain)),protocols='browse',ordinal=ordinal)

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

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

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

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

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

        self[3] = LoopBrowser(self)

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

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

        self[6]=bundles.Output(1,False,names='status output')
        self.light_output=bundles.Splitter(self.domain,self[6])
        self.lights=piw.lightsource(piw.change_nb(),0,self.light_output.cookie())
        self[5] = VoiceList(self)
        self[5].populate([1])
        self.__first(None)
Beispiel #5
0
    def __init__(self, manager, index, name="", value=""):
        self.__manager = manager
        self.__index = index
        self.name = ""
        self.value = ""
        bundles.Output.__init__(self, 1, False)
        self.__output = bundles.Splitter(self.__manager.agent.domain, self)
        self.__lights = piw.lightsource(piw.change_nb(), 0,
                                        self.__output.cookie())
        self.__private = node.Server(change=self.__change)
        self.set_private(self.__private)
        self.__alternatives = []

        if name:
            self.set_name(name)
            self.set_value(value)
Beispiel #6
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(names='outputs')
        self[1][1] = bundles.Output(1,False, names='controller output', continuous=True)
        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.output = bundles.Splitter(self.domain,self[1][2],self[1][3],self[1][4],self[1][5])
        self.coutput = bundles.Splitter(self.domain,self[1][1])

        # 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.ctl_input = bundles.VectorInput(self.cclone.cookie(),self.domain,signals=(1,))
        self.data_input = bundles.VectorInput(self.stringer.data_cookie(),self.domain,signals=(2,3,4,5))

        self[4]=atom.Atom(names='inputs')
        self[4][1]=atom.Atom(domain=domain.Aniso(),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.merge_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.data_input.vector_policy(5,False), names='key 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)
Beispiel #7
0
 def __init__(self, e, d, **kw):
     self.__enable = e
     atom.Atom.__init__(self,
                        domain=domain.Bool(),
                        protocols='set',
                        policy=atom.default_policy(self.__change),
                        **kw)
     self.add_verb2(1, 'set([],~a,role(None,[instance(~self)]))',
                    self.__verb_set)
     self.add_verb2(2, 'set([un],~a,role(None,[instance(~self)]))',
                    self.__verb_unset)
     self.add_verb2(3,
                    'set([toggle],~a,role(None,[instance(~self)]))',
                    callback=self.__verb_togset,
                    status_action=self.__status)
     self[1] = bundles.Output(1, False, names='status output')
     self.light_output = bundles.Splitter(d, self[1])
     self.lights = piw.lightsource(piw.change_nb(), 0,
                                   self.light_output.cookie())
     self.lights.set_size(1)
     self.__set_status(self.get_value())
     self.__state = False
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self, signature=version, names='tabulator', ordinal=ordinal)
        
        self.domain = piw.clockdomain_ctl()

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

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

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

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

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

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

        self.__courselen = None
        self.__coursesqueue = None
        self.__coursesrender = None
        self.__lasttime = None
        
        self.__update_status()
Beispiel #9
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)
Beispiel #10
0
def make_change_nb(c):
    if c is None:
        return piw.change_nb()
    if not isinstance(c,piw.change_nb):
        c = piw.make_change_nb(c)
    return c
Beispiel #11
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='audio unit',
                             container=100,
                             ordinal=ordinal)

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

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

        # plugin browser
        self[1] = self.__browser

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

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

        # parameter mapping
        self[4] = self.parameter_list

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

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

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

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

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

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

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

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

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

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

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

        self.__ctl = []

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

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

        self.set_ordinal(ordinal)
Beispiel #12
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='tabulator',
                             ordinal=ordinal)

        self.domain = piw.clockdomain_ctl()

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

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

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

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

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

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

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

        self.__update_status()