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.

129 lines
3.7KB

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