filter phase delays / Fidlib, MNE-Python
This discussion was created from comments split from: large millivolt data values / FbEEG Full Band EEG.
A well respected lib that is used by BioEra and BrainBay is,

Comments
I'm just going off Jim's documentation below. If you want to see a real example in BrainBay, see ob_filter.cpp in this folder.
Example given in http://uazu.net/fidlib/fidlib.txt ,
FidRun *run;
FidFunc *funcp;
void *fbuf1, *fbuf2;
run= fid_run_new(filt, &funcp);
fbuf1= fid_run_newbuf(run);
fbuf2= fid_run_newbuf(run);
while (...) {
out_1= funcp(fbuf1, in_1);
out_2= funcp(fbuf2, in_2);
if (restart_required) fid_run_zapbuf(fbuf1);
...
}
fid_run_freebuf(fbuf2);
fid_run_freebuf(fbuf1);
fid_run_free(run);
Then for each channel, you setup a new fid_run_newbuf(). This takes the FidRun pointer as arg and returns a void* (opaque data type) for the buffer pointer.
Then as you process each sample point for each channel, you call that FidFunc function pointer with the buffer pointer and the sample.
Each channel needs it's own buffer because that is how digital filters work, they need a history of past activity, basically. It's a feedback process. State is not maintained in the FidRun struct, but instead in the buffers.
> However, it seems the function pointer created by fid_run_new takes a single data point as an argument.
[revision:] sorry, I misunderstood your original comment, various C compilers have differing requirements for strict argument typing on function pointers. I think you just have to work with the compiler requirements you have. If that needs fiddling some declarations, do that.
William