Skip to content

Commit 162ccf6

Browse files
committed
Audio Items: SHIFT+drag to freely time stretch
1 parent 4e7fc70 commit 162ccf6

File tree

1 file changed

+10
-3
lines changed
  • src/sgui/daw/item_editor/audio

1 file changed

+10
-3
lines changed

src/sgui/daw/item_editor/audio/item.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ def draw(self):
436436
def set_tooltips(self):
437437
self.start_handle.setToolTip(
438438
"Use this handle to resize the item by changing the start point."
439+
"SHIFT+drag to resize freely without quantize"
439440
)
440441
self.length_handle.setToolTip(
441442
"Use this handle to resize the item by changing the end point. "
@@ -456,7 +457,8 @@ def set_tooltips(self):
456457
'can choose a time stretching algorithm by '
457458
'right-click->Properties->TimestretchMode. Note that each '
458459
'algorithm has different properties, and some will be more '
459-
'time-accurate than others'
460+
'time-accurate than others. '
461+
"SHIFT+drag to stretch without quantize"
460462
)
461463
self.setToolTip(sg_strings.AudioSeqItem)
462464

@@ -982,6 +984,9 @@ def _mm_fade_out(self, a_event):
982984
f_item.update_fade_out_line()
983985

984986
def _mm_stretch(self, a_event):
987+
is_shift = bool(
988+
a_event.modifiers() & QtCore.Qt.KeyboardModifier.ShiftModifier
989+
)
985990
f_event_diff = self._mm_event_diff(a_event)
986991
for f_item in shared.AUDIO_SEQ.audio_items:
987992
if (
@@ -997,7 +1002,8 @@ def _mm_stretch(self, a_event):
9971002
f_item.stretch_width_default * 200.0,
9981003
)
9991004
f_x = clip_max(f_x, f_item.max_stretch)
1000-
f_x = _shared.quantize(f_x)
1005+
if not is_shift:
1006+
f_x = _shared.quantize(f_x)
10011007
f_x -= f_item.quantize_offset
10021008
f_item.stretch_handle.setPos(
10031009
f_x - shared.AUDIO_ITEM_HANDLE_SIZE,
@@ -1212,7 +1218,8 @@ def mouseReleaseEvent(self, a_event):
12121218
f_audio_item.stretch_width_default * 200.0,
12131219
)
12141220
f_x = clip_max(f_x, f_audio_item.max_stretch)
1215-
f_x = _shared.quantize(f_x)
1221+
if not is_shift:
1222+
f_x = _shared.quantize(f_x)
12161223
f_x -= f_audio_item.quantize_offset
12171224
f_item.timestretch_amt = \
12181225
f_x / f_audio_item.stretch_width_default

0 commit comments

Comments
 (0)