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.

notes.cpp 3.6KB

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