def __init__(self, physic_world, config=None): logging.info("INIT PLAYER...") logging.info("INIT FSM...") FSM.__init__(self, "FSM-Player") logging.info("INIT CONFIG...") Config.__init__(self) # additional initial configuration settings set by the outher application self.physic_world = physic_world logging.info("INIT PHYSICS...") Physics.__init__(self) logging.info("INIT CONTROLS...") Control.__init__(self) logging.info("INIT CAMERA...") Camera.__init__(self, self.cam_near_clip, self.cam_far_clip, self.cam_fov) logging.info("INIT ANIMATOR...") Animator.__init__(self) logging.info("INIT PLAYER DONE") # # STATES SETUP # self.on_ground_states = [ self.STATE_IDLE, self.STATE_IDLE_TO_WALK, self.STATE_WALK, self.STATE_WALK_TO_IDLE, self.STATE_PLANT ] # set the possible transition in the FSM self.defaultTransitions = { self.STATE_IDLE: [self.STATE_IDLE_TO_WALK, self.STATE_PLANT], self.STATE_IDLE_TO_WALK: [self.STATE_IDLE, self.STATE_WALK], self.STATE_WALK: [self.STATE_IDLE, self.STATE_WALK_TO_IDLE], self.STATE_WALK_TO_IDLE: [self.STATE_IDLE, self.STATE_WALK], self.STATE_PLANT: [self.STATE_IDLE], } # # ACTOR SETUP # Actor.__init__( self, self.model, { self.IDLE: self.anim_idle, self.WALK: self.anim_walk, self.PLANT: self.anim_plant, }) self.setBlend(frameBlend=self.enable_interpolation) alphaSettings = ColorBlendAttrib.make(ColorBlendAttrib.MAdd, ColorBlendAttrib.OIncomingAlpha, ColorBlendAttrib.OOne, (0, 0, 0, 0)) #self.setAttrib(alphaSettings) self.setBin("fixed", 15) self.setDepthWrite(False) # # CONTROLS SETUP # self.isDown = base.mouseWatcherNode.isButtonDown self.mainNode = self
def __init__(self, c_instance, selected_track_controller): Control.__init__(self, c_instance, selected_track_controller) self._midi_recording_quantization_labels = ["None", "1/4", "1/8", "1/8T", "1/8 + 1/8T", "1/16", "1/16T", "1/16 + 1/16T", "1/32"] for key, max_steps in (("clip_trigger_quantizations", 13), ("midi_recording_quantizations", 8)): if not key in settings.midi_mapping: continue mappings = settings.midi_mapping[key] for i in range(min(max_steps, len(mappings))): if mappings[i]: self.setup_quantizations(key[:-1], i, mappings[i])
def __init__(self, c_instance, selected_track_controller): Control.__init__(self, c_instance, selected_track_controller) # arming on track-selection does not work from within the callback # see SessionControl for at least auto-arm when using STC to select track if settings.auto_arm: self.song.view.add_selected_track_listener(self.on_track_selected) # use helper-functions to set up callback via lambda-functions # a closure inside the lambda-functions is needed, so i is always the current i #if "reset_sends" in settings.midi_mapping: # for i in range(len(settings.midi_mapping["reset_sends"])): # self.setup_send_reset(i, settings.midi_mapping["reset_sends"][i]) if "sends" in settings.midi_mapping: for i in range(len(settings.midi_mapping["sends"])): self.setup_send_set(i, settings.midi_mapping["sends"][i])
def __init__(self, c_instance, selected_track_controller): Control.__init__(self, c_instance, selected_track_controller) self._device = None self._locked_to_device = False self.bank = 0 if "device_params" in settings.midi_mapping: self.params_per_bank = len(settings.midi_mapping["device_params"]) else: self.params_per_bank = 8 self.max_banks = int(math.ceil(128.0 / self.params_per_bank)) #if "reset_device_bank" in settings: # add listener to receive notifications, if track has changed # add listener to track if selected device has changed => reset bank? #if settings.auto_select_device: self.song.view.add_selected_track_listener(self.auto_select_device) if settings.device_bestof: # we have best-of parameters for devices => use these parameters first, then the rest for device_name, indizes in settings.device_bestof.items(): new_indizes = [ 0, ] + list(indizes) i = 0 while i < 128: if i not in indizes: new_indizes.append(i) i = i + 1 settings.device_bestof[device_name] = new_indizes if "device_params" in settings.midi_mapping: for i in range(len(settings.midi_mapping["device_params"])): # begin with parameter 1, as 0 is device-on/off self.setup_device_param_set( i + 1, settings.midi_mapping["device_params"][i]) if "reset_device_params" in settings.midi_mapping: for i in range(len(settings.midi_mapping["reset_device_params"])): # begin with parameter 1, as 0 is device-on/off self.setup_device_param_reset( i + 1, settings.midi_mapping["reset_device_params"][i])
def __init__(self, c_instance, selected_track_controller): Control.__init__(self, c_instance, selected_track_controller) self._device = None self._locked_to_device = False self.bank = 0 if "device_params" in settings.midi_mapping: self.params_per_bank = len(settings.midi_mapping["device_params"]) else: self.params_per_bank = 8 self.max_banks = int(math.ceil(128.0/self.params_per_bank)) #if "reset_device_bank" in settings: # add listener to receive notifications, if track has changed # add listener to track if selected device has changed => reset bank? #if settings.auto_select_device: self.song.view.add_selected_track_listener(self.auto_select_device) if settings.device_bestof: # we have best-of parameters for devices => use these parameters first, then the rest for device_name, indizes in settings.device_bestof.items(): new_indizes = [0,] + list(indizes) i = 0 while i < 128: if i not in indizes: new_indizes.append(i) i = i + 1 settings.device_bestof[device_name] = new_indizes if "device_params" in settings.midi_mapping: for i in range(len(settings.midi_mapping["device_params"])): # begin with parameter 1, as 0 is device-on/off self.setup_device_param_set(i+1, settings.midi_mapping["device_params"][i]) if "reset_device_params" in settings.midi_mapping: for i in range(len(settings.midi_mapping["reset_device_params"])): # begin with parameter 1, as 0 is device-on/off self.setup_device_param_reset(i+1, settings.midi_mapping["reset_device_params"][i])
def __init__(self, c_instance, selected_track_controller): Control.__init__(self, c_instance, selected_track_controller) # steps, when ABSOLUTE mode for tempo CC is used self.tempo_step = (settings.tempo_max - settings.tempo_min)/127.0
def __init__(self, c_instance, selected_track_controller): Control.__init__(self, c_instance, selected_track_controller) self.view = Live.Application.get_application().view self.views = self.view.available_main_views()
def __init__(self, physic_world, config=None): logging.info("INIT PLAYER...") logging.info("INIT FSM...") FSM.__init__(self, "FSM-Player") logging.info("INIT CONFIG...") Config.__init__(self) # additional initial configuration settings set by the outher application self.physic_world = physic_world logging.info("INIT PHYSICS...") Physics.__init__(self) logging.info("INIT CONTROLS...") Control.__init__(self) logging.info("INIT CAMERA...") Camera.__init__( self, self.cam_near_clip, self.cam_far_clip, self.cam_fov) logging.info("INIT ANIMATOR...") Animator.__init__(self) logging.info("INIT PLAYER DONE") # # STATES SETUP # self.on_ground_states = [ self.STATE_IDLE, self.STATE_IDLE_TO_WALK, self.STATE_WALK, self.STATE_WALK_TO_IDLE, self.STATE_PLANT] # set the possible transition in the FSM self.defaultTransitions = { self.STATE_IDLE: [self.STATE_IDLE_TO_WALK, self.STATE_PLANT], self.STATE_IDLE_TO_WALK: [self.STATE_IDLE, self.STATE_WALK], self.STATE_WALK: [self.STATE_IDLE, self.STATE_WALK_TO_IDLE], self.STATE_WALK_TO_IDLE: [self.STATE_IDLE, self.STATE_WALK], self.STATE_PLANT: [self.STATE_IDLE], } # # ACTOR SETUP # Actor.__init__( self, self.model, { self.IDLE: self.anim_idle, self.WALK: self.anim_walk, self.PLANT: self.anim_plant, }) self.setBlend(frameBlend=self.enable_interpolation) alphaSettings = ColorBlendAttrib.make( ColorBlendAttrib.MAdd, ColorBlendAttrib.OIncomingAlpha, ColorBlendAttrib.OOne, (0, 0, 0, 0)) #self.setAttrib(alphaSettings) self.setBin("fixed", 15) self.setDepthWrite(False) # # CONTROLS SETUP # self.isDown = base.mouseWatcherNode.isButtonDown self.mainNode = self
def __init__(self, c_instance, selected_track_controller): Control.__init__(self, c_instance, selected_track_controller) if settings.auto_select_playing_clip: self.song.view.add_selected_track_listener(self.on_track_selected)
def __init__(self, c_instance, selected_track_controller): Control.__init__(self, c_instance, selected_track_controller) self.show_message('Global controls initialized') self.track_buffer = 0 self.scene_buffer = 0 self.song.view.add_selected_track_listener(self.on_track_selected)