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.

93 lines
1.8KB

  1. /*************************************************************************************
  2. * Original code copyright (C) 2012 Steve Folta
  3. * Converted to Juce module (C) 2016 Leo Olivers
  4. * Forked from https://github.com/stevefolta/SFZero
  5. * For license info please see the LICENSE file distributed with this source code
  6. *************************************************************************************/
  7. #ifndef SFZREGION_H_INCLUDED
  8. #define SFZREGION_H_INCLUDED
  9. #include "SFZCommon.h"
  10. #include "water/text/String.h"
  11. namespace sfzero
  12. {
  13. class Sample;
  14. // Region is designed to be able to be bitwise-copied.
  15. struct EGParameters
  16. {
  17. float delay, start, attack, hold, decay, sustain, release;
  18. void clear();
  19. void clearMod();
  20. };
  21. struct Region
  22. {
  23. enum Trigger
  24. {
  25. attack,
  26. release,
  27. first,
  28. legato
  29. };
  30. enum LoopMode
  31. {
  32. sample_loop,
  33. no_loop,
  34. one_shot,
  35. loop_continuous,
  36. loop_sustain
  37. };
  38. enum OffMode
  39. {
  40. fast,
  41. normal
  42. };
  43. Region();
  44. void clear();
  45. water::String dump();
  46. bool matches(int note, int velocity, Trigger trig)
  47. {
  48. return (note >= lokey && note <= hikey && velocity >= lovel && velocity <= hivel &&
  49. (trig == this->trigger || (this->trigger == attack && (trig == first || trig == legato))));
  50. }
  51. Sample *sample;
  52. int lokey, hikey;
  53. int lovel, hivel;
  54. Trigger trigger;
  55. int group;
  56. water::int64 off_by;
  57. OffMode off_mode;
  58. water::int64 offset;
  59. water::int64 end;
  60. bool negative_end;
  61. LoopMode loop_mode;
  62. water::int64 loop_start, loop_end;
  63. int transpose;
  64. int tune;
  65. int pitch_keycenter, pitch_keytrack;
  66. int bend_up, bend_down;
  67. float volume, pan;
  68. float amp_veltrack;
  69. EGParameters ampeg, ampeg_veltrack;
  70. static float timecents2Secs(int timecents);
  71. };
  72. }
  73. #endif // SFZREGION_H_INCLUDED