Collection of tools useful for audio production
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.

96 lines
2.1KB

  1. /*
  2. * DISTHRO Plugin Toolkit (DPT)
  3. * Copyright (C) 2012 Filipe Coelho <falktx@gmail.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 license see the GPL.txt file
  16. */
  17. #include "DistrhoPluginInternal.h"
  18. START_NAMESPACE_DISTRHO
  19. // -------------------------------------------------
  20. const d_string PluginInternal::fallbackString;
  21. const ParameterRanges PluginInternal::fallbackRanges;
  22. // -------------------------------------------------
  23. Plugin::Plugin(uint32_t parameterCount, uint32_t programCount, uint32_t stateCount)
  24. {
  25. data = new PluginPrivateData;
  26. if (parameterCount > 0)
  27. {
  28. data->parameterCount = parameterCount;
  29. data->parameters = new Parameter [parameterCount];
  30. }
  31. if (programCount > 0)
  32. {
  33. #if DISTRHO_PLUGIN_WANT_PROGRAMS
  34. data->programCount = programCount;
  35. data->programNames = new d_string [programCount];
  36. #endif
  37. }
  38. if (stateCount > 0)
  39. {
  40. #if DISTRHO_PLUGIN_WANT_STATE
  41. data->stateCount = stateCount;
  42. data->stateKeys = new d_string [stateCount];
  43. #endif
  44. }
  45. }
  46. Plugin::~Plugin()
  47. {
  48. delete data;
  49. }
  50. // -------------------------------------------------
  51. // Host state
  52. uint32_t Plugin::d_bufferSize() const
  53. {
  54. return data->bufferSize;
  55. }
  56. double Plugin::d_sampleRate() const
  57. {
  58. return data->sampleRate;
  59. }
  60. const TimePos* Plugin::d_timePos() const
  61. {
  62. return &data->timePos;
  63. }
  64. #if DISTRHO_PLUGIN_WANT_LATENCY
  65. void Plugin::d_setLatency(uint32_t samples)
  66. {
  67. data->latency = samples;
  68. }
  69. #endif
  70. // -------------------------------------------------
  71. // Callbacks
  72. void Plugin::d_bufferSizeChanged(uint32_t)
  73. {
  74. }
  75. // -------------------------------------------------
  76. END_NAMESPACE_DISTRHO