Commit Graph
2685 Commits
Author SHA1 Message Date
vicrodh d023af5478 fix: align immersive FPS collapse with other collapsible sections
Replace raw text caret and h4 with the standard section-title +
section-summary + ChevronDown/Up icon pattern used by the composition
section. Remove duplicate description that now shows as summary.
2026-03-01 12:40:48 -06:00
vicrodh d509c30979 feat: update composition profiles with GSK renderer and blur toggle
Add gskRenderer and disableBlurBackground fields to CompositionProfile.
Update existing profiles: Xwayland Performance now disables blur.
Add new Max Performance profile (Cairo software renderer + blur off)
for maximum compatibility on stutter-affected systems.

Profile matching and apply logic now includes all new fields.

Part of #127.
2026-03-01 12:39:47 -06:00
vicrodh 7d8e8fadcf feat: add qbz --autoconfig-graphics diagnostic CLI tool
Detects GPU (NVIDIA/AMD/Intel), display server (Wayland/X11), desktop
environment, and VM status. Computes optimal configuration based on a
decision matrix and writes it to the graphics settings DB.

Usage: qbz --autoconfig-graphics

Part of #127.
2026-03-01 12:37:16 -06:00
vicrodh 09b1ee0d72 feat: add option to disable immersive blur background
When enabled, replaces the expensive blurred album artwork background
with a solid dark color extracted from the artwork at tiny resolution.
Significantly reduces GPU load and fixes stutter on affected systems.

Setting is stored in localStorage (same as FPS settings) and applies
on next immersive mode entry.

Part of #127.
2026-03-01 12:34:46 -06:00
vicrodh 58ad252798 feat: add GSK_RENDERER control for GTK4 rendering backend
Add gsk_renderer field to graphics settings DB with UI dropdown
(Auto/GL/NGL/Vulkan/Cairo). Value is read at startup and set as
GSK_RENDERER env var. Env var override takes precedence. Also
included in --reset-graphics and reset now restores hw_accel to true.

Part of #127.
2026-03-01 12:30:41 -06:00
vicrodh 82374ffde6 feat: add AMD and Intel GPU detection
Add is_amd_gpu() and is_intel_gpu() detection functions alongside
existing is_nvidia_gpu(). Update GraphicsStartupStatus to expose
has_amd and has_intel to frontend. Log detected GPUs at startup.

Part of #127.
2026-03-01 11:51:37 -06:00
vicrodh 1e98fa631e fix: wire hardware_acceleration DB value to startup logic
The hardware_acceleration toggle in settings was dead code — stored in
DB but ignored at startup (main.rs only checked QBZ_HARDWARE_ACCEL env
var). Now the DB value is read as the default, with env var override.

Fixes part of #127.
2026-03-01 11:49:51 -06:00
vicrodh 8e104a3f3e fix(audio): replace deprecated CPAL name() usage with description()
cx
2026-03-01 10:44:54 -06:00
vicrodh 0f642d0176 merge: sync security fixes from pre-release 2026-03-01 09:53:18 -06:00
vicrodh 4a97ff5588 fix(security): remove deterministic fallback inputs from credential key derivation
cx
2026-03-01 09:51:09 -06:00
vicrodh b57c7e38dc fix(security): remove unused tauri api user_id accessor
cx
2026-03-01 09:50:06 -06:00
vicrodh c17c01b02b fix(security): remove unused qobuz user_id accessor
cx
2026-03-01 09:49:57 -06:00
vicrodh cd6be78969 merge: sync pre-release into main 2026-03-01 09:31:16 -06:00
vicrodh af332a5433 fix(security): remove hardcoded key material from credential encryption
cx
2026-03-01 09:24:47 -06:00
vicrodh 133defbafa fix(security): redact sensitive identifiers and secrets from backend logs
cx
2026-03-01 09:24:42 -06:00
vicrodh 86450f629d fix(security): use cryptographically secure session id generation
cx
2026-03-01 09:20:39 -06:00
vicrodh 426d0ea3ff fix(security): replace regex HTML sanitizer with DOM-based sanitization
cx
2026-03-01 09:20:21 -06:00
vicrodh ead36545d3 fix(actions): harden release-aur workflow permissions and input handling
cx
2026-03-01 09:19:37 -06:00
vicrodh 87fd58b5ec fix(shutdown): avoid manual secondary window teardown on app close
cx
2026-03-01 09:13:40 -06:00
vicrodh 2095e5fce3 fix: add FavQ and TopQ context types to playback context
The ContextType enum and v2_set_playback_context match were missing
fav_q and top_q variants, causing an "Invalid context type" error that
blocked all playback from FavQ and TopQ views. Also wrap
setPlaybackContext calls in try/catch so context errors don't prevent
track playback.

Fixes #140
2026-03-01 08:58:45 -06:00
Victor RH ad866b191e Merge remote-tracking branch 'origin/dependabot/npm_and_yarn/svelte-5.53.6' into pre-release 2026-03-01 08:50:41 -06:00
vicrodh ecbbcbbf98 fix: prevent double-close of WebKit windows causing heap corruption on exit
The "free(): corrupted unsorted chunks" crash was caused by secondary
windows (miniplayer) being closed twice during shutdown:

1. CloseRequested handler closes secondary windows before main closes
2. RunEvent::Exit handler tried to close them again

Calling close() on a window already mid-teardown causes WebKit's
EGL/GPU thread to hit a double-free during TLS cleanup, corrupting
the heap. This was visible even without audio playing.

Fix: use an AtomicBool flag (WINDOWS_CLOSED_BY_USER) set in
CloseRequested, checked in RunEvent::Exit. Secondary windows are
only closed in Exit if CloseRequested didn't already handle them
(e.g., SIGTERM from tauri dev hot reload).
2026-02-28 18:04:49 -06:00
vicrodh 421f993f82 fix: clamp window size to screen resolution and fix physical/logical pixel mismatch
Two fixes for issue #139 (window opens larger than screen):

1. Screen resolution clamping at startup: detect monitor size via
   xdpyinfo/xrandr and clamp saved window dimensions to 95% of screen.
   Prevents windows from opening larger than the display even if the DB
   has valid-but-too-large values.

2. Physical-to-logical pixel conversion in resize handler: the Resized
   event gives physical pixels but inner_size() expects logical pixels.
   With scale factor > 1.0, the window would grow each restart because
   physical values were saved and restored as logical. Now divides by
   scale_factor before persisting.

Closes #139
2026-02-28 17:56:42 -06:00
dependabot[bot] ca593ba944 chore(deps-dev): bump svelte from 5.53.0 to 5.53.6
Bumps [svelte](https://github.com/sveltejs/svelte/tree/HEAD/packages/svelte) from 5.53.0 to 5.53.6.
- [Release notes](https://github.com/sveltejs/svelte/releases)
- [Changelog](https://github.com/sveltejs/svelte/blob/main/packages/svelte/CHANGELOG.md)
- [Commits](https://github.com/sveltejs/svelte/commits/svelte@5.53.6/packages/svelte)

---
updated-dependencies:
- dependency-name: svelte
  dependency-version: 5.53.6
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-28 17:21:31 +00:00
vicrodh 37df510994 feat: add quality-adjusted tooltip case for hardware compatibility
When QBZ adjusts quality for device compatibility (e.g. requesting
Hi-Res instead of Ultra Hi-Res because the DAC doesn't support
176.4kHz), show a blue info tooltip instead of the yellow "Resampled
by system" warning. The new message clarifies that playback is
bit-perfect with no resampling — QBZ simply requested a compatible
quality from the source.

Two distinct tooltip cases:
- Yellow: "Resampled by system" (PipeWire/system is resampling)
- Blue: "Quality adjusted for device compatibility" (QBZ chose lower
  quality, hardware plays natively)
2026-02-28 07:48:03 -06:00
vicrodh 56b0e562a1 fix: check hardware rate compatibility on cached audio before playing
The smart quality downgrade was only in the network fetch path, but
tracks served from cache (memory L1, disk L2, offline) bypassed it
entirely. Now all cache paths probe the FLAC header for sample rate
and skip the cache if the hardware doesn't support it, falling through
to the network path which re-requests at Hi-Res quality.

Also applies quality downgrade to prefetch so upcoming tracks are
fetched at compatible quality instead of caching incompatible data.
2026-02-28 07:48:03 -06:00
vicrodh 7086110569 feat: smart quality downgrade for unsupported sample rates
When ALSA backend detects hardware doesn't support a track's sample rate
(e.g. 176400Hz on a DAC that supports up to 192000Hz but not 176.4kHz),
automatically re-request the track from Qobuz at Hi-Res quality instead
of Ultra Hi-Res. This avoids resampling and maintains bit-perfect playback
by getting a version at a rate the hardware natively supports.

Adds device_supports_sample_rate() and get_device_supported_rates()
public API to qbz-audio for hardware capability queries via /proc/asound.
2026-02-28 07:48:03 -06:00
vicrodh 3329d1d632 fix: suspend PipeWire before CPAL stream in exclusive mode
When transitioning from ALSA Direct to CPAL fallback (e.g. for rate
resampling), PipeWire auto-re-acquires the device after ALSA Direct
releases it. CPAL then can't open the device.

Suspend PipeWire sinks before creating CPAL stream in exclusive mode,
same pattern used in ALSA Direct DeviceBusy handler.
2026-02-28 07:48:03 -06:00
vicrodh b234828228 fix: pre-check hardware rates via /proc/asound before ALSA Direct
When ALSA Direct opens a PCM device and fails to set the rate, the
USB DAC doesn't release the device fast enough for CPAL to open it
afterwards. This caused "device busy" errors even with a delay.

New approach: read /proc/asound/cardN/stream0 to check supported
rates BEFORE opening the device. If the rate isn't supported, skip
ALSA Direct entirely and fall through to CPAL (which has rate
fallback logic). The device is never touched at the wrong rate.
2026-02-28 07:48:03 -06:00
vicrodh d667ace987 fix: add 100ms delay after ALSA Direct PCM release before CPAL fallback
When ALSA Direct opens a PCM device and fails to configure the rate,
the PCM handle is dropped but the kernel may not release the device
instantly. CPAL then fails with "Device busy" when trying to open it.

Add 100ms sleep after InvalidParams to let the kernel fully release
the device before CPAL attempts to open it. Also fix error messages
to show the effective (fallback) rate instead of the original rate.
2026-02-28 07:48:03 -06:00
vicrodh c99f0d342d fix: add sample rate fallback to ALSA backend CPAL path
When ALSA Direct can't handle a rate (e.g. 176.4kHz) and falls back
to CPAL, CPAL also fails because the hardware doesn't support it.

Port find_best_fallback_rate from PipeWire backend: queries supported
rates via CPAL, picks highest rate in same family (44.1k or 48k)
that's <= requested. 176.4kHz on a 96kHz-max DAC now falls back to
88.2kHz and rodio resamples, instead of failing entirely.
2026-02-28 07:48:03 -06:00
vicrodh 29343e8149 fix: fall back to CPAL when ALSA Direct doesn't support sample rate
When hardware doesn't natively support a sample rate (e.g. 176.4kHz),
return None from try_create_direct_stream instead of a hard error.
This lets the player fall through to CPAL/rodio which can resample.

Applied to both hw and plughw paths — InvalidParams on rate now
triggers graceful fallback instead of killing playback.
2026-02-28 07:48:03 -06:00
vicrodh aff45f98f0 fix: close secondary windows before main to allow app exit, hide miniplayer on tray
Previous commit removed the miniplayer close from CloseRequested,
but that kept the app alive because Tauri won't exit while windows
remain open. Now closes secondary windows with close() (not
destroy()) in CloseRequested before the main window closes.
Also hides the miniplayer when close-to-tray activates.
2026-02-28 07:48:03 -06:00
vicrodh b1e4f8db94 fix: prevent WebKit crash on close by eliminating double-destroy of miniplayer
The miniplayer window was being destroyed twice during shutdown:
once in CloseRequested and again in RunEvent::Exit. This caused
WebKit's TLS destructors to collide during process teardown,
resulting in SIGABRT in WebKitWebProcess.

Changes:
- Remove miniplayer destroy from CloseRequested (was premature)
- Guard global on_window_event to only handle main window
- In RunEvent::Exit, close all secondary windows (miniplayer, oauth)
  with close() instead of destroy() for graceful WebKit cleanup
- Add 100ms delay after closing secondary windows to let WebKit
  tear down EGL/GPU resources before process exit
2026-02-28 07:48:03 -06:00
vicrodh 21fc1dfea3 fix: validate window size on load to prevent GDK crash from corrupt DB values
Extends PR #136 (save-time validation) with load-time validation.
If the DB contains corrupt sizes (e.g. 9084748x62267212), get_settings()
now returns safe defaults instead of passing garbage to GDK/Cairo.
Also extracts validation into a shared helper and adds NaN/Inf checks.
2026-02-28 07:48:03 -06:00
vicrodh fe3c5b0528 fix: suspend PipeWire sink before ALSA Direct to prevent DeviceBusy on first play
When switching from PipeWire to ALSA Direct, PipeWire holds the ALSA
device open causing EBUSY on the first snd_pcm_open. Now detects
DeviceBusy, suspends the PipeWire sink via pactl, waits 200ms for
release, then retries. Applied to both hw and plughw paths.
2026-02-28 07:48:03 -06:00
vicrodh 199f19a426 fix: read hardware audio status from V2 player instead of legacy
v2_get_hardware_audio_status was reading sample_rate/bit_depth from the
legacy player state, which is never updated since playback runs through
the V2 player (CoreBridge). Now reads from V2 player first, falls back
to legacy only if CoreBridge isn't initialized yet.
2026-02-28 07:48:03 -06:00
vicrodh cd4685820e fix: ALSA backend unavailable due to cpal 0.17 HostId::name() case change
cpal 0.15 returned "ALSA" from HostId::name(), cpal 0.17 returns "Alsa"
(now uses stringify! on the enum variant). Use eq_ignore_ascii_case()
for the comparison so it works regardless of cpal version.
2026-02-28 07:48:03 -06:00
vicrodh 7f6ac9bae6 fix: add sample rate fallback when DAC doesn't support requested rate
Query the DAC's supported sample rates from /proc/asound/cardN/stream0
(maps PipeWire sink to ALSA card via pactl). If the track's native rate
isn't supported (e.g., 176.4kHz), fall back to the nearest rate in the
same family (e.g., 88.2kHz). Rodio resamples from track rate to stream
rate automatically, so audio plays instead of producing silence.
2026-02-28 07:48:03 -06:00
vicrodh e1d006e672 fix: sync audio settings on startup for OAuth login path
The OAuth login path in runtime_bootstrap was missing the audio settings
sync code that exists in the email/password path. Users logging in via
OAuth had backend_type remain None, causing legacy CPAL fallback and
requiring manual settings reconfiguration on every startup.
2026-02-28 07:48:03 -06:00
vicrodh 5ef58f6121 fix: use with_buffer_size() after with_supported_config() to prevent underruns
rodio 0.22's with_supported_config() resets buffer_size to Default via
..Default::default(), so our BufferSize settings in StreamConfig were
never reaching CPAL. MixerDeviceSink has zero internal buffering, making
CPAL's buffer the ONLY buffer between the mixer and audio hardware.

Chain .with_buffer_size(Fixed(sample_rate/10)) AFTER with_supported_config()
to actually pass ~100ms buffer to CPAL, matching old vendored cpal behavior.
2026-02-28 07:48:03 -06:00
vicrodh b054f51410 fix: revert BufferSize::Fixed for PipeWire, use BufferSize::Default
PipeWire manages its own buffer scheduling via quantum. Forcing a fixed
buffer size (sample_rate / 10 = 19200 frames at 192kHz) conflicts with
PipeWire's internal scheduling and causes buffer underruns that produce
audible noise.

BufferSize::Fixed is kept only for:
- Exclusive mode (512 frames, low latency)
- ALSA backend (direct ALSA, not through PipeWire)
2026-02-28 07:48:03 -06:00
vicrodh 014becfb02 fix: disable PipeWire clock.force-quantum for rodio 0.22 compatibility
rodio 0.22's MixerDeviceSink has an internal mixer thread that cannot
synchronize with PipeWire's forced quantum scheduling. This caused
massive buffer underruns (600+) at sample rates >= 88.2kHz when Force
Bit Perfect was enabled.

clock.force-rate alone is sufficient for bit-perfect sample rate
switching. Logs confirm zero underruns at 88.2kHz and minimal underruns
at 192kHz (only during heavy I/O) when quantum is not forced.
2026-02-28 07:48:03 -06:00
vicrodh 3d8733181a chore: remove unused SampleRate imports
SampleRate is now a u32 type alias in cpal 0.17, so the import is no
longer needed anywhere.
2026-02-28 07:48:03 -06:00
vicrodh 6e8b8410c9 fix: set explicit 100ms buffer size to replace vendored cpal tuning
Replace BufferSize::Default with BufferSize::Fixed(sample_rate / 10)
for non-exclusive mode. This preserves the 100ms period tuning that was
previously applied in the vendored cpal ALSA backend, reducing CPU
wakeups during playback.
2026-02-28 07:48:03 -06:00
vicrodh b5ec5de785 refactor: migrate all code to rodio 0.22 API
- OutputStream/OutputStreamHandle -> DeviceSinkBuilder/MixerDeviceSink
- Sink -> Player (as RodioPlayer)
- current_frame_len -> current_span_len in all Source impls
- Source::channels() returns NonZero<u16>, sample_rate() returns NonZero<u32>
- SamplesBuffer no longer generic, constructor takes NonZero args
- SampleRate is now u32 type alias (no tuple struct)
- Decoder::new_mp4 no longer takes Mp4Type hint
- Applied across both crates/ workspace and src-tauri/ legacy code
2026-02-28 07:48:03 -06:00
vicrodh faf8844584 chore: upgrade rodio 0.19 to 0.22, remove vendored rodio/cpal
Remove vendored rodio and cpal from src-tauri/vendor/ since rodio 0.22
now includes upstream f32 decoder support (our vendored modification).
Update all Cargo.toml files to use rodio 0.22 from crates.io and remove
the [patch.crates-io] section.
2026-02-28 07:48:03 -06:00
vicrodh 33e80b0836 fix: lower default visualizer FPS from 60 to 15 for better performance 2026-02-28 07:48:03 -06:00
vicrodh 99196db70f fix: graceful shutdown on RunEvent::Exit to prevent heap corruption
Handle RunEvent::Exit (fires on SIGTERM from tauri dev hot reload)
to stop audio playback and visualizer before process teardown. The
previous CloseRequested handler only fires on user-initiated close,
not on SIGTERM, leaving ALSA/CPAL C threads active during cleanup
which causes "free(): corrupted unsorted chunks" heap corruption.

- Switch from .run(context) to .build(context).run(callback)
- Stop visualizer and both legacy/V2 players on Exit event
- Destroy miniplayer window on Exit event
2026-02-28 07:48:03 -06:00
vicrodh 6c8354f825 feat: add booklet download button, remove pdfjs-dist dependency
- Add save/download button to booklet toolbar with native file dialog
- Add v2_booklet_save command to copy PDF to user-chosen location
- Remove pdfjs-dist npm package (replaced by MuPDF backend)
- Delete static/pdfjs/ files (~1.9MB: worker, WASM decoders, fallbacks)
- Add bookletDownload i18n keys to all 4 locales
2026-02-28 07:48:03 -06:00