Hello everyone!
This one has been bugging me for quite a while. I went deep hard in the guts of ALSA to try to solve it, and it turned out to be a minor thing apparently. The problem is old, and every UFX1604 Linux user can attest that it's impossible to use 96000hz in DUPLEX mode without annoying pops and clicks on the capture stream.
The fix is simple: after we alter the CLOCK_SOURCE to match our sample rate, let's tell the CLOCK_SELECTOR we want CLOCK_SOURCE 212 (synced to USB SOF) on pin 1. Solves the problem for me, no more pops and clicks while on 96000hz.
If you own an UFX1604 please give this patch a good testing. Let me know if it solves the pops and clicks on the input stream for you while on DUPLEX 96000hz.
--- clock.c.git 2021-03-22 04:19:55.543485748 -0300 +++ clock.c 2021-03-25 19:23:38.597197159 -0300 @@ -610,6 +610,13 @@ int snd_usb_set_sample_rate_v2v3(struct if (err < 0) return err;
+ if (chip->usb_id == USB_ID(0x1397, 0x0001)) { /* Behringer UFX1604 */ + printk(KERN_WARNING "Setting clock selector for UFX1604"); + err = uac_clock_selector_set_val(chip, 211, 1); + if (err < 0) + return err; + } + return get_sample_rate_v2v3(chip, fmt->iface, fmt->altsetting, clock); }