feat: media keys, device recovery, settings and a macOS app bundle
- Media keys and Now Playing (souvlaki): title, artist, album, cover and position published on track and state changes; play/pause/toggle, next/previous and seeking from the OS controls - Audio engine reopens the default output when the device changes or disappears, reloading the current track at the same position; with no device it keeps looking and resumes when one appears. Underruns are ignored rather than treated as device loss - Settings screen: streaming quality (Best, Balanced <=192 kbps, Data saver <=128 kbps), appearance (system/light/dark), clear cover cache; quality, appearance and volume persist as JSON in the config folder - Bitrate cap chooses the best variant within it, or the smallest above - Lyrics failures get a retry button - App icon drawn by tool/make_icon.py; tool/bundle-macos.sh builds an ad-hoc signed Musyx.app (--install copies it to /Applications) - Release profile: thin LTO and stripped symbols
This commit is contained in:
1 parent
e2312f2d40
commit
60156aba94
19 files changed
+1039
-94
No files matched your search
Executable
+84
@@ -0,0 +1,84 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Draws the Musyx app icon (1024x1024 PNG) with no dependencies.
|
||||
|
||||
Aubergine squircle with amber wave lines, matching the My Wave hero.
|
||||
Usage: python3 tool/make_icon.py crates/musyx/assets/icon/musyx.png
|
||||
"""
|
||||
import math
|
||||
import struct
|
||||
import sys
|
||||
import zlib
|
||||
|
||||
SIZE = 1024
|
||||
# macOS icon grid: the body is 824px, centred, with a ~185px corner radius.
|
||||
BODY, RADIUS = 824, 185
|
||||
OFF = (SIZE - BODY) / 2
|
||||
TOP, BOTTOM = (0x35, 0x30, 0x42), (0x1C, 0x1A, 0x22)
|
||||
AMBER = (0xF0, 0xB2, 0x3E)
|
||||
LINES = 11
|
||||
|
||||
|
||||
def rounded_alpha(x, y):
|
||||
"""Coverage of the rounded square at pixel centre (x, y), anti-aliased."""
|
||||
px, py = x + 0.5 - OFF, y + 0.5 - OFF
|
||||
cx = min(max(px, RADIUS), BODY - RADIUS)
|
||||
cy = min(max(py, RADIUS), BODY - RADIUS)
|
||||
d = math.hypot(px - cx, py - cy) - RADIUS
|
||||
if px < 0 or py < 0 or px > BODY or py > BODY:
|
||||
d = max(d, 1.0)
|
||||
return min(max(0.5 - d, 0.0), 1.0)
|
||||
|
||||
|
||||
def wave(k, x):
|
||||
"""Height of line k at x, and its slope, in pixels."""
|
||||
u = (x - OFF) / BODY
|
||||
base = OFF + BODY * (0.34 + k * 0.034)
|
||||
amp = BODY * (0.045 + k * 0.006)
|
||||
f = 1.5 + k * 0.08
|
||||
ph = k * 0.55 + 1.1
|
||||
a = u * math.pi * f + ph
|
||||
b = u * math.pi * 4.2 - ph * 0.7
|
||||
y = base + math.sin(a) * amp + math.sin(b) * amp * 0.35
|
||||
dy = (math.cos(a) * amp * math.pi * f + math.cos(b) * amp * 0.35 * math.pi * 4.2) / BODY
|
||||
return y, dy
|
||||
|
||||
|
||||
def main(out):
|
||||
rows = []
|
||||
curves = [[wave(k, x + 0.5) for x in range(SIZE)] for k in range(LINES)]
|
||||
for y in range(SIZE):
|
||||
row = bytearray([0]) # filter: none
|
||||
t = y / SIZE
|
||||
bg = tuple(round(TOP[i] + (BOTTOM[i] - TOP[i]) * t) for i in range(3))
|
||||
for x in range(SIZE):
|
||||
cover = rounded_alpha(x, y)
|
||||
if cover == 0.0:
|
||||
row += b"\x00\x00\x00\x00"
|
||||
continue
|
||||
r, g, b = bg
|
||||
for k in range(LINES):
|
||||
cy, slope = curves[k][x]
|
||||
dist = abs(y + 0.5 - cy) / math.sqrt(1 + slope * slope)
|
||||
width = 4.0 + k * 0.9
|
||||
a = min(max(width / 2 - dist + 0.5, 0.0), 1.0)
|
||||
if a:
|
||||
a *= 0.18 + 0.82 * (k / (LINES - 1))
|
||||
r = r + (AMBER[0] - r) * a
|
||||
g = g + (AMBER[1] - g) * a
|
||||
b = b + (AMBER[2] - b) * a
|
||||
row += bytes((round(r), round(g), round(b), round(cover * 255)))
|
||||
rows.append(bytes(row))
|
||||
|
||||
def chunk(kind, data):
|
||||
return struct.pack(">I", len(data)) + kind + data + struct.pack(">I", zlib.crc32(kind + data) & 0xFFFFFFFF)
|
||||
|
||||
png = b"\x89PNG\r\n\x1a\n"
|
||||
png += chunk(b"IHDR", struct.pack(">IIBBBBB", SIZE, SIZE, 8, 6, 0, 0, 0))
|
||||
png += chunk(b"IDAT", zlib.compress(b"".join(rows), 9))
|
||||
png += chunk(b"IEND", b"")
|
||||
with open(out, "wb") as f:
|
||||
f.write(png)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1] if len(sys.argv) > 1 else "musyx.png")
|
||||
Reference in new issue
Block a user