Snack_CreateFilterType - define new filter type


#include <snack.h>


Snack_FilterType *filterType

struct Snack_FilterType {
  char               *name;
  createProc    *createProc;
  configProc     *configProc;
  startProc       *startProc;
  flowProc        *flowProc;
  freeProc         *freeProc;
  struct Snack_FilterType *nextPtr;
} Snack_FilterType;

char *name

Snack_Filter createProc (Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])

int configProc (Snack_Filter f, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])

int startProc (Snack_Filter f, Snack_StreamInfo si)

int flowProc (Snack_Filter f, Snack_StreamInfo si, float *inBuffer, float *outBuffer, int *inFrames, int *outFrames)

void freeProc (Snack_Filter f)


Snack_CreateFilterType is used to define a new kind of filter type. Everything regarding filters is still under development. The source code itself is currently the only source of information.

Some helpful notes on the current implementation:

inFrames specifies how many samples exist in inBuffer. This value can be modified to specify how many samples were actually consumed.

outFrames is an upper bound on how many samples that may be written to outBuffer.

flowProc should start to drain out any samples as soon as inFrames < outFrames.

If the return value of outFrames is less than the original, the procedure will not be called again. Internal clean-up can be performed in this case.

The parameters inBuffer and outBuffer may point to the same memory. In some cases it might be neccessary to make local copies of samples during calculations.

configProc can be called at any time.

inBuffer can be NULL if inSize is 0.