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.

85 lines
2.8KB

  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
  7. modify it under the terms of the GNU General Public License
  8. as published by the Free Software Foundation; either version 2
  9. of the License, or (at your option) any later version.
  10. */
  11. #ifndef ENVELOPE_PARAMS_H
  12. #define ENVELOPE_PARAMS_H
  13. #include "../globals.h"
  14. #include "../Misc/XMLwrapper.h"
  15. #include "Presets.h"
  16. class EnvelopeParams:public Presets
  17. {
  18. public:
  19. EnvelopeParams(unsigned char Penvstretch_=64,
  20. unsigned char Pforcedrelease_=0,
  21. const AbsTime *time_ = nullptr);
  22. ~EnvelopeParams();
  23. void paste(const EnvelopeParams &ep);
  24. void ADSRinit(char A_dt, char D_dt, char S_val, char R_dt);
  25. void ADSRinit_dB(char A_dt, char D_dt, char S_val, char R_dt);
  26. void ASRinit(char A_val, char A_dt, char R_val, char R_dt);
  27. void ADSRinit_filter(char A_val,
  28. char A_dt,
  29. char D_val,
  30. char D_dt,
  31. char R_dt,
  32. char R_val);
  33. void ASRinit_bw(char A_val, char A_dt, char R_val, char R_dt);
  34. void converttofree();
  35. void add2XML(XMLwrapper& xml);
  36. void defaults();
  37. void getfromXML(XMLwrapper& xml);
  38. float getdt(char i) const;
  39. static float dt(char val);
  40. /* MIDI Parameters */
  41. unsigned char Pfreemode; //1 for free mode, 0 otherwise
  42. unsigned char Penvpoints;
  43. unsigned char Penvsustain; //127 for disabled
  44. unsigned char Penvdt[MAX_ENVELOPE_POINTS];
  45. unsigned char Penvval[MAX_ENVELOPE_POINTS];
  46. unsigned char Penvstretch; //64=normal stretch (piano-like), 0=no stretch
  47. unsigned char Pforcedrelease; //0 - OFF, 1 - ON
  48. unsigned char Plinearenvelope; //if the amplitude envelope is linear
  49. unsigned char PA_dt, PD_dt, PR_dt,
  50. PA_val, PD_val, PS_val, PR_val;
  51. int Envmode; // 1 for ADSR parameters (linear amplitude)
  52. // 2 for ADSR_dB parameters (dB amplitude)
  53. // 3 for ASR parameters (frequency LFO)
  54. // 4 for ADSR_filter parameters (filter parameters)
  55. // 5 for ASR_bw parameters (bandwidth parameters)
  56. const AbsTime *time;
  57. int64_t last_update_timestamp;
  58. static const rtosc::Ports &ports;
  59. private:
  60. void store2defaults();
  61. /* Default parameters */
  62. unsigned char Denvstretch;
  63. unsigned char Dforcedrelease;
  64. unsigned char Dlinearenvelope;
  65. unsigned char DA_dt, DD_dt, DR_dt,
  66. DA_val, DD_val, DS_val, DR_val;
  67. };
  68. #endif