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.

EnvelopeParams.h 3.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. ZynAddSubFX - a software synthesizer
  3. EnvelopeParams.h - Parameters for Envelope
  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 ENVELOPE_PARAMS_H
  18. #define ENVELOPE_PARAMS_H
  19. #include "../globals.h"
  20. #include "../Misc/XMLwrapper.h"
  21. #include "Presets.h"
  22. class EnvelopeParams:public Presets
  23. {
  24. public:
  25. EnvelopeParams(unsigned char Penvstretch_=64,
  26. unsigned char Pforcedrelease_=0);
  27. ~EnvelopeParams();
  28. void paste(const EnvelopeParams &ep);
  29. void ADSRinit(char A_dt, char D_dt, char S_val, char R_dt);
  30. void ADSRinit_dB(char A_dt, char D_dt, char S_val, char R_dt);
  31. void ASRinit(char A_val, char A_dt, char R_val, char R_dt);
  32. void ADSRinit_filter(char A_val,
  33. char A_dt,
  34. char D_val,
  35. char D_dt,
  36. char R_dt,
  37. char R_val);
  38. void ASRinit_bw(char A_val, char A_dt, char R_val, char R_dt);
  39. void converttofree();
  40. void add2XML(XMLwrapper *xml);
  41. void defaults();
  42. void getfromXML(XMLwrapper *xml);
  43. float getdt(char i) const;
  44. static float dt(char val);
  45. /* MIDI Parameters */
  46. unsigned char Pfreemode; //1 daca este in modul free sau 0 daca este in mod ADSR,ASR,...
  47. unsigned char Penvpoints;
  48. unsigned char Penvsustain; //127 pentru dezactivat
  49. unsigned char Penvdt[MAX_ENVELOPE_POINTS];
  50. unsigned char Penvval[MAX_ENVELOPE_POINTS];
  51. unsigned char Penvstretch; //64=normal stretch (piano-like), 0=no stretch
  52. unsigned char Pforcedrelease; //0 - OFF, 1 - ON
  53. unsigned char Plinearenvelope; //if the amplitude envelope is linear
  54. unsigned char PA_dt, PD_dt, PR_dt,
  55. PA_val, PD_val, PS_val, PR_val;
  56. int Envmode; // 1 for ADSR parameters (linear amplitude)
  57. // 2 for ADSR_dB parameters (dB amplitude)
  58. // 3 for ASR parameters (frequency LFO)
  59. // 4 for ADSR_filter parameters (filter parameters)
  60. // 5 for ASR_bw parameters (bandwidth parameters)
  61. static const rtosc::Ports &ports;
  62. private:
  63. void store2defaults();
  64. /* Default parameters */
  65. unsigned char Denvstretch;
  66. unsigned char Dforcedrelease;
  67. unsigned char Dlinearenvelope;
  68. unsigned char DA_dt, DD_dt, DR_dt,
  69. DA_val, DD_val, DS_val, DR_val;
  70. };
  71. #endif