feat: audio area length — remove the upper cap + step by 1s
The audio extract length is meant for visualizing/grabbing sequences that can run minutes long, but the control capped it and stepped in fiddly 0.10s increments. Raise the range to effectively unlimited (24h; ffmpeg stops cleanly at end-of-file if the source is shorter) and make the arrows step 1s — typing still allows sub-second precision. Widen the field for the larger values. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -4439,12 +4439,17 @@ class MainWindow(QMainWindow):
|
|||||||
# saved via a Save As dialog (format follows the chosen extension).
|
# saved via a Save As dialog (format follows the chosen extension).
|
||||||
transport_row.addSpacing(12)
|
transport_row.addSpacing(12)
|
||||||
self._spn_audio_len = QDoubleSpinBox()
|
self._spn_audio_len = QDoubleSpinBox()
|
||||||
self._spn_audio_len.setRange(0.10, 120.0)
|
# No practical upper cap — audio areas can be minutes long; ffmpeg stops
|
||||||
|
# cleanly at end-of-file if the source is shorter. Arrows step by 1s;
|
||||||
|
# type for sub-second precision.
|
||||||
|
self._spn_audio_len.setRange(0.10, 86400.0)
|
||||||
self._spn_audio_len.setDecimals(2)
|
self._spn_audio_len.setDecimals(2)
|
||||||
self._spn_audio_len.setSingleStep(0.10)
|
self._spn_audio_len.setSingleStep(1.0)
|
||||||
self._spn_audio_len.setSuffix(" s")
|
self._spn_audio_len.setSuffix(" s")
|
||||||
self._spn_audio_len.setFixedWidth(78)
|
self._spn_audio_len.setFixedWidth(92)
|
||||||
self._spn_audio_len.setToolTip("Audio area length, measured from the playhead")
|
self._spn_audio_len.setToolTip(
|
||||||
|
"Audio area length, measured from the playhead "
|
||||||
|
"(arrows step 1s; type for finer)")
|
||||||
self._spn_audio_len.setValue(
|
self._spn_audio_len.setValue(
|
||||||
float(self._settings.value("audio_extract_len", 3.0)))
|
float(self._settings.value("audio_extract_len", 3.0)))
|
||||||
self._spn_audio_len.valueChanged.connect(self._on_audio_len_changed)
|
self._spn_audio_len.valueChanged.connect(self._on_audio_len_changed)
|
||||||
|
|||||||
@@ -251,6 +251,9 @@ def test_extract_audio_controls_exist(win):
|
|||||||
assert isinstance(win._spn_audio_len, QDoubleSpinBox)
|
assert isinstance(win._spn_audio_len, QDoubleSpinBox)
|
||||||
# Disabled until a file is loaded.
|
# Disabled until a file is loaded.
|
||||||
assert not win._btn_extract_audio.isEnabled()
|
assert not win._btn_extract_audio.isEnabled()
|
||||||
|
# Arrows step by 1s and there's no practical upper cap (long audio areas).
|
||||||
|
assert win._spn_audio_len.singleStep() == 1.0
|
||||||
|
assert win._spn_audio_len.maximum() >= 3600.0
|
||||||
|
|
||||||
|
|
||||||
def test_audio_region_tracks_cursor_and_length(win):
|
def test_audio_region_tracks_cursor_and_length(win):
|
||||||
|
|||||||
Reference in New Issue
Block a user