fix(slint): HiFi wizard test step — audio, bit-perfect read-back, track jump, UX
Fixes from owner testing of the Slice 9 playback test: - No audio: removed the incomplete reinit_device(node) that routed output to the selected DAC (the proper switch is set_output_device -> reload_settings -> reinit; doing it half-way broke playback). The test now plays through the current output; route QBZ to the DAC under test in Settings > Audio. - Bit-perfect read-back: dropped the pw-top panel (batch snapshot never reflected the live nodes) and enriched the N6 read-back to show the DAC's real /proc/asound hw_params — rate + ALSA container format (S32_LE etc.) + channels. That container format is the bit-perfect proof. Probe scans for the actively playing card, so it's DAC-agnostic (answers the multi-DAC case: one output at a time). - Track jump: clicking a test row now re-sets the queue at that index via the working play_tracks path (play_index alone only moved the pointer). Resolved tracks are stashed for this. - "Use my own music" button: starts the read-back + resumes the user's own queue for those who don't want the curated tracks. - Row hover no longer changes the row height (fixed-size glyph slot; the ♪->▶ swap can't reflow what's below). cc
This commit is contained in:
6 files changed
+129
-55
No files matched your search
@@ -479,9 +479,6 @@ pub const TEST_SEEDS: [TestSeed; 4] = [
|
||||
TestSeed { depth: 24, rate: 192000.0, id_hint: 52265, artist: "Toto", title: "Africa" },
|
||||
];
|
||||
|
||||
/// The DAC node.name the test is currently watching (N6 probe target).
|
||||
static TEST_NODE: Mutex<Option<String>> = Mutex::new(None);
|
||||
|
||||
/// True if a resolved track matches this seed's family (rate + bit depth — the
|
||||
/// two 44.1 seeds only differ by depth).
|
||||
pub fn track_matches_seed(track: &qbz_models::Track, seed: &TestSeed) -> bool {
|
||||
@@ -493,29 +490,21 @@ pub fn track_matches_seed(track: &qbz_models::Track, seed: &TestSeed) -> bool {
|
||||
rate_ok && depth_ok
|
||||
}
|
||||
|
||||
/// The node.name of the first checked candidate (the DAC being configured), or
|
||||
/// the manual node.name from the escape hatch.
|
||||
pub fn first_selected_node(window: &AppWindow) -> Option<String> {
|
||||
let st = window.global::<DacWizardState>();
|
||||
let model = st.get_candidates();
|
||||
for i in 0..model.row_count() {
|
||||
if let Some(r) = model.row_data(i) {
|
||||
if r.checked {
|
||||
return Some(r.id.to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
let manual = st.get_manual_node_name().to_string();
|
||||
if !manual.trim().is_empty() && st.get_manual_valid() {
|
||||
Some(manual)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
/// Resolved test tracks, kept so the user can jump straight to any of them
|
||||
/// (re-set the queue at the chosen index via the working play path).
|
||||
static TEST_TRACKS: Mutex<Vec<qbz_models::Track>> = Mutex::new(Vec::new());
|
||||
|
||||
pub fn stash_test_tracks(tracks: Vec<qbz_models::Track>) {
|
||||
*TEST_TRACKS.lock().unwrap() = tracks;
|
||||
}
|
||||
|
||||
/// Start the test: stash the watched node + show the "playing" state.
|
||||
pub fn begin_test(window: &AppWindow, node: Option<String>) {
|
||||
*TEST_NODE.lock().unwrap() = node;
|
||||
pub fn test_tracks() -> Vec<qbz_models::Track> {
|
||||
TEST_TRACKS.lock().unwrap().clone()
|
||||
}
|
||||
|
||||
/// Start the test: show the "playing" state. The read-back probes whichever
|
||||
/// DAC is actively playing (scan), so no node needs to be stashed.
|
||||
pub fn begin_test(window: &AppWindow) {
|
||||
let st = window.global::<DacWizardState>();
|
||||
st.set_test_playing(true);
|
||||
st.set_test_rate_matched(false);
|
||||
@@ -527,11 +516,6 @@ pub fn end_test(window: &AppWindow) {
|
||||
window.global::<DacWizardState>().set_test_playing(false);
|
||||
}
|
||||
|
||||
/// The node the poll loop should probe (read on a worker thread).
|
||||
pub fn test_node() -> Option<String> {
|
||||
TEST_NODE.lock().unwrap().clone()
|
||||
}
|
||||
|
||||
/// Apply one poll: the rate QBZ requested vs the DAC's real negotiated rate (N6).
|
||||
pub fn apply_poll(
|
||||
window: &AppWindow,
|
||||
@@ -552,12 +536,17 @@ pub fn apply_poll(
|
||||
});
|
||||
match negotiated {
|
||||
Some(n) => {
|
||||
st.set_test_negotiated_label(format!("DAC running at {}", khz(n.sample_rate)).into());
|
||||
// Truth signal (N6): the DAC's real clock matches what QBZ asked for.
|
||||
// The DAC's REAL hardware params (N6): rate + ALSA container format
|
||||
// (e.g. S32_LE = 24-bit in a 32-bit frame) + channels. This is the
|
||||
// bit-perfect proof — exactly what the hardware is clocked at.
|
||||
st.set_test_negotiated_label(
|
||||
format!("DAC: {} · {} · {} ch", khz(n.sample_rate), n.format, n.channels).into(),
|
||||
);
|
||||
// Truth signal: the DAC's real clock matches what QBZ asked for.
|
||||
st.set_test_rate_matched(requested_rate > 0 && n.sample_rate == requested_rate);
|
||||
}
|
||||
None => {
|
||||
st.set_test_negotiated_label("DAC idle — set QBZ output to this DAC".into());
|
||||
st.set_test_negotiated_label("Waiting for the DAC to start playing…".into());
|
||||
st.set_test_rate_matched(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11393,8 +11393,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let Some(w) = weak.upgrade() else {
|
||||
return;
|
||||
};
|
||||
let node = dac_wizard::first_selected_node(&w);
|
||||
dac_wizard::begin_test(&w, node.clone());
|
||||
dac_wizard::begin_test(&w);
|
||||
let runtime = runtime.clone();
|
||||
let weak2 = w.as_weak();
|
||||
let play_handle = handle.clone();
|
||||
@@ -11418,9 +11417,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
tracks.push(t);
|
||||
}
|
||||
}
|
||||
if let Some(n) = node.clone() {
|
||||
let _ = runtime.core().player().reinit_device(Some(n));
|
||||
}
|
||||
// Keep the resolved tracks so the user can jump between them.
|
||||
dac_wizard::stash_test_tracks(tracks.clone());
|
||||
let runtime2 = runtime.clone();
|
||||
let _ = weak2.upgrade_in_event_loop(move |w| {
|
||||
if tracks.is_empty() {
|
||||
@@ -11448,8 +11446,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let player = runtime.core().player();
|
||||
let req_rate = player.state.get_sample_rate();
|
||||
let req_bits = player.state.get_bit_depth();
|
||||
let negotiated = dac_wizard::test_node()
|
||||
.and_then(|n| qbz_audio::negotiated_stream_rate(&n));
|
||||
let negotiated = qbz_audio::negotiated_active_rate();
|
||||
let _ = weak2.upgrade_in_event_loop(move |w| {
|
||||
dac_wizard::apply_poll(&w, req_rate, req_bits, negotiated);
|
||||
});
|
||||
@@ -11466,6 +11463,41 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
});
|
||||
}
|
||||
{
|
||||
// Jump straight to one of the test tracks (skip the long waits) by
|
||||
// re-setting the queue at that index via the working play path.
|
||||
let runtime = app_runtime.clone();
|
||||
let weak = window.as_weak();
|
||||
let handle = tokio_rt.handle().clone();
|
||||
window
|
||||
.global::<DacWizardActions>()
|
||||
.on_test_play_index(move |i| {
|
||||
let tracks = dac_wizard::test_tracks();
|
||||
if tracks.is_empty() {
|
||||
return;
|
||||
}
|
||||
let start = (i.max(0) as usize).min(tracks.len().saturating_sub(1));
|
||||
crate::playback::play_tracks(
|
||||
runtime.clone(),
|
||||
weak.clone(),
|
||||
handle.clone(),
|
||||
tracks,
|
||||
start,
|
||||
);
|
||||
});
|
||||
}
|
||||
{
|
||||
// "Use my own music": start the read-back without queuing the test
|
||||
// tracks — the user plays whatever they want; the poll reads the rate.
|
||||
let runtime = app_runtime.clone();
|
||||
let weak = window.as_weak();
|
||||
window.global::<DacWizardActions>().on_verify_own(move || {
|
||||
if let Some(w) = weak.upgrade() {
|
||||
dac_wizard::begin_test(&w);
|
||||
}
|
||||
let _ = runtime.core().resume();
|
||||
});
|
||||
}
|
||||
{
|
||||
window
|
||||
.global::<DacWizardActions>()
|
||||
|
||||
Reference in new issue
Block a user