def __init__(self,agent): atom.Atom.__init__(self,names='voice',protocols='virtual browse bind') self.__agent = agent self.__timestamp = piw.tsd_time() self.__voices = [] self.update()
def __init__(self, eventlist): atom.Atom.__init__(self, names='event', protocols='virtual browse') self.__eventlist = eventlist self.__timestamp = piw.tsd_time() self.__selected = None self.update()
def __init__(self,eventlist,keylist): atom.Atom.__init__(self,names='phrase',protocols='virtual browse') self.__eventlist = eventlist self.__keylist = keylist self.__timestamp = piw.tsd_time() self.update()
def __init__(self,agent,voice): self.agent = agent self.voice = voice self.__timestamp = piw.tsd_time() atom.Atom.__init__(self,domain=domain.String(),names='voice',ordinal=voice,protocols='remove browse',policy=atom.default_policy(self.set_loop)) self.looper = loop_native.player(agent.aggregator.get_output(voice),agent.domain,utils.statusify(self.__loop_status)) agent.clock_cloner.set_output(voice,self.looper.cookie()) self.loop_off = self.looper.player(0) self.loop_on = self.looper.player(1) self.loop_toggle = self.looper.player(3) self.loop_once = self.looper.player(2) self.agent.lights.set_status(self.voice,const.status_inactive) self[1] = atom.Atom(domain=domain.BoundedFloat(0.0,100.0,0.0,hints=(T('stageinc',1),T('inc',1),T('biginc',10),T('control','updown')),verbinc=10.0),init=100.0,policy=atom.default_policy(self.set_volume),names='volume') self[2] = atom.Atom(domain=domain.BoundedFloat(0.0,100.0,0.0,hints=(T('stageinc',1),T('inc',1),T('biginc',10),T('control','updown')),verbinc=10.0),init=10.0,policy=atom.default_policy(self.set_chop),names='chop') self[3] = atom.Atom(domain=domain.Bool(),init=False,names='enable',policy=atom.default_policy(self.set_playing),protocols='set',container=(None,'voice%d'%voice,agent.verb_container())) self[3].add_verb2(1,'set([],~a,role(None,[instance(~self)]))', create_action=self.__enable_set, status_action=self.__enable_status) self[3].add_verb2(2,'set([un],~a,role(None,[instance(~self)]))', create_action=self.__enable_unset, status_action=self.__enable_status) self[3].add_verb2(3,'set([toggle],~a,role(None,[instance(~self)]))', create_action=self.__enable_toggle, status_action=self.__enable_status) self.looper.set_chop(10.0) self.looper.set_volume(1.0) piw.changelist_connect(agent.loop_on,self.loop_on) piw.changelist_connect(agent.loop_off,self.loop_off) piw.changelist_connect(agent.loop_toggle,self.loop_toggle) self.first()
def __init__(self,agent): self.agent=agent atom.Atom.__init__(self,domain=domain.String(),names='audio port',protocols='virtual browse',policy=atom.default_policy(self.__change_device),init='') self.__mapping = [] # (uid,name) self.__timestamp = piw.tsd_time() self.__selected=None self.__update()
def __update(self, k, v): t = piw.tsd_time() v = piw.makestring(v, t) self.__callback.update_timestamp(t) if k is None: self.set_data(v) else: self[k].set_data(v)
def __init__(self,agent): self.agent = agent atom.Atom.__init__(self,names='loop',protocols='virtual browse') self.__timestamp = piw.tsd_time() self.__selected=None self.update()
def __init__(self,agent): self.__scan() self.agent = agent atom.Atom.__init__(self,names='sample',protocols='virtual browse',domain=domain.String(),policy=atom.load_policy(self.__loadcurrent)) self.__timestamp = piw.tsd_time() self.__selected=None self.__update()
def __init__(self,names,ordinal,dom,remove,keys): self.kbd_keys = keys agent.Agent.__init__(self,names=names,ordinal=ordinal,signature=version,subsystem='kbd',volatile=True,container=102,protocols='browse is_subsys') self.remover=remove self.domain = piw.clockdomain_ctl() self.domain.set_source(piw.makestring('*',0)) self[1] = bundles.Output(1,False,names='activation output') self[2] = bundles.Output(2,False,names='pressure output') self[3] = bundles.Output(3,False,names='roll output') self[4] = bundles.Output(4,False,names='yaw output') self[5] = bundles.Output(1,False,names='strip position output',ordinal=1) self[7] = bundles.Output(1,False,names='breath output') self[10] = bundles.Output(2,False,names='absolute strip output',ordinal=1) self[12] = bundles.Output(1,False,names='pedal output',ordinal=1) self[13] = bundles.Output(1,False,names='pedal output',ordinal=2) self[14] = bundles.Output(1,False,names='pedal output',ordinal=3) self[15] = bundles.Output(1,False,names='pedal output',ordinal=4) self.led_backend = piw.functor_backend(1,True) self.status_mixer = piw.statusmixer(self.led_backend.cookie()) self.led_input = bundles.VectorInput(self.status_mixer.cookie(),self.domain,signals=(1,)) self[8] = atom.Atom(names='light input',protocols='revconnect',policy=self.led_input.vector_policy(1,False,False,auto_slot=True),domain=domain.Aniso()) self[100] = VirtualKey(self.kbd_keys) self.koutput = bundles.Splitter(self.domain,self[1],self[2],self[3],self[4]) self.kpoly = piw.polyctl(10,self.koutput.cookie(),False,5) self.s1output = bundles.Splitter(self.domain,self[5],self[10]) self.boutput = bundles.Splitter(self.domain,self[7]) self.poutput1 = bundles.Splitter(self.domain,self[12]) self.poutput2 = bundles.Splitter(self.domain,self[13]) self.poutput3 = bundles.Splitter(self.domain,self[14]) self.poutput4 = bundles.Splitter(self.domain,self[15]) self.kclone=piw.sclone() self.kclone.set_filtered_output(1,self.kpoly.cookie(),piw.first_filter(1)) self.kclone.set_filtered_output(2,self.s1output.cookie(),piw.first_filter(2)) self.kclone.set_filtered_output(5,self.boutput.cookie(),piw.first_filter(5)) self.kclone.set_filtered_output(6,self.poutput1.cookie(),piw.first_filter(6)) self.kclone.set_filtered_output(7,self.poutput2.cookie(),piw.first_filter(7)) self.kclone.set_filtered_output(8,self.poutput3.cookie(),piw.first_filter(8)) self.kclone.set_filtered_output(9,self.poutput4.cookie(),piw.first_filter(9)) self[9] = atom.Atom(names='controller output',domain=domain.Aniso(),init=self.courses()) self.add_verb2(4,'maximise([],None,role(None,[mass([pedal])]))',self.__maximise) self.add_verb2(5,'minimise([],none,role(None,[mass([pedal])]))',self.__minimise) self.__timestamp = piw.tsd_time() self.update()
def __init__(self, key_cookie,cc_cookie,pc_cookie,trig_cookie,midi_cookie): self.__timestamp = piw.tsd_time() self.__midi = MidiDelegate(key_cookie,cc_cookie,pc_cookie,trig_cookie,midi_cookie,self.__sinks_changed) atom.Atom.__init__(self,domain=domain.String(),names='midi port',policy=atom.default_policy(self.set_port),protocols='virtual browse') self.__midi.set_port(0) self.__midi.set_destination('') self.__selected=None self.__update() self.__index = 1
def __init__(self,agent): self.__agent = agent self.__curvoice = None self.__timestamp = piw.tsd_time() atom.Atom.__init__(self,names='voice',protocols='browse',creator=self.__create_voice,wrecker=self.__wreck_voice) self.__selected=None self.set_private(node.Server()) self.update()
def __init__(self, agent): self.__agent = agent self.__timestamp = piw.tsd_time() collection.Collection.__init__(self, names="key press inputs", creator=self.__create_keypress, wrecker=self.__wreck_keypress, inst_creator=self.__create_inst, inst_wrecker=self.__wreck_inst) self.update()
def __init__(self, agent, names): self.agent = agent self.__timestamp = piw.tsd_time() collection.Collection.__init__(self, names=names, creator=self.__create_channel, wrecker=self.__wreck_channel, inst_creator=self.__create_inst, inst_wrecker=self.__wreck_inst) self.update()
def __init__(self, agent): self.__agent = agent self.__timestamp = piw.tsd_time() collection.Collection.__init__(self, names='effect channels', creator=self.__create_fxchannel, wrecker=self.__wreck_fxchannel, inst_creator=self.__create_inst, inst_wrecker=self.__wreck_inst) self.update()
def edit_file(self,orig,path,desc=''): if orig!=path: os.rename(orig,path) database = state.open_database(path,True) trunk = database.get_trunk() upgrade.set_description(trunk,desc) trunk.save(piw.tsd_time(),'') database.flush() self.setups_changed(path)
def __init__(self, agent): self.__agent = agent self.__timestamp = piw.tsd_time() collection.Collection.__init__(self, names='connector', creator=self.__create_connector, wrecker=self.__wreck_connector, inst_creator=self.__create_inst, inst_wrecker=self.__wreck_inst) self.update()
def __init__(self,agent): global global_plugin_list if global_plugin_list is None: global_plugin_list = PluginList() self.__plugin_list = global_plugin_list atom.Atom.__init__(self,names='plugin',protocols='virtual browse') self.__agent = agent self.__timestamp = piw.tsd_time() self.__update()
def __init__(self,agent): print 'Icon: user',self.userdir,'rel',self.reldir self.__scan() self.agent=agent atom.Atom.__init__(self,names='icon',protocols='virtual browse',domain=domain.String()) self.__selection='' self.__timestamp = piw.tsd_time() self.__update()
def __fastinvoke(self, server, args): f = server.create_action(None, *args) if f is None: return async .failure() ff = piw.fastchange(utils.changify_nb(f[0])) t = piw.tsd_time() ff(piw.makefloat_bounded(1, 0, 0, 1, t)) ff(piw.makefloat_bounded(1, 0, 0, 0, t + 1)) ret = (action.nosync_return(), ) return async .success(action.marshal(ret))
def __init__(self, activate): atom.Atom.__init__(self, names='scale', protocols='virtual browse') self.values = list(self.init_values) self.descriptions = {} self.__selected = None self.__selected_name = None self.__activated_scale = None self.__activated_name = None self.__activated_idx = None self.__activate = activate self.__timestamp = piw.tsd_time() self.update() self.__usercounter = 1
def __init__(self, master_agent, runner): self.master_agent = master_agent atom.Atom.__init__(self, names='script', protocols='browse') self.__factorydir = os.path.join(picross.release_resource_dir(), 'Scripts') self.__userdir = resource.user_resource_dir('Scripts', '') self.__timestamp = piw.tsd_time() self.__selected = None self.__armed = None self.__status = None self.__runner = runner self.update() self.__build_cache()
def __init__(self, activate): atom.Atom.__init__(self, names='scale', protocols='virtual browse') self.descriptions = {} self.__user = resource.user_resource_file('Scale Manager', 'User Scales.txt', version='') self.__mtime = None self.__selected = None self.__selected_name = None self.__activated_scale = None self.__activated_name = None self.__activated_idx = None self.__activate = activate self.__timestamp = piw.tsd_time() self.__usercounter = 1 self.values = list(self.init_values) self.update_scales() self.update_timestamp()
def edit_setup(self, orig, slot, tag, desc): self.savcond.acquire() try: if self.quitting: return else: self.saving = True finally: self.savcond.release() path = agentd.user_setup_file(slot, tag) if orig != path: orig_d = os.path.dirname(orig) orig_f = os.path.basename(orig) path_d = os.path.dirname(path) path_f = os.path.basename(path) for f in resource.os_listdir(orig_d): if f.startswith(orig_f): f2 = os.path.join(path_d, path_f + f[len(orig_f):]) resource.os_rename(os.path.join(orig_d, f), f2) database = state.open_database(path, True) trunk = database.get_trunk() upgrade.set_description(trunk, desc) trunk.save(piw.tsd_time(), '') database.flush() self.setups_changed(path) self.savcond.acquire() try: self.saving = False self.savcond.notify() finally: self.savcond.release() print 'editing complete', path self.info_dialog( 'Setup Edited', 'Setup Edited', "The user setup '" + slot + "' was successfully edited") return path
def plumb(self): if monitor_debug: print '- Monitor: plumb - unplumbing first...' self.unplumb() if monitor_debug: print '- Monitor: plumbing...' if self.is_fast(): if monitor_debug: print '- Monitor: plumbed fast' self.set_sink(self.__recv) self.__fast = True else: if monitor_debug: print '- Monitor: not plumbed fast' self.__aux = piw.fastdata(const.fastdata_sender) piw.tsd_fastdata(self.__aux) self.__recv.set_upstream(self.__aux) self.__auxq = piw.tsd_dataqueue(16) self.__aux.send_slow(piw.pathnull(piw.tsd_time()), self.__auxq) self.set_change_handler(self.__auxq.sender_slow()) data = self.get_data() if not data.is_null(): if monitor_debug: print 'target=', self.target_id, 'data="', self.get_data( ), '" ready=', self.is_ready(), 'type=', type(data) self.__auxq.sender_slow()(data) self.__fast = False # called when a connection can successfully be made if self.__widget.send_channel is not None: if monitor_debug: print '- Monitor: set_connected true', self.__widget.send_channel self.__osc.set_connected(self.__widget.send_channel, True) else: if monitor_debug: print '- Monitor: **** not set_connected ****' # try sending change in status osc_path = self.__widget.get_property_string('target-name') if osc_path != '': if monitor_debug: print '- Monitor: sent osc connected 1' self.__osc.send(osc_path + '/connected', 1)
def __init__(self, languageAgent): # the tab atoms stored in the interpreter self.__languageAgent = languageAgent self.__tabs = languageAgent.tabs self.__database = languageAgent.database self.__widgetManager = languageAgent.widgets self.setupName = 'setup' # dict for agent xml self.agents = {} # dict for atoms enabled for use in Stage self.enabledAtoms = {} # session ID is the current timestamp self.__sessionID = str(piw.tsd_time()) # last time the agents where updated self.__last_agent_update_time = 0 self.__last_agentIDs = frozenset()
def __init__(self, clk_domain): self.__timestamp = piw.tsd_time() # output MIDI port self.__midi_port = OutputMidiDelegate(self.__update) self.__midi_functor = self.__midi_port.get_midi_output_functor() # merge MIDI channels to output self.__midi_merge = midi_native.midi_merge_output( self.__midi_functor, clk_domain) atom.Atom.__init__(self, domain=domain.String(), names='midi port', policy=atom.default_policy(self.set_port), protocols='virtual browse') self.__midi_port.set_port(0) self.__midi_port.set_source('') self.__selected = None self.__index = 1 self.__update()
def __init__(self, callback): self.__callback = callback self.__user_file_name = resource.user_resource_file( 'Fingerer', 'User Fingerings.txt', version='') self.__factory_file_name = os.path.join(os.path.dirname(__file__), 'Factory Fingerings.txt') self.__user_seed_file = resource.find_release_resource( 'fingerer', 'User Fingerings.txt') self.__timestamp = piw.tsd_time() self.__timer = piw.thing() self.__timer.set_slow_timer_handler(utils.notify( self.__timer_callback)) if not resource.os_path_exists( self.__user_file_name) and resource.os_path_exists( self.__user_seed_file): resource.shutil_copyfile(self.__user_seed_file, self.__user_file_name) self.__user_file_time = 0 self.__factory_fingerings = {} self.__user_fingerings = {} self.__load_factory() self.__load_user() fn = set(self.__factory_fingerings.keys()) fn.update(set(self.__user_fingerings.keys())) atom.Atom.__init__(self, names='fingering', domain=domain.String(), init='simple whistle', policy=atom.default_policy(self.__change_fingering), protocols='browse')
def event_triggered(self,v): self.get_internal(250).get_policy().set_status(piw.makelong(0,0)) self.set_status(piw.makelong(self.agent.light_convertor.get_status(self.index),piw.tsd_time()))
def __init__(self,agent): self.__agent = agent self.__timestamp = piw.tsd_time() collection.Collection.__init__(self,names="key press inputs",creator=self.__create_keypress,wrecker=self.__wreck_keypress,inst_creator=self.__create_inst,inst_wrecker=self.__wreck_inst) self.update()
def setlist(self,name,l): self.__controller_dict[name] = piw.makestring(repr(l),piw.tsd_time()) self.__setup() self.__state.set_data(utils.makedict(self.__controller_dict,0))
def __setup(self): d = utils.makedict(self.__controller_dict,piw.tsd_time()) self.__filter.set_functor(piw.dict_merger(d))