def possible_conversions(track, decorator_factory=None):
    conversions = []
    if liveobj_valid(track):
        if is_midi_track(track) and len(track.devices) > 0:
            drum_rack = find_drum_rack_instrument(track)
            if liveobj_valid(drum_rack):
                drum_pad = drum_rack.view.selected_drum_pad
                if liveobj_valid(drum_pad) and len(
                        drum_pad.chains) == 1 and find_instrument_devices(
                            drum_pad.chains[0]):
                    conversions.append(
                        DrumPadToMidiTrack(drum_pad=drum_pad, track=track))
            else:
                simpler = find_simpler(track)
                if simpler != None and simpler.playback_mode == Live.SimplerDevice.PlaybackMode.slicing:
                    conversions.append(
                        SlicesToDrumRack(device=simpler, track=track))
                else:
                    conversions.append(
                        MoveDeviceChain(device=simpler,
                                        track=track,
                                        decorator_factory=decorator_factory))
        elif is_audio_track(track):
            highlighted_clip_slot = track.canonical_parent.view.highlighted_clip_slot
            clip = find_if(
                lambda slot: slot.has_clip and highlighted_clip_slot == slot,
                track.clip_slots)
            if liveobj_valid(clip) and not clip.is_recording:
                conversions.append(
                    CreateTrackWithSimpler(clip_slot=highlighted_clip_slot,
                                           track=track))
    return conversions
Esempio n. 2
0
 def selected_mixer_track(self, track_or_chain):
     unwrapped_track = getattr(track_or_chain, 'proxied_object', track_or_chain)
     if liveobj_changed(self._selected_mixer_track, unwrapped_track):
         if isinstance(unwrapped_track, Live.Chain.Chain):
             self._view.selected_chain = unwrapped_track
             instruments = list(find_instrument_devices(self._view.selected_track))
             if instruments:
                 instruments[0].view.selected_chain = unwrapped_track
         else:
             self._view.selected_track = unwrapped_track
Esempio n. 3
0
def get_flattened_track(track):
    """
    Returns a flat list of a track with its instrument chains (when visible), or just the
    original track
    """
    flat_track = [track]
    if track.can_show_chains and track.is_showing_chains:
        instruments = list(find_instrument_devices(track))
        flat_track.extend([ c for c in instruments[0].chains ])
    return flat_track
    def _update_listeners(self):

        def flattened_list_of_instruments(instruments):
            return list(flatten(instruments))

        tracks = self.song.tracks
        self._on_devices_changed.replace_subjects(tracks)
        chain_listenable_tracks = [ track for track in tracks if isinstance(track, Live.Track.Track) and track ]
        instruments = flattened_list_of_instruments([ find_instrument_devices(track) for track in chain_listenable_tracks if track ])
        self._on_is_showing_chains_changed.replace_subjects(chain_listenable_tracks)
        self._on_chains_changed.replace_subjects(instruments)
        self._on_instrument_return_chains_changed.replace_subjects(instruments)
Esempio n. 5
0
def possible_conversions(track, decorator_factory=None):
    category = NullConvertCategory()
    if liveobj_valid(track):
        if is_midi_track(track) and len(track.devices) > 0:
            drum_rack = find_drum_rack_instrument(track)
            if liveobj_valid(drum_rack):
                drum_pad = drum_rack.view.selected_drum_pad
                if liveobj_valid(drum_pad) and len(
                        drum_pad.chains) == 1 and find_instrument_devices(
                            drum_pad.chains[0]):
                    category = MidiTrackWithDrumRack(
                        actions=[DrumPadToMidiTrack()],
                        drum_pad=drum_pad,
                        track=track)
            else:
                simpler = find_simpler(track)
                if simpler != None and simpler.playback_mode == Live.SimplerDevice.PlaybackMode.slicing:
                    category = MidiTrackWithSimpler(
                        actions=[SlicesToDrumRack()],
                        device=simpler,
                        track=track)
                else:
                    category = MidiTrackWithoutSimpler(
                        actions=[MoveDeviceChain()],
                        device=simpler,
                        track=track,
                        decorator_factory=decorator_factory)
        elif is_audio_track(track):
            detail_clip = track.canonical_parent.view.detail_clip
            if liveobj_valid(detail_clip) and detail_clip.is_arrangement_clip:
                if not detail_clip.is_recording:
                    category = AudioTrackWithArrangementClip(
                        actions=[
                            CreateTrackWithSimpler(),
                            CreateTrackWithClipInDrumRackPad()
                        ],
                        song_view=track.canonical_parent.view,
                        track=track)
            else:
                highlighted_clip_slot = track.canonical_parent.view.highlighted_clip_slot
                clip = find_if(
                    lambda slot: slot.has_clip and highlighted_clip_slot ==
                    slot, track.clip_slots)
                if liveobj_valid(clip) and not clip.is_recording:
                    category = AudioTrackWithSessionClip(
                        actions=[
                            CreateTrackWithSimpler(),
                            CreateTrackWithClipInDrumRackPad()
                        ],
                        clip_slot=highlighted_clip_slot,
                        track=track)
    return category
Esempio n. 6
0
    def _update_listeners(self):

        def flattened_list_of_instruments(instruments):
            return list(flatten(instruments))

        tracks = self.song.tracks
        self._on_devices_changed.replace_subjects(tracks)
        chain_listenable_tracks = [ track for track in tracks if isinstance(track, Live.Track.Track) and track ]
        instruments = flattened_list_of_instruments([ find_instrument_devices(track) for track in chain_listenable_tracks if track ])
        instruments_with_chains = filter(lambda i: i.can_have_chains, instruments)
        self._on_is_showing_chains_changed.replace_subjects(chain_listenable_tracks)
        self._on_chains_changed.replace_subjects(instruments_with_chains)
        self._on_instrument_return_chains_changed.replace_subjects(instruments_with_chains)
Esempio n. 7
0
def possible_conversions(track, decorator_factory = None):
    conversions = []
    if liveobj_valid(track):
        if is_midi_track(track) and len(track.devices) > 0:
            drum_rack = find_drum_rack_instrument(track)
            if liveobj_valid(drum_rack):
                drum_pad = drum_rack.view.selected_drum_pad
                if liveobj_valid(drum_pad) and len(drum_pad.chains) == 1 and find_instrument_devices(drum_pad.chains[0]):
                    conversions.append(DrumPadToMidiTrack(drum_pad=drum_pad, track=track))
            else:
                simpler = find_simpler(track)
                if simpler != None and simpler.playback_mode == Live.SimplerDevice.PlaybackMode.slicing:
                    conversions.append(SlicesToDrumRack(device=simpler, track=track))
                else:
                    conversions.append(MoveDeviceChain(device=simpler, track=track, decorator_factory=decorator_factory))
        elif is_audio_track(track):
            highlighted_clip_slot = track.canonical_parent.view.highlighted_clip_slot
            clip = find_if(lambda slot: slot.has_clip and highlighted_clip_slot == slot, track.clip_slots)
            if liveobj_valid(clip) and not clip.is_recording:
                conversions.append(CreateTrackWithSimpler(clip_slot=highlighted_clip_slot, track=track))
    return conversions
def find_simplers(chain):
    return ifilter(lambda i: hasattr(i, "playback_mode"), find_instrument_devices(chain))
Esempio n. 9
0
def find_simplers(chain):
    return ifilter(lambda i: hasattr(i, 'playback_mode'),
                   find_instrument_devices(chain))