Collection of tools useful for audio production
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.

190 lines
4.3KB

  1. /*
  2. * Carla Native Plugins
  3. * Copyright (C) 2012 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * 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 COPYING file
  16. */
  17. #include "carla_nativemm.h"
  18. #include <cstring>
  19. class MidiSplitPlugin : public PluginDescriptorClass
  20. {
  21. public:
  22. MidiSplitPlugin() : PluginDescriptorClass()
  23. {
  24. }
  25. MidiSplitPlugin(PluginDescriptorClass* that) : PluginDescriptorClass(that)
  26. {
  27. }
  28. ~MidiSplitPlugin()
  29. {
  30. }
  31. // -------------------------------------------------------------------
  32. protected:
  33. PluginDescriptorClass* createMe()
  34. {
  35. return new MidiSplitPlugin(this);
  36. }
  37. void deleteMe()
  38. {
  39. delete this;
  40. }
  41. // -------------------------------------------------------------------
  42. PluginCategory getCategory()
  43. {
  44. return PLUGIN_CATEGORY_UTILITY;
  45. }
  46. uint32_t getHints()
  47. {
  48. return 0;
  49. }
  50. const char* getName()
  51. {
  52. return "MIDI Split";
  53. }
  54. const char* getLabel()
  55. {
  56. return "midiSplit";
  57. }
  58. const char* getMaker()
  59. {
  60. return "falkTX";
  61. }
  62. const char* getCopyright()
  63. {
  64. return "GNU GPL v2+";
  65. }
  66. // -------------------------------------------------------------------
  67. uint32_t getPortCount()
  68. {
  69. return PORT_MAX;
  70. }
  71. PortType getPortType(uint32_t)
  72. {
  73. return PORT_TYPE_MIDI;
  74. }
  75. uint32_t getPortHints(uint32_t index)
  76. {
  77. return (index == 0) ? 0 : PORT_HINT_IS_OUTPUT;
  78. }
  79. const char* getPortName(const uint32_t index)
  80. {
  81. switch (index)
  82. {
  83. case PORT_INPUT:
  84. return "input";
  85. case PORT_OUTPUT_1:
  86. return "output-01";
  87. case PORT_OUTPUT_2:
  88. return "output-02";
  89. case PORT_OUTPUT_3:
  90. return "output-03";
  91. case PORT_OUTPUT_4:
  92. return "output-04";
  93. case PORT_OUTPUT_5:
  94. return "output-05";
  95. case PORT_OUTPUT_6:
  96. return "output-06";
  97. case PORT_OUTPUT_7:
  98. return "output-07";
  99. case PORT_OUTPUT_8:
  100. return "output-08";
  101. case PORT_OUTPUT_9:
  102. return "output-09";
  103. case PORT_OUTPUT_10:
  104. return "output-10";
  105. case PORT_OUTPUT_11:
  106. return "output-11";
  107. case PORT_OUTPUT_12:
  108. return "output-12";
  109. case PORT_OUTPUT_13:
  110. return "output-13";
  111. case PORT_OUTPUT_14:
  112. return "output-14";
  113. case PORT_OUTPUT_15:
  114. return "output-15";
  115. case PORT_OUTPUT_16:
  116. return "output-16";
  117. default:
  118. return "";
  119. }
  120. }
  121. // -------------------------------------------------------------------
  122. void activate()
  123. {
  124. memset(events, 0, sizeof(MidiEvent) * MAX_MIDI_EVENTS);
  125. }
  126. // -------------------------------------------------------------------
  127. void process(float** inBuffer, float** outBuffer, const uint32_t frames, uint32_t midiEventCount, MidiEvent* midiEvents)
  128. {
  129. Q_UNUSED(inBuffer);
  130. Q_UNUSED(outBuffer);
  131. Q_UNUSED(frames);
  132. }
  133. // -------------------------------------------------------------------
  134. private:
  135. enum Ports {
  136. PORT_INPUT = 0,
  137. PORT_OUTPUT_1,
  138. PORT_OUTPUT_2,
  139. PORT_OUTPUT_3,
  140. PORT_OUTPUT_4,
  141. PORT_OUTPUT_5,
  142. PORT_OUTPUT_6,
  143. PORT_OUTPUT_7,
  144. PORT_OUTPUT_8,
  145. PORT_OUTPUT_9,
  146. PORT_OUTPUT_10,
  147. PORT_OUTPUT_11,
  148. PORT_OUTPUT_12,
  149. PORT_OUTPUT_13,
  150. PORT_OUTPUT_14,
  151. PORT_OUTPUT_15,
  152. PORT_OUTPUT_16,
  153. PORT_MAX
  154. };
  155. static const unsigned short MAX_MIDI_EVENTS = 512;
  156. MidiEvent events[MAX_MIDI_EVENTS];
  157. };
  158. static MidiSplitPlugin midiSplitPlugin;
  159. CARLA_REGISTER_NATIVE_PLUGIN_MM(midiSplit, midiSplitPlugin)