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.

111 lines
3.0KB

  1. /*
  2. * Carla Host Plugin test
  3. * Copyright (C) 2020 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 "CarlaNativePlugin.h"
  18. #include <assert.h>
  19. static uint32_t get_buffer_size(NativeHostHandle h)
  20. {
  21. return 128;
  22. /* unused */
  23. (void)h;
  24. }
  25. static double get_sample_rate(NativeHostHandle h)
  26. {
  27. return 44100.0;
  28. /* unused */
  29. (void)h;
  30. }
  31. static bool is_offline(NativeHostHandle h)
  32. {
  33. return false;
  34. /* unused */
  35. (void)h;
  36. }
  37. static intptr_t dispatcher(NativeHostHandle h, NativeHostDispatcherOpcode c, int32_t i, intptr_t v, void* p, float o)
  38. {
  39. return 0;
  40. /* unused */
  41. (void)h;
  42. (void)c;
  43. (void)i;
  44. (void)v;
  45. (void)p;
  46. (void)o;
  47. }
  48. static const NativeHostDescriptor host_descriptor = {
  49. .resourceDir = "",
  50. .uiName = "",
  51. .get_buffer_size = get_buffer_size,
  52. .get_sample_rate = get_sample_rate,
  53. .is_offline = is_offline,
  54. .dispatcher = dispatcher
  55. };
  56. int main(void)
  57. {
  58. const char* const standalone_filename = carla_standalone_get_library_filename();
  59. assert(standalone_filename != NULL && standalone_filename[0] != '\0');
  60. const char* const utils_filename = carla_utils_get_library_filename();
  61. assert(utils_filename != NULL && utils_filename[0] != '\0');
  62. const char* const standalone_folder = carla_standalone_get_library_folder();
  63. assert(standalone_folder != NULL && standalone_folder[0] != '\0');
  64. const char* const utils_folder = carla_utils_get_library_folder();
  65. assert(utils_folder != NULL && utils_folder[0] != '\0');
  66. /*
  67. carla_juce_init();*/
  68. const NativePluginDescriptor* const rack = carla_get_native_rack_plugin();
  69. assert(rack != NULL);
  70. const NativePluginDescriptor* const patchbay = carla_get_native_patchbay_plugin();
  71. assert(patchbay != NULL);
  72. const NativePluginHandle rack_handle = rack->instantiate(&host_descriptor);
  73. assert(rack_handle != NULL);
  74. const NativePluginHandle patchbay_handle = patchbay->instantiate(&host_descriptor);
  75. assert(patchbay_handle != NULL);
  76. const CarlaHostHandle rack_host_handle = carla_create_native_plugin_host_handle(rack, rack_handle);
  77. assert(rack_host_handle);
  78. const CarlaHostHandle patchbay_host_handle = carla_create_native_plugin_host_handle(patchbay, patchbay_handle);
  79. assert(patchbay_host_handle);
  80. rack->cleanup(patchbay_handle);
  81. rack->cleanup(rack_handle);
  82. carla_host_handle_free(patchbay_host_handle);
  83. carla_host_handle_free(rack_host_handle);
  84. /*
  85. carla_juce_cleanup();*/
  86. return 0;
  87. }