def _set_device(self, device): super(DeviceComponentWithTrackColorViewData, self)._set_device(device) self.__on_device_active_changed.subject = device if liveobj_valid(device) else None parent_track = find_parent_track(self._decorated_device) self.__on_track_mute_changed.subject = parent_track self.__on_track_muted_via_solo_changed.subject = parent_track self.__on_track_or_chain_color_changed.subject = device.canonical_parent if liveobj_valid(device) else None
def _is_active_for_visualisation(self): device = self._decorated_device parent_track = find_parent_track(self._decorated_device) if liveobj_valid(device) and liveobj_valid(parent_track): if parent_track == self.song.master_track: return device.is_active return device.is_active and not parent_track.mute and not parent_track.muted_via_solo return False
def assign_parameters(controls, parameters): for control, parameter in izip_longest(controls, parameters): if control: if not liveobj_valid(parameter) or isinstance(parameter.canonical_parent, Live.MixerDevice.MixerDevice): control.mapped_parameter = parameter else: track = find_parent_track(parameter) control.mapped_parameter = parameter if liveobj_valid(track) and not track.is_frozen else None return
def mixable_button_color(mixer_track, song, selected_track=None): color = 'Mixer.NoTrack' if mixer_track: mixer_track_parent_track = find_parent_track(mixer_track.proxied_object) is_frozen_chain = mixer_track_parent_track.is_frozen and not isinstance(mixer_track.proxied_object, Live.Track.Track) if can_play_clips(mixer_track) and is_clip_stop_pending(mixer_track): color = track_color_with_pending_stop(mixer_track) elif mixer_track.solo: color = 'Mixer.SoloOn' elif mixer_track == selected_track and not mixer_track.mute: color = 'Mixer.TrackSelected' elif mixer_track.mute or mixer_track.muted_via_solo: color = 'Mixer.MutedTrack' elif is_frozen_chain: color = 'Mixer.FrozenChain' else: color = IndexedColor.from_live_index(mixer_track.color_index, DISPLAY_BUTTON_SHADE_LEVEL) return color
def get_track_color_index(): parent_track = find_parent_track(self._drum_group) if liveobj_valid(parent_track): return parent_track.color_index return -1