def special_parameter_banks(device, device_dict = DEVICE_DICT): """ Determine the parameters to use for a device """ if device != None: if device.class_name in device_dict.keys(): def names_to_params(bank): return map(partial(get_parameter_by_name, device), bank) return group([i for i in flatten(map(names_to_params, device_dict[device.class_name]))], 32) else: if device.class_name in MAX_DEVICES: try: banks = device.get_bank_count() except: banks = 0 if banks != 0: def _bank_parameters(bank_index): try: parameter_indices = device.get_bank_parameters(bank_index) except: parameter_indices = [] if len(parameter_indices) != 32: return [ None for i in range(0, 32) ] else: return [ (device.parameters[i] if i != -1 else None) for i in parameter_indices ] return map(_bank_parameters, range(0, banks)) return group(device_parameters_to_map(device), 32) return []
def _update_parameter_values(self): for source in flatten(list(zip(self._track_parameter_data_sources, self._track_parameter_graphic_sources))): source.set_display_string(u' ') self._on_volume_value_changed() self._on_panning_value_changed() if self._track and self._track != self.song.master_track: list(map(self._on_sends_value_changed, self._track.mixer_device.sends))
def _update_parameter_values(self): for source in flatten(zip(self._track_parameter_data_sources, self._track_parameter_graphic_sources)): source.set_display_string(' ') self._on_volume_value_changed() self._on_panning_value_changed() if self._track and self._track != self.song.master_track: map(self._on_sends_value_changed, self._track.mixer_device.sends)
def _get_children_from_model(self): def expand_device(d): drum_pad = d.view.selected_drum_pad if d.can_have_drum_pads else None if drum_pad: drum_pad_name = drum_pad.name if len(drum_pad.chains) > 0 else 'EmptyPad' return [(d.name, d), (drum_pad_name, drum_pad)] else: return [(d.name, d)] return list(flatten(imap(expand_device, self._object.devices)))
def _get_children_from_model(self): def expand_device(d): is_rack_with_bank_2 = getattr(d, u'can_have_chains', False) and any(d.macros_mapped[8:]) name_prefix = u'\xb0' if is_rack_with_bank_2 else u'' result = [(name_prefix + d.name, d)] if is_rack_with_bank_2: result.append((u'\xb0\xb0' + d.name, ChainNode.RackBank2Device(rack_device=d))) drum_pad = d.view.selected_drum_pad if d.can_have_drum_pads else None if drum_pad: drum_pad_name = drum_pad.name if len( drum_pad.chains) > 0 else u'EmptyPad' result.append((drum_pad_name, drum_pad)) return result return list(flatten(map(expand_device, self._object.devices)))
def _build_inner_message(self, message): message = super(SpecialPhysicalDisplay, self)._build_inner_message(message) return flatten([ g[:-1] for g in group(message, DISPLAY_BLOCK_LENGTH) ])
def flattened_list_of_instruments(instruments): return list(flatten(instruments))
def find_all_simplers_on_pad(drum_pad): simplers = [] for chain in drum_pad.chains: simplers.append(find_simplers(chain)) return list(flatten(simplers))
def _build_inner_message(self, message): message = super(SpecialPhysicalDisplay, self)._build_inner_message(message) return flatten([g[:-1] for g in group(message, DISPLAY_BLOCK_LENGTH)])