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.

101 lines
2.7KB

  1. /*
  2. * Carla Native Plugins
  3. * Copyright (C) 2012-2013 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 "CarlaNative.h"
  18. #include "CarlaMIDI.h"
  19. // -----------------------------------------------------------------------
  20. static PluginHandle midiThrough_instantiate(const HostDescriptor* host)
  21. {
  22. // use HostDescriptor as PluginHandle
  23. return (PluginHandle)host;
  24. }
  25. static void midiThrough_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount)
  26. {
  27. const HostDescriptor* const host = (const HostDescriptor*)handle;
  28. for (uint32_t i=0; i < midiEventCount; ++i)
  29. host->write_midi_event(host->handle, &midiEvents[i]);
  30. return;
  31. // unused
  32. (void)inBuffer;
  33. (void)outBuffer;
  34. (void)frames;
  35. }
  36. // -----------------------------------------------------------------------
  37. static const PluginDescriptor midiThroughDesc = {
  38. .category = PLUGIN_CATEGORY_UTILITY,
  39. .hints = PLUGIN_IS_RTSAFE,
  40. .supports = PLUGIN_SUPPORTS_EVERYTHING,
  41. .audioIns = 0,
  42. .audioOuts = 0,
  43. .midiIns = 1,
  44. .midiOuts = 1,
  45. .paramIns = 0,
  46. .paramOuts = 0,
  47. .name = "MIDI Through",
  48. .label = "midiThrough",
  49. .maker = "falkTX",
  50. .copyright = "GNU GPL v2+",
  51. .instantiate = midiThrough_instantiate,
  52. .cleanup = NULL,
  53. .get_parameter_count = NULL,
  54. .get_parameter_info = NULL,
  55. .get_parameter_value = NULL,
  56. .get_parameter_text = NULL,
  57. .get_midi_program_count = NULL,
  58. .get_midi_program_info = NULL,
  59. .set_parameter_value = NULL,
  60. .set_midi_program = NULL,
  61. .set_custom_data = NULL,
  62. .ui_show = NULL,
  63. .ui_idle = NULL,
  64. .ui_set_parameter_value = NULL,
  65. .ui_set_midi_program = NULL,
  66. .ui_set_custom_data = NULL,
  67. .activate = NULL,
  68. .deactivate = NULL,
  69. .process = midiThrough_process,
  70. .get_state = NULL,
  71. .set_state = NULL,
  72. .dispatcher = NULL
  73. };
  74. // -----------------------------------------------------------------------
  75. void carla_register_native_plugin_midiThrough()
  76. {
  77. carla_register_native_plugin(&midiThroughDesc);
  78. }
  79. // -----------------------------------------------------------------------