示例#1
0
 def _update_stop_scene_leds(self, index):
     scenes = self.song.scenes
     scene_index = index + self._session_ring.scene_offset
     if self.is_enabled(
     ) and self._stop_scene_clip_buttons is not None and index < len(
             self._stop_scene_clip_buttons):
         button = self._stop_scene_clip_buttons[index]
         if button is not None:
             value_to_send = None
             if scene_index < len(
                     scenes) and scenes[scene_index].clip_slots:
                 tracks = self._session_ring.tracks_to_use()
                 if find_if(
                         lambda x: x.playing_slot_index == scene_index and x
                         .fired_slot_index != -2, tracks):
                     value_to_send = self._stop_clip_value
                 elif find_if(
                         lambda x: x.fired_slot_index == -2 and x.
                         playing_slot_index == scene_index, tracks):
                     value_to_send = self._stop_clip_triggered_value
                 else:
                     value_to_send = u'Session.StoppedClip'
             if value_to_send is None:
                 button.turn_off()
             elif in_range(value_to_send, 0, 128):
                 button.send_value(value_to_send)
             else:
                 button.set_light(value_to_send)
示例#2
0
 def _on_stop_scene_value(self, value, button):
     if self.is_enabled():
         if value is not 0 or not button.is_momentary():
             scene_index = list(self._stop_scene_clip_buttons).index(
                 button) + self._session_ring.scene_offset
             for track in self._session_ring.tracks_to_use():
                 if in_range(scene_index, 0, len(track.clip_slots)) and (
                         track.playing_slot_index == scene_index
                         or track.fired_slot_index == scene_index):
                     track.stop_all_clips()
示例#3
0
 def randomize_device_parameters(self):
     if self.device() is None:
         return
     parameters = filter(lambda param:  param.is_enabled and param.state == 0, self.device().parameters[1:])
     for p in parameters:
         if not p.is_quantized:
             value = random.random()
             scaled_value = p.min + (value * (p.max - p.min))
             if in_range(scaled_value, p.min, p.max):
                 p.value = scaled_value
示例#4
0
 def _update_stop_clips_led(self, index):
     if self.is_enabled(
     ) and self._stop_track_clip_buttons is not None and index < len(
             self._stop_track_clip_buttons):
         button = self._stop_track_clip_buttons[index]
         if button is not None:
             tracks_to_use = self._session_ring.tracks_to_use()
             track_index = index + self._session_ring.track_offset
             value_to_send = None
             if track_index < len(tracks_to_use):
                 if tracks_to_use[track_index].clip_slots:
                     track = tracks_to_use[track_index]
                     if track.fired_slot_index == -2:
                         value_to_send = self._stop_clip_triggered_value
                     elif track.playing_slot_index >= 0:
                         value_to_send = self._stop_clip_value
                     else:
                         value_to_send = u'Session.StoppedClip'
             if value_to_send is None:
                 button.turn_off()
             elif in_range(value_to_send, 0, 128):
                 button.send_value(value_to_send)
             else:
                 button.set_light(value_to_send)
 def _on_select_button_pressed(self, button):
     index = list(self.select_buttons).index(button)
     if in_range(index, 0, 8):
         self._selected_rate_index = index
         self._update_select_buttons()
         self.notify_selected_rate_index(index)
 def selected_rate(self, new_rate_index):
     assert in_range(new_rate_index, 0, 8) or new_rate_index is None
     self._selected_rate_index = new_rate_index
     self._update_select_buttons()
示例#7
0
def determine_shaded_color_index(color_index, shade_level):
    raise in_range(color_index, 1, 27) or AssertionError
    raise shade_level in (1, 2) or AssertionError
    return (color_index - 1) * 2 + 64 + shade_level
示例#8
0
def determine_shaded_color_index(color_index, shade_level):
    raise in_range(color_index, 1, 27) or AssertionError
    raise shade_level in (1, 2) or AssertionError
    return (color_index - 1) * 2 + 64 + shade_level