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.

106 lines
2.3KB

  1. /*
  2. * DISTRHO Plugin Toolkit (DPT)
  3. * Copyright (C) 2012-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 Lesser General Public
  7. * License as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU Lesser General Public License for more details.
  13. *
  14. * For a full copy of the license see the LGPL.txt file
  15. */
  16. #include "DistrhoPluginInternal.hpp"
  17. START_NAMESPACE_DISTRHO
  18. // -------------------------------------------------
  19. // Static data
  20. uint32_t d_lastBufferSize = 0;
  21. double d_lastSampleRate = 0.0;
  22. // -------------------------------------------------
  23. // Static, fallback data
  24. const d_string PluginInternal::sFallbackString;
  25. const ParameterRanges PluginInternal::sFallbackRanges;
  26. // -------------------------------------------------
  27. // Plugin
  28. Plugin::Plugin(uint32_t parameterCount, uint32_t programCount, uint32_t stateCount)
  29. : pData(new PluginPrivateData)
  30. {
  31. if (parameterCount > 0)
  32. {
  33. pData->parameterCount = parameterCount;
  34. pData->parameters = new Parameter[parameterCount];
  35. }
  36. if (programCount > 0)
  37. {
  38. #if DISTRHO_PLUGIN_WANT_PROGRAMS
  39. pData->programCount = programCount;
  40. pData->programNames = new d_string[programCount];
  41. #endif
  42. }
  43. if (stateCount > 0)
  44. {
  45. #if DISTRHO_PLUGIN_WANT_STATE
  46. pData->stateCount = stateCount;
  47. pData->stateKeys = new d_string[stateCount];
  48. #endif
  49. }
  50. }
  51. Plugin::~Plugin()
  52. {
  53. delete pData;
  54. }
  55. // -------------------------------------------------
  56. // Host state
  57. uint32_t Plugin::d_bufferSize() const
  58. {
  59. return pData->bufferSize;
  60. }
  61. double Plugin::d_sampleRate() const
  62. {
  63. return pData->sampleRate;
  64. }
  65. const TimePos& Plugin::d_timePos() const
  66. {
  67. return pData->timePos;
  68. }
  69. #if DISTRHO_PLUGIN_WANT_LATENCY
  70. void Plugin::d_setLatency(uint32_t frames)
  71. {
  72. pData->latency = frames;
  73. }
  74. #endif
  75. // -------------------------------------------------
  76. // Callbacks
  77. void Plugin::d_bufferSizeChanged(uint32_t)
  78. {
  79. }
  80. void Plugin::d_sampleRateChanged(double)
  81. {
  82. }
  83. // -------------------------------------------------
  84. END_NAMESPACE_DISTRHO