DISTRHO Juice Plugins
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.

119 lines
3.1KB

  1. /*
  2. * Trigger Juice Plugin
  3. * Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the doc/GPL.txt file.
  16. */
  17. #ifndef TRIGGERJUICEPLUGIN_HPP_INCLUDED
  18. #define TRIGGERJUICEPLUGIN_HPP_INCLUDED
  19. #include "DistrhoPlugin.hpp"
  20. #include "CStream.hxx"
  21. START_NAMESPACE_DISTRHO
  22. // -----------------------------------------------------------------------
  23. class TriggerJuicePlugin : public Plugin
  24. {
  25. public:
  26. enum Parameters
  27. {
  28. paramAttack = 0,
  29. paramRelease,
  30. paramSplit,
  31. paramRev,
  32. paramMS,
  33. paramCount
  34. };
  35. inline float smoothParameter(float in, int axis) {
  36. sZ[axis] = (in * sB[axis]) + (sZ[axis] * sA[axis]); return sZ[axis];
  37. }
  38. TriggerJuicePlugin();
  39. ~TriggerJuicePlugin() override;
  40. protected:
  41. // -------------------------------------------------------------------
  42. // Information
  43. const char* d_getLabel() const noexcept override
  44. {
  45. return "TriggerJuice";
  46. }
  47. const char* d_getMaker() const noexcept override
  48. {
  49. return "Andre Sklenar";
  50. }
  51. const char* d_getLicense() const noexcept override
  52. {
  53. return "GPL v2+";
  54. }
  55. uint32_t d_getVersion() const noexcept override
  56. {
  57. return 0x1000;
  58. }
  59. long d_getUniqueId() const noexcept override
  60. {
  61. return d_cconst('T', 'r', 'g', 'J');
  62. }
  63. // -------------------------------------------------------------------
  64. // Init
  65. void d_initParameter(uint32_t index, Parameter& parameter) override;
  66. void d_initProgramName(uint32_t index, d_string& programName) override;
  67. // -------------------------------------------------------------------
  68. // Internal data
  69. float d_getParameterValue(uint32_t index) const override;
  70. void d_setParameterValue(uint32_t index, float value) override;
  71. void d_setProgram(uint32_t index) override;
  72. // -------------------------------------------------------------------
  73. // Process
  74. void d_activate() override;
  75. void d_deactivate() override;
  76. void d_run(const float** inputs, float** outputs, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) override;
  77. // -------------------------------------------------------------------
  78. private:
  79. CStream left, right;
  80. float attack, release;
  81. float rev, split, MS;
  82. //parameter smoothing, for subOrbitX and subOrbitY
  83. float sA[2], sB[2], sZ[2];
  84. };
  85. // -----------------------------------------------------------------------
  86. END_NAMESPACE_DISTRHO
  87. #endif // TRIGGERJUICE_HPP_INCLUDED