3 * Copyright (C) 2013-2017 Filipe Coelho <falktx@falktx.com>
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.
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.
15 * For a full copy of the GNU General Public License see the doc/GPL.txt file.
19 # error Build this file with debug ON please
22 #include "CarlaLadspaUtils.hpp"
23 #include "CarlaDssiUtils.cpp"
24 #include "CarlaLv2Utils.hpp"
25 #include "CarlaVstUtils.hpp"
27 // -----------------------------------------------------------------------
29 static void test_CarlaLadspaUtils()
31 LADSPA_Descriptor desc
;
32 carla_zeroStruct(desc
);
34 LADSPA_RDF_Descriptor rdfDesc
;
35 delete ladspa_rdf_dup(&rdfDesc
);
37 is_ladspa_port_good(0x0, 0x0);
38 is_ladspa_rdf_descriptor_valid(&rdfDesc
, &desc
);
39 get_default_ladspa_port_value(0x0, -1.0f
, 1.0f
);
42 // -----------------------------------------------------------------------
44 static void test_CarlaDssiUtils() noexcept
46 const char* const ui
= find_dssi_ui("/usr/lib/dssi/trivial_sampler.so", "aa");
48 CARLA_SAFE_ASSERT(ui
!= nullptr);
52 carla_stdout("%s", ui
);
53 assert(std::strcmp(ui
, "/usr/lib/dssi/trivial_sampler/trivial_sampler_qt") == 0);
58 // -----------------------------------------------------------------------
60 static LV2_URID
test_lv2_uridMap(LV2_URID_Map_Handle
, const char*)
65 static void test_CarlaLv2Utils()
67 Lv2WorldClass
& lv2World(Lv2WorldClass::getInstance());
68 lv2World
.initIfNeeded(std::getenv("LV2_PATH"));
71 const LilvPlugin
* const plugin(lv2World
.getPluginFromURI("urn:juced:DrumSynth"));
72 CARLA_SAFE_ASSERT(plugin
!= nullptr);
75 LV2_URID_Map uridMap
= { nullptr, test_lv2_uridMap
};
76 LilvState
* const state(lv2World
.getStateFromURI("http://arcticanaudio.com/plugins/thefunction#preset001", &uridMap
));
77 CARLA_SAFE_ASSERT(state
!= nullptr);
78 if (state
!= nullptr) lilv_state_free(state
);
80 // load a bunch of plugins to stress test lilv
81 delete lv2_rdf_new("http://arcticanaudio.com/plugins/thefunction", true);
82 delete lv2_rdf_new("http://kunz.corrupt.ch/products/tal-noisemaker", true);
83 delete lv2_rdf_new("http://calf.sourceforge.net/plugins/Reverb", true);
84 delete lv2_rdf_new("http://www.openavproductions.com/fabla", true);
85 delete lv2_rdf_new("http://invadarecords.com/plugins/lv2/meter", true);
86 delete lv2_rdf_new("http://gareus.org/oss/lv2/meters#spectr30stereo", true);
87 delete lv2_rdf_new("http://plugin.org.uk/swh-plugins/revdelay", true);
88 delete lv2_rdf_new("http://lv2plug.in/plugins/eg-scope#Stereo", true);
89 delete lv2_rdf_new("http://kxstudio.sf.net/carla/plugins/carlarack", true);
90 delete lv2_rdf_new("http://guitarix.sourceforge.net/plugins/gxautowah#autowah", true);
91 delete lv2_rdf_new("http://github.com/blablack/ams-lv2/mixer_4ch", true);
92 delete lv2_rdf_new("http://drumgizmo.org/lv2", true);
93 delete lv2_rdf_new("http://synthv1.sourceforge.net/lv2", true);
94 delete lv2_rdf_new("urn:juced:DrumSynth", true);
97 is_lv2_port_supported(0x0);
98 is_lv2_feature_supported("test1");
99 is_lv2_ui_feature_supported("test2");
102 // -----------------------------------------------------------------------
104 static intptr_t test_vst_dispatcher(AEffect
*, int, int, intptr_t, void*, float)
109 static void test_CarlaVstUtils() noexcept
112 carla_zeroStruct(effect
);
113 effect
.dispatcher
= test_vst_dispatcher
;
115 vstPluginCanDo(&effect
, "test");
116 carla_stdout(vstEffectOpcode2str(effOpen
));
117 carla_stdout(vstMasterOpcode2str(audioMasterAutomate
));
120 // -----------------------------------------------------------------------
125 test_CarlaLadspaUtils();
126 test_CarlaDssiUtils();
127 test_CarlaLv2Utils();
128 test_CarlaVstUtils();
133 // -----------------------------------------------------------------------