revert audio normalization feature
Neither loudnorm (EBU R128) nor dynaudnorm work well for this use case — both are designed for continuous playback, not rapidly switching between random short clips with wildly different levels.
This commit is contained in:
parent
2824840b07
commit
7ef517235f
@ -335,7 +335,6 @@ class BooruApp(QMainWindow):
|
|||||||
self._right_splitter = right = QSplitter(Qt.Orientation.Vertical)
|
self._right_splitter = right = QSplitter(Qt.Orientation.Vertical)
|
||||||
|
|
||||||
self._preview = ImagePreview()
|
self._preview = ImagePreview()
|
||||||
self._preview._video_player._loudnorm = self._db.get_setting_bool("loudnorm")
|
|
||||||
self._preview.close_requested.connect(self._close_preview)
|
self._preview.close_requested.connect(self._close_preview)
|
||||||
self._preview.open_in_default.connect(self._open_preview_in_default)
|
self._preview.open_in_default.connect(self._open_preview_in_default)
|
||||||
self._preview.open_in_browser.connect(self._open_preview_in_browser)
|
self._preview.open_in_browser.connect(self._open_preview_in_browser)
|
||||||
@ -1078,13 +1077,6 @@ class BooruApp(QMainWindow):
|
|||||||
right_is_first = current_first is self._right_splitter
|
right_is_first = current_first is self._right_splitter
|
||||||
if want_right_first != right_is_first:
|
if want_right_first != right_is_first:
|
||||||
self._splitter.insertWidget(0, self._right_splitter if flip else self._stack)
|
self._splitter.insertWidget(0, self._right_splitter if flip else self._stack)
|
||||||
# Apply audio normalization live
|
|
||||||
loudnorm = self._db.get_setting_bool("loudnorm")
|
|
||||||
af_val = "loudnorm" if loudnorm else ""
|
|
||||||
for vp in self._get_all_video_players():
|
|
||||||
vp._loudnorm = loudnorm
|
|
||||||
if vp._mpv is not None:
|
|
||||||
vp._mpv.af = af_val
|
|
||||||
self._status.showMessage("Settings applied")
|
self._status.showMessage("Settings applied")
|
||||||
|
|
||||||
# -- Fullscreen & Privacy --
|
# -- Fullscreen & Privacy --
|
||||||
@ -1112,14 +1104,6 @@ class BooruApp(QMainWindow):
|
|||||||
if hasattr(self, '_main_window_save_timer'):
|
if hasattr(self, '_main_window_save_timer'):
|
||||||
self._main_window_save_timer.start()
|
self._main_window_save_timer.start()
|
||||||
|
|
||||||
def _get_all_video_players(self):
|
|
||||||
"""Return every VideoPlayer instance that currently exists."""
|
|
||||||
players = [self._preview._video_player]
|
|
||||||
pw = self._popout_ctrl.window
|
|
||||||
if pw is not None:
|
|
||||||
players.append(pw._video)
|
|
||||||
return players
|
|
||||||
|
|
||||||
# -- Keyboard shortcuts --
|
# -- Keyboard shortcuts --
|
||||||
|
|
||||||
def keyPressEvent(self, event) -> None:
|
def keyPressEvent(self, event) -> None:
|
||||||
|
|||||||
@ -337,7 +337,6 @@ class VideoPlayer(QWidget):
|
|||||||
self._stream_record_tmp: Path | None = None
|
self._stream_record_tmp: Path | None = None
|
||||||
self._stream_record_target: Path | None = None
|
self._stream_record_target: Path | None = None
|
||||||
self._seeked_during_record: bool = False
|
self._seeked_during_record: bool = False
|
||||||
self._loudnorm: bool = False
|
|
||||||
|
|
||||||
def _ensure_mpv(self) -> mpvlib.MPV:
|
def _ensure_mpv(self) -> mpvlib.MPV:
|
||||||
"""Set up mpv callbacks on first use. MPV instance is pre-created."""
|
"""Set up mpv callbacks on first use. MPV instance is pre-created."""
|
||||||
@ -365,9 +364,6 @@ class VideoPlayer(QWidget):
|
|||||||
# exists. The qproperty-letterboxColor setter is a no-op if mpv
|
# exists. The qproperty-letterboxColor setter is a no-op if mpv
|
||||||
# hasn't been initialized yet, so we have to (re)apply on init.
|
# hasn't been initialized yet, so we have to (re)apply on init.
|
||||||
self._apply_letterbox_color()
|
self._apply_letterbox_color()
|
||||||
# Apply audio normalization if enabled in settings.
|
|
||||||
if self._loudnorm:
|
|
||||||
self._mpv.af = "loudnorm"
|
|
||||||
return self._mpv
|
return self._mpv
|
||||||
|
|
||||||
# -- Public API (used by app.py for state sync) --
|
# -- Public API (used by app.py for state sync) --
|
||||||
|
|||||||
@ -205,11 +205,6 @@ class SettingsDialog(QDialog):
|
|||||||
self._flip_layout.setChecked(self._db.get_setting_bool("flip_layout"))
|
self._flip_layout.setChecked(self._db.get_setting_bool("flip_layout"))
|
||||||
form.addRow("", self._flip_layout)
|
form.addRow("", self._flip_layout)
|
||||||
|
|
||||||
# Audio normalization
|
|
||||||
self._loudnorm = QCheckBox("Normalize audio volume (EBU R128)")
|
|
||||||
self._loudnorm.setChecked(self._db.get_setting_bool("loudnorm"))
|
|
||||||
form.addRow("", self._loudnorm)
|
|
||||||
|
|
||||||
# Slideshow monitor
|
# Slideshow monitor
|
||||||
from PySide6.QtWidgets import QApplication
|
from PySide6.QtWidgets import QApplication
|
||||||
self._monitor_combo = QComboBox()
|
self._monitor_combo = QComboBox()
|
||||||
@ -816,7 +811,6 @@ class SettingsDialog(QDialog):
|
|||||||
self._db.set_setting("unbookmark_on_save", "1" if self._unbookmark_on_save.isChecked() else "0")
|
self._db.set_setting("unbookmark_on_save", "1" if self._unbookmark_on_save.isChecked() else "0")
|
||||||
self._db.set_setting("search_history_enabled", "1" if self._search_history.isChecked() else "0")
|
self._db.set_setting("search_history_enabled", "1" if self._search_history.isChecked() else "0")
|
||||||
self._db.set_setting("flip_layout", "1" if self._flip_layout.isChecked() else "0")
|
self._db.set_setting("flip_layout", "1" if self._flip_layout.isChecked() else "0")
|
||||||
self._db.set_setting("loudnorm", "1" if self._loudnorm.isChecked() else "0")
|
|
||||||
self._db.set_setting("slideshow_monitor", self._monitor_combo.currentText())
|
self._db.set_setting("slideshow_monitor", self._monitor_combo.currentText())
|
||||||
_anchor_rmap = {"Center": "center", "Top-left": "tl", "Top-right": "tr", "Bottom-left": "bl", "Bottom-right": "br"}
|
_anchor_rmap = {"Center": "center", "Top-left": "tl", "Top-right": "tr", "Bottom-left": "bl", "Bottom-right": "br"}
|
||||||
self._db.set_setting("popout_anchor", _anchor_rmap.get(self._popout_anchor.currentText(), "center"))
|
self._db.set_setting("popout_anchor", _anchor_rmap.get(self._popout_anchor.currentText(), "center"))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user