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.

EffectMgr.h 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. ZynAddSubFX - a software synthesizer
  3. EffectMgr.h - Effect manager, an interface betwen the program and effects
  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 EFFECTMGR_H
  12. #define EFFECTMGR_H
  13. #include <pthread.h>
  14. #include "../Params/FilterParams.h"
  15. #include "../Params/Presets.h"
  16. namespace zyncarla {
  17. class Effect;
  18. class FilterParams;
  19. class XMLwrapper;
  20. class Allocator;
  21. /** Effect manager, an interface between the program and effects */
  22. class EffectMgr:public Presets
  23. {
  24. public:
  25. EffectMgr(Allocator &alloc, const SYNTH_T &synth, const bool insertion_,
  26. const AbsTime *time_ = nullptr);
  27. ~EffectMgr();
  28. void paste(EffectMgr &e);
  29. void add2XML(XMLwrapper& xml);
  30. void defaults(void) REALTIME;
  31. void getfromXML(XMLwrapper& xml);
  32. void out(float *smpsl, float *smpsr) REALTIME;
  33. void setdryonly(bool value);
  34. /**get the output(to speakers) volume of the systemeffect*/
  35. float sysefxgetvolume(void);
  36. void init(void) REALTIME;
  37. void kill(void) REALTIME;
  38. void cleanup(void) REALTIME;
  39. void changeeffectrt(int nefx_, bool avoidSmash=false) REALTIME;
  40. void changeeffect(int nefx_) NONREALTIME;
  41. int geteffect(void);
  42. void changepreset(unsigned char npreset) NONREALTIME;
  43. void changepresetrt(unsigned char npreset, bool avoidSmash=false) REALTIME;
  44. unsigned char getpreset(void);
  45. void seteffectpar(int npar, unsigned char value) NONREALTIME;
  46. void seteffectparrt(int npar, unsigned char value) REALTIME;
  47. unsigned char geteffectpar(int npar);
  48. unsigned char geteffectparrt(int npar) REALTIME;
  49. const bool insertion;
  50. float *efxoutl, *efxoutr;
  51. // used by UI
  52. float getEQfreqresponse(float freq);
  53. FilterParams *filterpars;
  54. static const rtosc::Ports &ports;
  55. int nefx;
  56. Effect *efx;
  57. const AbsTime *time;
  58. private:
  59. //Parameters Prior to initialization
  60. char preset;
  61. /**
  62. * When loading an effect from XML the child effect cannot be loaded
  63. * directly as it would require access to the realtime memory pool,
  64. * which cannot be done outside of the realtime thread.
  65. * Therefore, parameters are loaded to this array which can then be used
  66. * to construct the full effect (via init()) once the object is in the
  67. * realtime context.
  68. *
  69. * Additionally this structure is used in the case of pasting effects as
  70. * pasted effect object are *not* fully initialized when they're put on
  71. * the middleware -> backend ringbuffer, but settings has the values
  72. * loaded from the XML serialization.
  73. * The settings values can be pasted once they're on the realtime thread
  74. * and then they can be applied.
  75. *
  76. * The requirement that the realtime memory pool is used to create the
  77. * effect is in place as it is possible to change the effect type in the
  78. * realtime thread and thus the new effect would draw from the realtime
  79. * memory pool and the old object would be expected to be freed to the
  80. * realtime memory pool.
  81. *
  82. * See also: PresetExtractor.cpp
  83. */
  84. char settings[128];
  85. bool dryonly;
  86. Allocator &memory;
  87. const SYNTH_T &synth;
  88. };
  89. }
  90. #endif