What kind of filter is used here?
It's part of a feedback loop -- presumably setting the sample rate in some real-time audio thingie, since I see keywords in the code like 'resample' and 'jack' and 'PLAY'.
// Run loop filter and set resample ratio.
So, this tells you what it does!
Elsewhere in the code, err is computed as the timing error between the input stream and the output stream.  So, this is a feedback loop.
_z1 += _w0 * (_w1 * err - _z1);
_z2 += _w0 * (_z1 - _z2);

Low-pass filter the error with a pair of first-order low-pass filters.  (_z1 is err filtered, _z2 is _z1 filtered).  Note that for this to work, _z1 and _z2 need to be persistent.  In C/C++, this means that they should be at least at file scope -- and in my humble opinion, this means they should have longer, descriptive names, even to the point of declareing a struct called &quot;filter_state&quot; -- it never hurts to hand your reader a clue-by-four.
I'm not going to dredge through all the loop analysis, but the cutoff frequencies of these filters should be significantly higher than the target loop bandwidth -- and the loop bandwidth is determined, in part, by the gain of the timing error detection process.  So you can't just slap this into your code willy-nilly.
_z3 += _w2 * _z2;
This is an integrator.
_rcorr = 1 - _z2 - _z3;

if (_rcorr &gt; 1.05) _rcorr = 1.05;
if (_rcorr &lt; 0.95) _rcorr = 0.95;

This does the final calculation of the command variable to the resampler.  Note, however, that we have a controller with an integrator, and we're limiting the output of the integrator, but we're not limiting the state of the integrator.  If you implement this code, search on &quot;integrator anti-windup&quot; for why this is a mistake, and why _z3 should be limited in magnitude, somewhere between $\pm 0$ and $\pm 0.1$, depending on your desired recovery characteristics from a large excursion.
_resamp.set_rratio (_rcorr);
This is actually setting the resample ratio, which in turn affects the value of err in the next iteration of the loop.