fix: sync editor playhead with selection changes
This commit is contained in:
@@ -4365,6 +4365,7 @@ class AudioEditorDialog(QDialog):
|
||||
self._healed_seams: dict[str, list[float]] = {}
|
||||
|
||||
self._wave = AudioWaveform()
|
||||
self._wave.selection_changed.connect(self._on_wave_selection_changed)
|
||||
self._wave.playhead_changed.connect(self._on_wave_playhead_changed)
|
||||
self._btn_heal_cut = QPushButton("Heal Cut")
|
||||
self._btn_delete = QPushButton("Delete")
|
||||
@@ -4616,6 +4617,13 @@ class AudioEditorDialog(QDialog):
|
||||
return
|
||||
self._play_current(*self._join_preview)
|
||||
|
||||
def _on_wave_selection_changed(self, s: float, e: float) -> None:
|
||||
was_playing = self._play_proc is not None
|
||||
prior_playhead = self._playhead_secs()
|
||||
self._wave.set_playhead(s)
|
||||
if was_playing and (self._play_loop or s <= prior_playhead <= e):
|
||||
self._play_current(s, e, loop=True)
|
||||
|
||||
def _on_wave_playhead_changed(self, t: float) -> None:
|
||||
if self._play_proc is not None:
|
||||
self._play_from_playhead()
|
||||
|
||||
Reference in New Issue
Block a user