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.

97 lines
2.5KB

  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 GPL.txt file
  16. */
  17. #include "CarlaPluginInternal.hpp"
  18. #ifdef WANT_VST3
  19. //#include "CarlaVstUtils.hpp"
  20. CARLA_BACKEND_START_NAMESPACE
  21. class Vst3Plugin : public CarlaPlugin
  22. {
  23. public:
  24. Vst3Plugin(CarlaEngine* const engine, const unsigned short id)
  25. : CarlaPlugin(engine, id)
  26. {
  27. carla_debug("Vst3Plugin::Vst3Plugin(%p, %i)", engine, id);
  28. }
  29. ~Vst3Plugin() override
  30. {
  31. carla_debug("Vst3Plugin::~Vst3Plugin()");
  32. kData->singleMutex.lock();
  33. kData->masterMutex.lock();
  34. if (kData->client != nullptr && kData->client->isActive())
  35. kData->client->deactivate();
  36. }
  37. // -------------------------------------------------------------------
  38. // Information (base)
  39. PluginType type() const override
  40. {
  41. return PLUGIN_VST3;
  42. }
  43. private:
  44. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Vst3Plugin)
  45. };
  46. CARLA_BACKEND_END_NAMESPACE
  47. #else // WANT_VST3
  48. // no point on warning when the plugin doesn't even work yet
  49. // # warning Building without VST3 support
  50. #endif
  51. CARLA_BACKEND_START_NAMESPACE
  52. CarlaPlugin* CarlaPlugin::newVST3(const Initializer& init)
  53. {
  54. carla_debug("CarlaPlugin::newVST3(%p, \"%s\", \"%s\", \"%s\")", init.engine, init.filename, init.name, init.label);
  55. #ifdef WANT_VST3
  56. Vst3Plugin* const plugin = new Vst3Plugin(init.engine, init.id);
  57. //if (! plugin->init(init.filename, init.name, init.label))
  58. {
  59. delete plugin;
  60. return nullptr;
  61. }
  62. plugin->reload();
  63. if (init.engine->getProccessMode() == PROCESS_MODE_CONTINUOUS_RACK && ! CarlaPluginProtectedData::canRunInRack(plugin))
  64. {
  65. init.engine->setLastError("Carla's rack mode can only work with Stereo VST3 plugins, sorry!");
  66. delete plugin;
  67. return nullptr;
  68. }
  69. return plugin;
  70. #else
  71. init.engine->setLastError("VST3 support not available");
  72. return nullptr;
  73. #endif
  74. }
  75. CARLA_BACKEND_END_NAMESPACE