Advertisement
Guest User

Untitled

a guest
Jul 31st, 2015
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. // How annoying the VinnieFalco filters deal with the number of channels as a template parameter :-/
  2. template<typename FiltType>
  3. inline std::shared_ptr<Dsp::Filter> create_filter(int numchans, int smoothlen=512)
  4. {
  5.     if (numchans==1)
  6.         return std::make_shared<Dsp::SmoothedFilterDesign<FiltType, 1>>(smoothlen);
  7.     if (numchans==2)
  8.         return std::make_shared<Dsp::SmoothedFilterDesign<FiltType, 2>>(smoothlen);
  9.     if (numchans==3)
  10.         return std::make_shared<Dsp::SmoothedFilterDesign<FiltType, 3>>(smoothlen);
  11.     if (numchans==4)
  12.         return std::make_shared<Dsp::SmoothedFilterDesign<FiltType, 4>>(smoothlen);
  13.     // **ck it for other channel counts, let's just say 8 is enough
  14.     return std::make_shared<Dsp::SmoothedFilterDesign<FiltType, 8>>(smoothlen);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement