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.

131 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. #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>(PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE|PARAMETER_IS_INTEGER);
  43. param.name = "Page";
  44. param.unit = nullptr;
  45. param.ranges.def = 1.0f;
  46. param.ranges.min = 1.0f;
  47. param.ranges.max = 100.0f;
  48. param.ranges.step = 1.0f;
  49. param.ranges.stepSmall = 1.0f;
  50. param.ranges.stepLarge = 1.0f;
  51. param.scalePointCount = 0;
  52. param.scalePoints = nullptr;
  53. return &param;
  54. }
  55. float getParameterValue(const uint32_t index) const override
  56. {
  57. if (index != 0)
  58. return 0.0f;
  59. return static_cast<float>(fCurPage);
  60. }
  61. // -------------------------------------------------------------------
  62. // Plugin state calls
  63. void setParameterValue(const uint32_t index, const float value) override
  64. {
  65. if (index != 0)
  66. return;
  67. fCurPage = static_cast<int>(value);
  68. }
  69. // -------------------------------------------------------------------
  70. // Plugin process calls
  71. void process(float**, float**, const uint32_t, const NativeMidiEvent* const, const uint32_t) override
  72. {
  73. }
  74. private:
  75. int fCurPage;
  76. PluginClassEND(NotesPlugin)
  77. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(NotesPlugin)
  78. };
  79. // -----------------------------------------------------------------------
  80. static const NativePluginDescriptor notesDesc = {
  81. /* category */ PLUGIN_CATEGORY_UTILITY,
  82. /* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|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. // -----------------------------------------------------------------------