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.

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