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.

ansi-pedantic-test.c 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*
  2. * ANSI pedantic test for the Carla Backend & Host API
  3. * Copyright (C) 2013-2014 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 "CarlaBackend.h"
  18. #include "CarlaHost.h"
  19. #include "CarlaNative.h"
  20. #include "CarlaMIDI.h"
  21. #ifdef __cplusplus
  22. # include "CarlaEngine.hpp"
  23. # include "CarlaPlugin.hpp"
  24. # include <cassert>
  25. # include <cstdio>
  26. # ifdef CARLA_PROPER_CPP11_SUPPORT
  27. # undef NULL
  28. # define NULL nullptr
  29. # endif
  30. #else
  31. # include <assert.h>
  32. # include <stdio.h>
  33. #endif
  34. int main(int argc, char* argv[])
  35. {
  36. #ifdef __cplusplus
  37. CARLA_BACKEND_USE_NAMESPACE
  38. #endif
  39. ParameterData a;
  40. ParameterRanges b;
  41. MidiProgramData c;
  42. CustomData d;
  43. EngineDriverDeviceInfo e;
  44. CarlaPluginInfo f;
  45. CarlaCachedPluginInfo g;
  46. CarlaPortCountInfo h;
  47. CarlaParameterInfo i;
  48. CarlaScalePointInfo j;
  49. CarlaTransportInfo k;
  50. const char* licenseText;
  51. const char* fileExtensions;
  52. uint l, count;
  53. licenseText = carla_get_complete_license_text();
  54. printf("LICENSE:\n%s\n", licenseText);
  55. fileExtensions = carla_get_supported_file_extensions();
  56. printf("FILE EXTENSIONS:\n%s\n", fileExtensions);
  57. count = carla_get_engine_driver_count();
  58. printf("DRIVER COUNT: %i\n", count);
  59. for (l=0; l < count; ++l)
  60. {
  61. const char* driverName;
  62. const char* const* driverDeviceNames;
  63. uint m, count2;
  64. driverName = carla_get_engine_driver_name(l);
  65. driverDeviceNames = carla_get_engine_driver_device_names(l);
  66. printf("DRIVER %i/%i: \"%s\" : DEVICES:\n", l+1, count, driverName);
  67. count2 = 0;
  68. while (driverDeviceNames[count2] != NULL)
  69. ++count2;
  70. for (m = 0; m < count2; ++m)
  71. {
  72. printf("DRIVER DEVICE %i/%i: \"%s\"\n", m+1, count2, driverDeviceNames[m]);
  73. }
  74. }
  75. if (carla_engine_init("JACK", "ansi-test"))
  76. {
  77. #ifdef __cplusplus
  78. CarlaEngine* const engine(carla_get_engine());
  79. assert(engine != nullptr);
  80. engine->getLastError();
  81. #endif
  82. if (carla_add_plugin(BINARY_NATIVE, PLUGIN_INTERNAL, NULL, NULL, "audiofile", 0, NULL))
  83. {
  84. #ifdef __cplusplus
  85. CarlaPlugin* const plugin(engine->getPlugin(0));
  86. assert(plugin != nullptr);
  87. plugin->getId();
  88. #endif
  89. carla_set_custom_data(0, CUSTOM_DATA_TYPE_STRING, "file", "/home/falktx/Music/test.wav");
  90. carla_transport_play();
  91. }
  92. else
  93. {
  94. printf("%s\n", carla_get_last_error());
  95. }
  96. #ifdef __cplusplus
  97. engine->setAboutToClose();
  98. #endif
  99. carla_engine_close();
  100. }
  101. #ifdef __cplusplus
  102. EngineControlEvent e1;
  103. EngineMidiEvent e2;
  104. EngineEvent e3;
  105. e3.fillFromMidiData(0, nullptr);
  106. EngineOptions e4;
  107. EngineTimeInfoBBT e5;
  108. EngineTimeInfo e6;
  109. #endif
  110. return 0;
  111. /* unused C */
  112. (void)argc;
  113. (void)argv;
  114. (void)a; (void)b; (void)c; (void)d; (void)e;
  115. (void)f; (void)g; (void)h; (void)i; (void)j; (void)k;
  116. #ifdef __cplusplus
  117. (void)e1; (void)e2; (void)e4; (void)e5; (void)e6;
  118. #endif
  119. }