I dived into the Pure Data source code, and then into the ALSA library API… There seems to be some confusion this particular function… In short, the ALSA library doc is a tiny bit confusing…
warning: geekery ahead
snd_pcm_delay is supposed to return the latency from the next buffer write to the DAC. But by “return” they mean set a value via a pointer argument. The actual return value of the function is supposed to be an error code.
The actual implementation of
snd_pcm_delay is, of course, delegated to the drivers, and I checked what I could there… all looks fine…
BUT - The error messages are suspicious: The “Unknown error” codes look suspiciously like available buffer size: Each time it decreases by exactly 658. And it’s positive. It doesn’t look like an error code at all (the “Unknown error” message comes from ALSA, which doesn’t recognize it, either!). Furthermore, “astate 3” means things are running, and not in xrun. So, ALSA thinks things are fine.
658 is an odd number of samples: It is almost 15ms at 44,100Hz. But isn’t anything I’d expect to arise from normal settings.
Something is wrong somewhere in a driver…
Can you all run this for me?
dpkg-query -l 'pisound*' 'libasound*'
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
un libasound-dev <none> <none> (no description available)
ii libasound2:armhf 1.1.3-5+rpi3 armhf shared library for ALSA applications
ii libasound2-data 1.1.3-5+rpi3 all Configuration files and profiles for ALSA drivers
ii libasound2-dev:armhf 1.1.3-5+rpi3 armhf shared library for ALSA applications -- development
un libasound2-doc <none> <none> (no description available)
un libasound2-plugin-equal <none> <none> (no description available)
un libasound2-plugins <none> <none> (no description available)
ii pisound 1.03-1 all Pisound meta package.
ii pisound-btn 1.05-5 armhf Pisound Button daemon.
ii pisound-ctl 1.03-1 armhf Bluetooth service for Pisound companion mobile app.
I’m not sure how to query the version of the driver that ends up running the Pisound hardware… @Giedrius?