Audio plugin host https://kx.studio/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.

122 lines
3.5KB

  1. /*
  2. ZynAddSubFX - a software synthesizer
  3. PADnote.h - The "pad" synthesizer
  4. Copyright (C) 2002-2005 Nasca Octavian Paul
  5. Author: Nasca Octavian Paul
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of version 2 of the GNU General Public License
  8. as published by the Free Software Foundation.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License (version 2 or later) for more details.
  13. You should have received a copy of the GNU General Public License (version 2)
  14. along with this program; if not, write to the Free Software Foundation,
  15. Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. */
  17. #ifndef PAD_NOTE_H
  18. #define PAD_NOTE_H
  19. #include "SynthNote.h"
  20. #include "../globals.h"
  21. #include "../Params/PADnoteParameters.h"
  22. #include "../Params/Controller.h"
  23. #include "Envelope.h"
  24. #include "LFO.h"
  25. #include "../Params/Controller.h"
  26. /**The "pad" synthesizer*/
  27. class PADnote:public SynthNote
  28. {
  29. public:
  30. PADnote(PADnoteParameters *parameters,
  31. Controller *ctl_,
  32. float freq,
  33. float velocity,
  34. int portamento_,
  35. int midinote,
  36. bool besilent);
  37. ~PADnote();
  38. void legatonote(float freq, float velocity, int portamento_,
  39. int midinote, bool externcall);
  40. int noteout(float *outl, float *outr);
  41. int finished() const;
  42. void relasekey();
  43. private:
  44. void setup(float freq, float velocity, int portamento_,
  45. int midinote, bool legato = false);
  46. void fadein(float *smps);
  47. void computecurrentparameters();
  48. bool finished_;
  49. PADnoteParameters *pars;
  50. int poshi_l, poshi_r;
  51. float poslo;
  52. float basefreq;
  53. bool firsttime, released;
  54. int nsample, portamento;
  55. int Compute_Linear(float *outl,
  56. float *outr,
  57. int freqhi,
  58. float freqlo);
  59. int Compute_Cubic(float *outl,
  60. float *outr,
  61. int freqhi,
  62. float freqlo);
  63. struct {
  64. /******************************************
  65. * FREQUENCY GLOBAL PARAMETERS *
  66. ******************************************/
  67. float Detune; //cents
  68. Envelope *FreqEnvelope;
  69. LFO *FreqLfo;
  70. /********************************************
  71. * AMPLITUDE GLOBAL PARAMETERS *
  72. ********************************************/
  73. float Volume; // [ 0 .. 1 ]
  74. float Panning; // [ 0 .. 1 ]
  75. Envelope *AmpEnvelope;
  76. LFO *AmpLfo;
  77. struct {
  78. int Enabled;
  79. float initialvalue, dt, t;
  80. } Punch;
  81. /******************************************
  82. * FILTER GLOBAL PARAMETERS *
  83. ******************************************/
  84. class Filter * GlobalFilterL, *GlobalFilterR;
  85. float FilterCenterPitch; //octaves
  86. float FilterQ;
  87. float FilterFreqTracking;
  88. Envelope *FilterEnvelope;
  89. LFO *FilterLfo;
  90. } NoteGlobalPar;
  91. float globaloldamplitude, globalnewamplitude, velocity, realfreq;
  92. Controller *ctl;
  93. };
  94. #endif