v0.44.0: per-track volume, laser rig diagram, bolder Preferences headings

Get Info has a Volume slider (−100%…+100%): iTunes' own per-song volume
adjustment, which the library already imported but never used. It scales
the volume slider while that song plays; a boost can't pass full volume.
Works on one song or several (Mixed when they differ), and undoes.

Get Info's Previous/Next buttons are gone: since the combined multi-song
editor they were always disabled (and blank in some themes).

The laser settings draw the rig — speaker and mirror, laser, beam, and the
screen at its distance and angles — as a small textbook line drawing that
labels distance, angles and dot size in place of the sliders' numbers.

Preferences section headings are bold and 2 px larger than the text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-10 01:53:07 -07:00
co-authored by Claude Opus 5.5
parent 4fb62a1dae
commit 6d5589ad0c
8 changed files with 600 additions and 39 deletions
+30 -2
View File
@@ -64,6 +64,21 @@ def make_shuffle_order(count: int, start_index: int) -> list[int]:
return order
VOLUME_ADJUSTMENT_MAX = 255 # iTunes' unit: ±255 is its slider's ±100%
def volume_with_adjustment(level: float, adjustment: int) -> float:
"""A track's volume adjustment (Get Info → Volume, iTunes' "Volume
Adjustment", imported as-is) applied to the logical 0..1 volume.
It scales the slider's own perceptual level: −100% is silence, +50% is
the slider half again as far up. It can't go past full — no output can —
so a boost only helps while the main volume is below the top, exactly
like iTunes'."""
share = max(-1.0, min(1.0, adjustment / VOLUME_ADJUSTMENT_MAX))
return max(0.0, min(1.0, level * (1.0 + share)))
class PlaybackSink(QObject):
"""One audio output engine sitting behind Player.
@@ -509,7 +524,7 @@ class Player(QObject):
self._sink = new_sink
self._connect_sink(self._sink)
# Whatever the slider last showed applies to the new output too.
self._sink.set_volume(self._volume)
self._sink.set_volume(self._output_volume())
if track is not None:
if self._sink.can_play(track):
@@ -628,7 +643,18 @@ class Player(QObject):
meaning the same thing whether audio is coming out of this machine or
a Chromecast."""
self._volume = max(0.0, min(1.0, float(level)))
self._sink.set_volume(self._volume)
self._sink.set_volume(self._output_volume())
def refresh_volume(self):
"""Re-apply the volume — after the playing track's own volume
adjustment was edited."""
self._sink.set_volume(self._output_volume())
def _output_volume(self) -> float:
"""The slider's volume with the playing track's adjustment on it."""
return volume_with_adjustment(
self._volume,
getattr(self._current_track, "volume_adjustment", 0) or 0)
def volume(self) -> float:
"""The logical 0..1 volume last set (what the slider shows)."""
@@ -755,6 +781,8 @@ class Player(QObject):
else:
self._stop_at_ms = 0
self._counted_finish_id = None
# Before the load, so a quieter track never starts loud.
self._sink.set_volume(self._output_volume())
self._sink.load(
track, autoplay,
track.start_time if track.start_time > 0 else 0)