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.

147 lines
4.5KB

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