External plugins for Carla
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.

71 lines
2.1KB

  1. /*
  2. ZynAddSubFX - a software synthesizer
  3. ModFilter.h - Modulated Filter
  4. Copyright (C) 2016 Mark McCurry
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License
  7. as published by the Free Software Foundation; either version 2
  8. of the License, or (at your option) any later version.
  9. */
  10. #pragma once
  11. #include "../globals.h"
  12. #include "../Misc/Time.h"
  13. namespace zyncarla {
  14. //Modulated instance of one of the filters in src/DSP/
  15. //Supports stereo modes
  16. class ModFilter
  17. {
  18. public:
  19. ModFilter(const FilterParams &pars,
  20. const SYNTH_T &synth,
  21. const AbsTime &time,
  22. Allocator &alloc,
  23. bool stereo,
  24. float notefreq_);
  25. ~ModFilter(void);
  26. void addMod(LFO &lfo);
  27. void addMod(Envelope &env);
  28. //normal per tick update
  29. void update(float relfreq, float relq);
  30. //updates typically seen in note-init
  31. void updateNoteFreq(float noteFreq_);
  32. void updateSense(float velocity,
  33. uint8_t scale, uint8_t func);
  34. //filter stereo/mono signal(s) in-place
  35. void filter(float *l, float *r);
  36. private:
  37. void paramUpdate(Filter *&f);
  38. void svParamUpdate(SVFilter &sv);
  39. void anParamUpdate(AnalogFilter &an);
  40. const FilterParams &pars; //Parameters to Pull Updates From
  41. const SYNTH_T &synth; //Synthesizer Buffer Parameters
  42. const AbsTime &time; //Time for RT Updates
  43. Allocator &alloc; //RT Memory Pool
  44. float baseQ; //filter sharpness
  45. float baseFreq; //base filter frequency
  46. float noteFreq; //frequency note was initialized to
  47. float tracking; //shift due to note frequency
  48. float sense; //shift due to note velocity
  49. Filter *left; //left channel filter
  50. Filter *right;//right channel filter
  51. Envelope *env; //center freq envelope
  52. LFO *lfo; //center freq lfo
  53. };
  54. }