detect_default_source

Function detect_default_source 

Source
fn detect_default_source(host: &Host) -> Option<Device>
Expand description

Pick the best autodetect source for a music visualizer.

Order of preference, mirroring what a user expects after double-clicking the binary while music is already playing:

  1. Monitor of the host’s default output sink (so the visualizer reacts to whatever the user is listening to).
  2. Any other .monitor source (covers headphones-only or USB-DAC setups where the “default” sink is something unexpected).
  3. Host default input (typically the microphone) — preserves the historical behaviour when no monitor source is available (e.g. ALSA without module-loopback).