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.

114 lines
2.7KB

  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_native.h"
  18. #include <stdlib.h>
  19. #include <string.h>
  20. enum ByPassPorts {
  21. PORT_IN = 0,
  22. PORT_OUT = 1,
  23. PORT_MAX = 2
  24. };
  25. void bypass_init(struct _PluginDescriptor* _this_)
  26. {
  27. _this_->portCount = PORT_MAX;
  28. _this_->ports = malloc(sizeof(PluginPort) * PORT_MAX);
  29. _this_->ports[PORT_IN].type = PORT_TYPE_AUDIO;
  30. _this_->ports[PORT_IN].hints = 0;
  31. _this_->ports[PORT_IN].name = "in";
  32. _this_->ports[PORT_OUT].type = PORT_TYPE_AUDIO;
  33. _this_->ports[PORT_OUT].hints = PORT_HINT_IS_OUTPUT;
  34. _this_->ports[PORT_OUT].name = "out";
  35. }
  36. void bypass_fini(struct _PluginDescriptor* _this_)
  37. {
  38. free(_this_->ports);
  39. _this_->portCount = 0;
  40. _this_->ports = NULL;
  41. }
  42. PluginHandle bypass_instantiate(struct _PluginDescriptor* _this_, HostDescriptor* host)
  43. {
  44. // dummy, return non-NULL
  45. return (PluginHandle)1;
  46. // unused
  47. (void)_this_;
  48. (void)host;
  49. }
  50. void bypass_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, uint32_t midiEventCount, MidiEvent* midiEvents)
  51. {
  52. float* input1 = inBuffer[0];
  53. float* output1 = outBuffer[0];
  54. memcpy(output1, input1, sizeof(float)*frames);
  55. return;
  56. // unused
  57. (void)handle;
  58. (void)midiEventCount;
  59. (void)midiEvents;
  60. }
  61. static PluginDescriptor bypassDesc = {
  62. .category = PLUGIN_CATEGORY_NONE,
  63. .name = "ByPass",
  64. .label = "bypass",
  65. .maker = "falkTX",
  66. .copyright = "GNU GPL v2+",
  67. .portCount = 0,
  68. .ports = NULL,
  69. .midiProgramCount = 0,
  70. .midiPrograms = NULL,
  71. .instantiate = bypass_instantiate,
  72. .activate = NULL,
  73. .deactivate = NULL,
  74. .cleanup = NULL,
  75. .get_parameter_ranges = NULL,
  76. .get_parameter_value = NULL,
  77. .get_parameter_text = NULL,
  78. .get_parameter_unit = NULL,
  79. .set_parameter_value = NULL,
  80. .set_midi_program = NULL,
  81. .set_custom_data = NULL,
  82. .show_gui = NULL,
  83. .idle_gui = NULL,
  84. .process = bypass_process,
  85. ._singleton = NULL,
  86. ._init = bypass_init,
  87. ._fini = bypass_fini
  88. };
  89. CARLA_REGISTER_NATIVE_PLUGIN(bypass, bypassDesc)