libcm is a C development framework with an emphasis on audio signal processing applications.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef cmProc5_h
  2. #define cmProc5_h
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. //=======================================================================================================================
  7. // Goertzel Filter
  8. //
  9. typedef struct
  10. {
  11. double s0;
  12. double s1;
  13. double s2;
  14. double coeff;
  15. double hz;
  16. } cmGoertzelCh;
  17. struct cmShiftBuf_str;
  18. typedef struct cmGoertzel_str
  19. {
  20. cmObj obj;
  21. cmGoertzelCh* ch;
  22. unsigned chCnt;
  23. double srate;
  24. struct cmShiftBuf_str* shb;
  25. cmSample_t* wnd;
  26. } cmGoertzel;
  27. cmGoertzel* cmGoertzelAlloc( cmCtx* c, cmGoertzel* p, double srate, const double* fcHzV, unsigned chCnt, unsigned procSmpCnt, unsigned hopSmpCnt, unsigned wndSmpCnt );
  28. cmRC_t cmGoertzelFree( cmGoertzel** pp );
  29. cmRC_t cmGoertzelInit( cmGoertzel* p, double srate, const double* fcHzV, unsigned chCnt, unsigned procSmpCnt, unsigned hopSmpCnt, unsigned wndSmpCnt );
  30. cmRC_t cmGoertzelFinal( cmGoertzel* p );
  31. cmRC_t cmGoertzelSetFcHz( cmGoertzel* p, unsigned chIdx, double hz );
  32. cmRC_t cmGoertzelExec( cmGoertzel* p, const cmSample_t* in, unsigned procSmpCnt, double* outV, unsigned chCnt );
  33. #ifdef __cplusplus
  34. }
  35. #endif
  36. #endif