def _on_value(self, value): self._step_accum += self.step_length * value / EnumerableSetting.STEP_SIZE while abs(self._step_accum) >= self.step_length: self.notify_setting_changed( self.attribute_index, sign(self._step_accum) * self.step_length) self._step_accum -= self.step_length * sign(self._step_accum)
def change_relative(self, value): if sign(value) != sign(self._relative_value): self._relative_value = 0.0 self._relative_value += value if fabs(self._relative_value) >= self.STEP_SIZE: relative_position = int(sign(self._relative_value)) self._relative_value -= self.STEP_SIZE return self._jump_relative(relative_position) != None
def change_relative(self, value): if sign(value) != sign(self._relative_value): self._relative_value = 0.0 self._relative_value += value if fabs(self._relative_value) >= self.STEP_SIZE: relative_position = int(sign(self._relative_value)) self._relative_value = 0.0 return self._jump_relative(relative_position) != None
def _limited_nudge_offset(self, steps, notes, nudge_offset): limited_nudge_offset = MAX_CLIP_LENGTH for x, y in steps: time_step = self._time_step(self._get_step_start_time(x, y)) for note in time_step.filter_notes(notes): time_after_nudge = time_step.clamp(note[1], nudge_offset) limited_nudge_offset = min(limited_nudge_offset, abs(note[1] - time_after_nudge)) return sign(nudge_offset) * limited_nudge_offset
def _on_value(self, value): self._step_accum += self.step_length * value / EnumerableSetting.STEP_SIZE while abs(self._step_accum) >= self.step_length: self.notify_setting_changed(self.attribute_index, sign(self._step_accum) * self.step_length) self._step_accum -= self.step_length * sign(self._step_accum)