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.

old_version.c 2.0KB

9 years ago
9 years ago
9 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. Lilv Test Plugin - Old version
  3. Copyright 2011-2016 David Robillard <d@drobilla.net>
  4. Permission to use, copy, modify, and/or distribute this software for any
  5. purpose with or without fee is hereby granted, provided that the above
  6. copyright notice and this permission notice appear in all copies.
  7. THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  8. WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  9. MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  10. ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  11. WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  12. ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  13. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  14. */
  15. #include <stdlib.h>
  16. #include "lv2/lv2plug.in/ns/lv2core/lv2.h"
  17. #define PLUGIN_URI "http://example.org/versioned"
  18. enum {
  19. TEST_INPUT = 0,
  20. TEST_OUTPUT = 1
  21. };
  22. typedef struct {
  23. float* input;
  24. float* output;
  25. } Test;
  26. static void
  27. cleanup(LV2_Handle instance)
  28. {
  29. free((Test*)instance);
  30. }
  31. static void
  32. connect_port(LV2_Handle instance, uint32_t port, void* data)
  33. {
  34. Test* test = (Test*)instance;
  35. switch (port) {
  36. case TEST_INPUT:
  37. test->input = (float*)data;
  38. break;
  39. case TEST_OUTPUT:
  40. test->output = (float*)data;
  41. break;
  42. default:
  43. break;
  44. }
  45. }
  46. static LV2_Handle
  47. instantiate(const LV2_Descriptor* descriptor,
  48. double rate,
  49. const char* path,
  50. const LV2_Feature* const* features)
  51. {
  52. Test* test = (Test*)calloc(1, sizeof(Test));
  53. if (!test) {
  54. return NULL;
  55. }
  56. return (LV2_Handle)test;
  57. }
  58. static void
  59. run(LV2_Handle instance, uint32_t sample_count)
  60. {
  61. Test* test = (Test*)instance;
  62. *test->output = *test->input;
  63. }
  64. static const LV2_Descriptor descriptor = {
  65. PLUGIN_URI,
  66. instantiate,
  67. connect_port,
  68. NULL, // activate,
  69. run,
  70. NULL, // deactivate,
  71. cleanup,
  72. NULL // extension_data
  73. };
  74. LV2_SYMBOL_EXPORT
  75. const LV2_Descriptor* lv2_descriptor(uint32_t index)
  76. {
  77. return (index == 0) ? &descriptor : NULL;
  78. }