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.

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