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.

CarlaUtils2.cpp 4.3KB

10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. * Carla Utility Tests
  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. #ifdef NDEBUG
  18. # error Build this file with debug ON please
  19. #endif
  20. #define VESTIGE_HEADER
  21. #include "CarlaLadspaUtils.hpp"
  22. #include "CarlaDssiUtils.cpp"
  23. #include "CarlaLv2Utils.hpp"
  24. #include "CarlaVstUtils.hpp"
  25. // -----------------------------------------------------------------------
  26. static void test_CarlaLadspaUtils()
  27. {
  28. LADSPA_Descriptor desc;
  29. carla_zeroStruct(desc);
  30. LADSPA_RDF_Descriptor rdfDesc;
  31. delete ladspa_rdf_dup(&rdfDesc);
  32. is_ladspa_port_good(0x0, 0x0);
  33. is_ladspa_rdf_descriptor_valid(&rdfDesc, &desc);
  34. get_default_ladspa_port_value(0x0, -1.0f, 1.0f);
  35. }
  36. // -----------------------------------------------------------------------
  37. static void test_CarlaDssiUtils() noexcept
  38. {
  39. const char* const ui = find_dssi_ui("/usr/lib/dssi/trivial_sampler.so", "aa");
  40. CARLA_SAFE_ASSERT(ui != nullptr);
  41. if (ui != nullptr)
  42. {
  43. carla_stdout("%s", ui);
  44. assert(std::strcmp(ui, "/usr/lib/dssi/trivial_sampler/trivial_sampler_qt") == 0);
  45. delete[] ui;
  46. }
  47. }
  48. // -----------------------------------------------------------------------
  49. static LV2_URID test_lv2_uridMap(LV2_URID_Map_Handle, const char*)
  50. {
  51. return 1;
  52. }
  53. static void test_CarlaLv2Utils()
  54. {
  55. Lv2WorldClass& lv2World(Lv2WorldClass::getInstance());
  56. lv2World.initIfNeeded(std::getenv("LV2_PATH"));
  57. // getPlugin
  58. const LilvPlugin* const plugin(lv2World.getPlugin("urn:juced:DrumSynth"));
  59. CARLA_SAFE_ASSERT(plugin != nullptr);
  60. // getState
  61. LV2_URID_Map uridMap = { nullptr, test_lv2_uridMap };
  62. LilvState* const state(lv2World.getState("http://arcticanaudio.com/plugins/thefunction#preset001", &uridMap));
  63. CARLA_SAFE_ASSERT(state != nullptr);
  64. if (state != nullptr) lilv_state_free(state);
  65. // load a bunch of plugins to stress test lilv
  66. delete lv2_rdf_new("http://arcticanaudio.com/plugins/thefunction", true);
  67. delete lv2_rdf_new("http://kunz.corrupt.ch/products/tal-noisemaker", true);
  68. delete lv2_rdf_new("http://calf.sourceforge.net/plugins/Reverb", true);
  69. delete lv2_rdf_new("http://www.openavproductions.com/fabla", true);
  70. delete lv2_rdf_new("http://invadarecords.com/plugins/lv2/meter", true);
  71. delete lv2_rdf_new("http://gareus.org/oss/lv2/meters#spectr30stereo", true);
  72. delete lv2_rdf_new("http://plugin.org.uk/swh-plugins/revdelay", true);
  73. delete lv2_rdf_new("http://lv2plug.in/plugins/eg-scope#Stereo", true);
  74. delete lv2_rdf_new("http://kxstudio.sf.net/carla/plugins/carlarack", true);
  75. delete lv2_rdf_new("http://guitarix.sourceforge.net/plugins/gxautowah#autowah", true);
  76. delete lv2_rdf_new("http://github.com/blablack/ams-lv2/mixer_4ch", true);
  77. delete lv2_rdf_new("http://drumgizmo.org/lv2", true);
  78. delete lv2_rdf_new("http://synthv1.sourceforge.net/lv2", true);
  79. delete lv2_rdf_new("urn:juced:DrumSynth", true);
  80. // misc
  81. is_lv2_port_supported(0x0);
  82. is_lv2_feature_supported("test1");
  83. is_lv2_ui_feature_supported("test2");
  84. }
  85. // -----------------------------------------------------------------------
  86. static intptr_t test_vst_dispatcher(AEffect*, int, int, intptr_t, void*, float)
  87. {
  88. return 0;
  89. }
  90. static void test_CarlaVstUtils() noexcept
  91. {
  92. AEffect effect;
  93. carla_zeroStruct(effect);
  94. effect.dispatcher = test_vst_dispatcher;
  95. vstPluginCanDo(&effect, "test");
  96. carla_stdout(vstEffectOpcode2str(effOpen));
  97. carla_stdout(vstMasterOpcode2str(audioMasterAutomate));
  98. }
  99. // -----------------------------------------------------------------------
  100. // main
  101. int main()
  102. {
  103. test_CarlaLadspaUtils();
  104. test_CarlaDssiUtils();
  105. test_CarlaLv2Utils();
  106. test_CarlaVstUtils();
  107. return 0;
  108. }
  109. // -----------------------------------------------------------------------