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.

108 lines
2.6KB

  1. /*
  2. * Carla VST Plugin
  3. * Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com>
  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. #include "CarlaPluginInternal.hpp"
  18. #define WANT_CSOUND 1
  19. #ifdef WANT_CSOUND
  20. //#include "CarlaVstUtils.hpp"
  21. CARLA_BACKEND_START_NAMESPACE
  22. #if 0
  23. }
  24. #endif
  25. class CsoundPlugin : public CarlaPlugin
  26. {
  27. public:
  28. CsoundPlugin(CarlaEngine* const engine, const unsigned short id)
  29. : CarlaPlugin(engine, id)
  30. {
  31. carla_debug("CsoundPlugin::CsoundPlugin(%p, %i)", engine, id);
  32. }
  33. ~CsoundPlugin() override
  34. {
  35. carla_debug("CsoundPlugin::~CsoundPlugin()");
  36. pData->singleMutex.lock();
  37. pData->masterMutex.lock();
  38. if (pData->client != nullptr && pData->client->isActive())
  39. pData->client->deactivate();
  40. }
  41. // -------------------------------------------------------------------
  42. // Information (base)
  43. PluginType getType() const noexcept override
  44. {
  45. return PLUGIN_CSOUND;
  46. }
  47. void reload() override
  48. {
  49. }
  50. void process(float** const inBuffer, float** const outBuffer, const uint32_t frames) override
  51. {
  52. }
  53. private:
  54. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CsoundPlugin)
  55. };
  56. CARLA_BACKEND_END_NAMESPACE
  57. #endif
  58. CARLA_BACKEND_START_NAMESPACE
  59. CarlaPlugin* CarlaPlugin::newCSOUND(const Initializer& init)
  60. {
  61. carla_debug("CarlaPlugin::newCsound(%p, \"%s\", \"%s\", \"%s\")", init.engine, init.filename, init.name, init.label);
  62. #ifdef WANT_CSOUND
  63. CsoundPlugin* const plugin(new CsoundPlugin(init.engine, init.id));
  64. //if (! plugin->init(init.filename, init.name, init.label))
  65. {
  66. delete plugin;
  67. return nullptr;
  68. }
  69. plugin->reload();
  70. if (init.engine->getProccessMode() == PROCESS_MODE_CONTINUOUS_RACK && ! plugin->canRunInRack())
  71. {
  72. init.engine->setLastError("Carla's rack mode can only work with Stereo VST3 plugins, sorry!");
  73. delete plugin;
  74. return nullptr;
  75. }
  76. return plugin;
  77. #else
  78. init.engine->setLastError("VST3 support not available");
  79. return nullptr;
  80. #endif
  81. }
  82. CARLA_BACKEND_END_NAMESPACE