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.

130 lines
3.8KB

  1. /*
  2. * Carla Native Plugins
  3. * Copyright (C) 2012-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 "CarlaDefines.h"
  18. #include "CarlaNativeExtUI.hpp"
  19. // -----------------------------------------------------------------------
  20. class NotesPlugin : public NativePluginAndUiClass
  21. {
  22. public:
  23. NotesPlugin(const NativeHostDescriptor* const host)
  24. : NativePluginAndUiClass(host, "notes-ui"),
  25. fCurPage(1),
  26. leakDetector_NotesPlugin() {}
  27. protected:
  28. // -------------------------------------------------------------------
  29. // Plugin parameter calls
  30. uint32_t getParameterCount() const override
  31. {
  32. return 1;
  33. }
  34. const NativeParameter* getParameterInfo(const uint32_t index) const override
  35. {
  36. if (index != 0)
  37. return nullptr;
  38. static NativeParameter param;
  39. param.hints = static_cast<NativeParameterHints>(NATIVE_PARAMETER_IS_ENABLED
  40. |NATIVE_PARAMETER_IS_AUTOMABLE
  41. |NATIVE_PARAMETER_IS_INTEGER);
  42. param.name = "Page";
  43. param.unit = nullptr;
  44. param.ranges.def = 1.0f;
  45. param.ranges.min = 1.0f;
  46. param.ranges.max = 100.0f;
  47. param.ranges.step = 1.0f;
  48. param.ranges.stepSmall = 1.0f;
  49. param.ranges.stepLarge = 1.0f;
  50. param.scalePointCount = 0;
  51. param.scalePoints = nullptr;
  52. return &param;
  53. }
  54. float getParameterValue(const uint32_t index) const override
  55. {
  56. if (index != 0)
  57. return 0.0f;
  58. return static_cast<float>(fCurPage);
  59. }
  60. // -------------------------------------------------------------------
  61. // Plugin state calls
  62. void setParameterValue(const uint32_t index, const float value) override
  63. {
  64. if (index != 0)
  65. return;
  66. fCurPage = static_cast<int>(value);
  67. }
  68. // -------------------------------------------------------------------
  69. // Plugin process calls
  70. void process(float**, float**, const uint32_t, const NativeMidiEvent* const, const uint32_t) override
  71. {
  72. }
  73. private:
  74. int fCurPage;
  75. PluginClassEND(NotesPlugin)
  76. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(NotesPlugin)
  77. };
  78. // -----------------------------------------------------------------------
  79. static const NativePluginDescriptor notesDesc = {
  80. /* category */ NATIVE_PLUGIN_CATEGORY_UTILITY,
  81. /* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE
  82. |NATIVE_PLUGIN_HAS_UI),
  83. /* supports */ static_cast<NativePluginSupports>(0x0),
  84. /* audioIns */ 0,
  85. /* audioOuts */ 0,
  86. /* midiIns */ 0,
  87. /* midiOuts */ 0,
  88. /* paramIns */ 1,
  89. /* paramOuts */ 0,
  90. /* name */ "Notes",
  91. /* label */ "notes",
  92. /* maker */ "falkTX",
  93. /* copyright */ "GNU GPL v2+",
  94. PluginDescriptorFILL(NotesPlugin)
  95. };
  96. // -----------------------------------------------------------------------
  97. CARLA_EXPORT
  98. void carla_register_native_plugin_notes();
  99. CARLA_EXPORT
  100. void carla_register_native_plugin_notes()
  101. {
  102. carla_register_native_plugin(&notesDesc);
  103. }
  104. // -----------------------------------------------------------------------