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 3.3KB

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