Compare a few different C++ implementations of audio-rate signal decimation for relative speed and quality. "Decimation" refers here to downsampling a signal by an integer factor N; we only consider the case where N is a power of two.
The principle is to use a low-pass filter to reduce the bandwidth of the signal to below the Nyquist frequency at the target sample rate (i.e. with the maximum frequency content being below the original rate divided by twice N, for decimation factor N) and then to pick every Nth sample.
This is simple enough, but we have a few different implementations available with different quality and performance tradeoffs.