valentine

Terminal control panel for the Focusrite Scarlett 18i20 — a from-scratch replacement for Focusrite Control.
Log | Files | Refs | README | LICENSE

adatverify.rs (2256B)


      1 //! Fresh-read ADAT routing verifier. Opens the device, reads routing, prints
      2 //! what ACTUALLY feeds each ADAT output — no writes at all. Run this AFTER
      3 //! `adatset -- -80` (in a separate process) to see whether the device truly
      4 //! accepted ADAT Out ← Mix, or silently kept ADAT Out ← PCM.
      5 //!
      6 //!   cargo run -p spike --bin adatverify
      7 
      8 use scarlett_core::model::S18I20_GEN3;
      9 use scarlett_core::mux::{id_to_num, num_dsts, num_to_id, Dir, MuxState, PORT_COUNT_18I20_GEN3};
     10 use scarlett_core::ports::source_name;
     11 use scarlett_core::{Scarlett, UsbTransport};
     12 
     13 fn main() {
     14     if let Err(e) = run() {
     15         eprintln!("\x1b[31mADATVERIFY FAILED:\x1b[0m {e}");
     16         std::process::exit(1);
     17     }
     18 }
     19 
     20 fn run() -> Result<(), Box<dyn std::error::Error>> {
     21     let mut dev = Scarlett::new(UsbTransport::open_default()?);
     22     dev.init()?;
     23     let pc = PORT_COUNT_18I20_GEN3;
     24     let entries = dev.get_mux(num_dsts(&pc))?;
     25     let st = MuxState::from_entries(pc, &entries);
     26 
     27     println!("FRESH read — what actually feeds each ADAT output:");
     28     let mut via_mix = 0;
     29     for i in 0..8u16 {
     30         let out = id_to_num(&pc, Dir::Out, 0x200 + i).unwrap_or(0);
     31         let src_hw = num_to_id(&pc, Dir::In, st.get(out));
     32         let is_mix = (src_hw & 0xf00) == 0x300;
     33         if is_mix {
     34             via_mix += 1;
     35         }
     36         println!("  ADAT Out {} ← {}", i + 1, source_name(src_hw));
     37     }
     38     println!(
     39         "\n{}/8 ADAT outs via mixer.\n{}",
     40         via_mix,
     41         if via_mix == 8 {
     42             "Device DID accept ADAT←Mix. So if -80 still played, the Mix bus itself\n\
     43              is NOT attenuating — the mixer isn't in the ADAT signal path as assumed."
     44         } else if via_mix == 0 {
     45             "Device kept ADAT←PCM despite the write 'succeeding' — the route write is\n\
     46              NOT taking on ADAT outputs (the bug). Our get_mux read back our own\n\
     47              optimistic value earlier; the device never applied it."
     48         } else {
     49             "Partial — some ADAT outs took the route, some didn't."
     50         }
     51     );
     52 
     53     // Also show the meter so we can see if ADAT-feeding PCM is even active.
     54     println!("\n(For reference, this is read-only — no writes made.)");
     55     let _ = S18I20_GEN3.name;
     56     Ok(())
     57 }