DISTRHO Plugin Framework
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
4.2KB

  1. /*
  2. * DISTRHO Plugin Framework (DPF)
  3. * Copyright (C) 2012-2019 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any purpose with
  6. * or without fee is hereby granted, provided that the above copyright notice and this
  7. * permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
  10. * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
  11. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  12. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
  13. * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #include "DistrhoPlugin.hpp"
  17. START_NAMESPACE_DISTRHO
  18. // -----------------------------------------------------------------------------------------------------------
  19. class MidiKeyboardExamplePlugin : public Plugin
  20. {
  21. public:
  22. MidiKeyboardExamplePlugin()
  23. : Plugin(0, 0, 0) {}
  24. protected:
  25. /* --------------------------------------------------------------------------------------------------------
  26. * Information */
  27. /**
  28. Get the plugin label.
  29. This label is a short restricted name consisting of only _, a-z, A-Z and 0-9 characters.
  30. */
  31. const char* getLabel() const override
  32. {
  33. return "MidiKeyboard";
  34. }
  35. /**
  36. Get an extensive comment/description about the plugin.
  37. */
  38. const char* getDescription() const override
  39. {
  40. return "Plugin that demonstrates how to make a MIDI keyboard widget using DPF.";
  41. }
  42. /**
  43. Get the plugin author/maker.
  44. */
  45. const char* getMaker() const override
  46. {
  47. return "DISTRHO";
  48. }
  49. /**
  50. Get the plugin homepage.
  51. */
  52. const char* getHomePage() const override
  53. {
  54. return "https://github.com/DISTRHO/DPF";
  55. }
  56. /**
  57. Get the plugin license name (a single line of text).
  58. For commercial plugins this should return some short copyright information.
  59. */
  60. const char* getLicense() const override
  61. {
  62. return "ISC";
  63. }
  64. /**
  65. Get the plugin version, in hexadecimal.
  66. */
  67. uint32_t getVersion() const override
  68. {
  69. return d_version(1, 0, 0);
  70. }
  71. /**
  72. Get the plugin unique Id.
  73. This value is used by LADSPA, DSSI and VST plugin formats.
  74. */
  75. int64_t getUniqueId() const override
  76. {
  77. return d_cconst('d', 'M', 'k', 'e');
  78. }
  79. /* --------------------------------------------------------------------------------------------------------
  80. * Init and Internal data, unused in this plugin */
  81. void initParameter(uint32_t, Parameter&) override {}
  82. float getParameterValue(uint32_t) const override { return 0.0f;}
  83. void setParameterValue(uint32_t, float) override {}
  84. /* --------------------------------------------------------------------------------------------------------
  85. * Audio/MIDI Processing */
  86. /**
  87. Run/process function for plugins with MIDI input.
  88. In this case we just pass-through all MIDI events.
  89. */
  90. void run(const float**, float**, uint32_t,
  91. const MidiEvent* midiEvents, uint32_t midiEventCount) override
  92. {
  93. for (uint32_t i=0; i<midiEventCount; ++i)
  94. writeMidiEvent(midiEvents[i]);
  95. }
  96. // -------------------------------------------------------------------------------------------------------
  97. private:
  98. /**
  99. Set our plugin class as non-copyable and add a leak detector just in case.
  100. */
  101. DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MidiKeyboardExamplePlugin)
  102. };
  103. /* ------------------------------------------------------------------------------------------------------------
  104. * Plugin entry point, called by DPF to create a new plugin instance. */
  105. Plugin* createPlugin()
  106. {
  107. return new MidiKeyboardExamplePlugin();
  108. }
  109. // -----------------------------------------------------------------------------------------------------------
  110. END_NAMESPACE_DISTRHO