Cross-Platform build scripts for audio 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.

53 lines
1.3KB

  1. diff --git a/gate.cpp b/gate.cpp
  2. index bfd3135..420392a 100644
  3. --- a/gate.cpp
  4. +++ b/gate.cpp
  5. @@ -27,7 +27,7 @@
  6. #define OPENED 3
  7. #define DECAY 4
  8. -static LV2_Descriptor *gateDescriptor = NULL;
  9. +static LV2_Descriptor gateDescriptor;
  10. class Gate {
  11. public:
  12. @@ -191,28 +191,26 @@ static void cleanupGate(LV2_Handle instance) {
  13. }
  14. static void init() {
  15. -
  16. - gateDescriptor = (LV2_Descriptor *) malloc(sizeof(LV2_Descriptor));
  17. - gateDescriptor->URI = p_uri;
  18. - gateDescriptor->instantiate = instantiateGate;
  19. - gateDescriptor->connect_port = connectPortGate;
  20. - gateDescriptor->activate = NULL;
  21. - gateDescriptor->run = runGate;
  22. - gateDescriptor->deactivate = NULL;
  23. - gateDescriptor->cleanup = cleanupGate;
  24. - gateDescriptor->extension_data = NULL;
  25. + gateDescriptor.URI = p_uri;
  26. + gateDescriptor.instantiate = instantiateGate;
  27. + gateDescriptor.connect_port = connectPortGate;
  28. + gateDescriptor.activate = NULL;
  29. + gateDescriptor.run = runGate;
  30. + gateDescriptor.deactivate = NULL;
  31. + gateDescriptor.cleanup = cleanupGate;
  32. + gateDescriptor.extension_data = NULL;
  33. }
  34. LV2_SYMBOL_EXPORT
  35. const LV2_Descriptor *lv2_descriptor(uint32_t index) {
  36. - if (!gateDescriptor) {
  37. + if (!gateDescriptor.URI) {
  38. init();
  39. }
  40. switch (index) {
  41. case 0:
  42. - return gateDescriptor;
  43. + return &gateDescriptor;
  44. default:
  45. return NULL;
  46. }