コード例 #1
0
 def _on_return_tracks_changed(self):
     num_sends = self.num_sends
     if self._send_index is not None:
         self.send_index = clamp(self._send_index, 0, num_sends - 1) if num_sends > 0 else None
     else:
         self.send_index = 0 if num_sends > 0 else None
     self.on_num_sends_changed()
コード例 #2
0
 def _on_return_tracks_changed(self):
     if self._send_index is not None:
         num_sends = self.num_sends
         self.send_index = clamp(self._send_index, 0, num_sends -
                                 1) if num_sends > 0 else None
     self.on_num_sends_changed()
     return
コード例 #3
0
 def _tempo_fine_value(self, value):
     if self.is_enabled():
         if self._fine_tempo_needs_pickup:
             if in_range(self._prior_fine_tempo_value, 0, 128):
                 range_max = max(value, self._prior_fine_tempo_value)
                 range_min = min(value, self._prior_fine_tempo_value)
                 if in_range(64, range_min, range_max + 1):
                     self._fine_tempo_needs_pickup = False
         else:
             raise in_range(self._prior_fine_tempo_value, 0, 128) or AssertionError
             difference = value - self._prior_fine_tempo_value
             ratio = 127.0 / TEMPO_FINE_RANGE
             new_tempo = clamp(self.song().tempo + difference / ratio, TEMPO_BOTTOM, TEMPO_TOP)
             self.song().tempo = new_tempo
     self._prior_fine_tempo_value = value
コード例 #4
0
 def _tempo_fine_value(self, value):
     if self.is_enabled():
         if self._fine_tempo_needs_pickup:
             if in_range(self._prior_fine_tempo_value, 0, 128):
                 range_max = max(value, self._prior_fine_tempo_value)
                 range_min = min(value, self._prior_fine_tempo_value)
                 if in_range(64, range_min, range_max + 1):
                     self._fine_tempo_needs_pickup = False
         else:
             raise in_range(self._prior_fine_tempo_value, 0, 128) or AssertionError
             difference = value - self._prior_fine_tempo_value
             ratio = 127.0 / TEMPO_FINE_RANGE
             new_tempo = clamp(self.song().tempo + difference / ratio, TEMPO_BOTTOM, TEMPO_TOP)
             self.song().tempo = new_tempo
     self._prior_fine_tempo_value = value
コード例 #5
0
 def affectEntity(self, entity):
     if isinstance(entity, Accelerator):
         return
     if isinstance(entity, CircleGuy):
         return
 
     dist = self.pos.distance(entity.pos)
     
     accChange = 0.0
     if dist > 0.0:
         accChange = clamp((1.0/dist) * self.accFactor, self.minAcc, self.maxAcc)
     
     # make a vector pointing towards the accelerator
     towardsAcc = self.pos - entity.pos
     towardsAcc.normalize(1.0)
     
     # add some amount of accerlation to entity towards the accelerator
     # at a rate inverse to distance
     entity.acc += towardsAcc * accChange
コード例 #6
0
 def _create_controls(self, count):
     self._checked_index = clamp(self._checked_index, 0, count - 1)
     super(RadioButtonGroup.State, self)._create_controls(count)
コード例 #7
0
 def _create_controls(self, count):
     self._checked_index = clamp(self._checked_index, 0, count - 1)
     super(RadioButtonGroup.State, self)._create_controls(count)