Filter, window function and audio signal: how to link them to each other?
Your sample code looks like it is trying to create a windowed Sinc FIR filter.  A Sinc function (the transform of a "brick-wall" rectangle filter) has infinite support, thus it must be windowed to create a finite length FIR filter kernel.  There is pseudo-code to generate such a filter, using a Hamming window, on my DSP web page.

You can apply such a FIR filter to audio by convolution with your audio samples (either directly convolution, or using FFT/IFFT overlap-add/save fast convolution on blocks of data).

If you are using iOS frameworks such as Core Audio, note that you can also use the vDSP_biquadm API in the iOS Accelerate framework for IIR filtering.