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.

CsoundPlugin.cpp 2.8KB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. CARLA_SAFE_ASSERT_RETURN(pData->engine != nullptr,);
  50. carla_debug("CsoundPlugin::reload() - start");
  51. bufferSizeChanged(pData->engine->getBufferSize());
  52. reloadPrograms(true);
  53. carla_debug("CsoundPlugin::reload() - end");
  54. }
  55. void process(float** const inBuffer, float** const outBuffer, const uint32_t frames) override
  56. {
  57. }
  58. private:
  59. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CsoundPlugin)
  60. };
  61. CARLA_BACKEND_END_NAMESPACE
  62. #endif
  63. CARLA_BACKEND_START_NAMESPACE
  64. CarlaPlugin* CarlaPlugin::newCSOUND(const Initializer& init)
  65. {
  66. carla_debug("CarlaPlugin::newCsound(%p, \"%s\", \"%s\", \"%s\")", init.engine, init.filename, init.name, init.label);
  67. #ifdef WANT_CSOUND
  68. CsoundPlugin* const plugin(new CsoundPlugin(init.engine, init.id));
  69. //if (! plugin->init(init.filename, init.name, init.label))
  70. {
  71. delete plugin;
  72. return nullptr;
  73. }
  74. plugin->reload();
  75. if (init.engine->getProccessMode() == ENGINE_PROCESS_MODE_CONTINUOUS_RACK && ! plugin->canRunInRack())
  76. {
  77. init.engine->setLastError("Carla's rack mode can only work with Stereo VST3 plugins, sorry!");
  78. delete plugin;
  79. return nullptr;
  80. }
  81. return plugin;
  82. #else
  83. init.engine->setLastError("VST3 support not available");
  84. return nullptr;
  85. #endif
  86. }
  87. CARLA_BACKEND_END_NAMESPACE