summaryrefslogtreecommitdiff
path: root/libs/ardour/test
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/test')
-rw-r--r--libs/ardour/test/jack_utils_test.cc290
-rw-r--r--libs/ardour/test/jack_utils_test.h31
-rw-r--r--libs/ardour/test/midi_clock_slave_test.cc2
-rw-r--r--libs/ardour/test/plugins_test.cc54
-rw-r--r--libs/ardour/test/plugins_test.h12
-rw-r--r--libs/ardour/test/resampled_source_test.cc2
-rw-r--r--libs/ardour/test/test_common.cc4
-rw-r--r--libs/ardour/test/test_common.h2
8 files changed, 392 insertions, 5 deletions
diff --git a/libs/ardour/test/jack_utils_test.cc b/libs/ardour/test/jack_utils_test.cc
new file mode 100644
index 0000000000..7645df6ff3
--- /dev/null
+++ b/libs/ardour/test/jack_utils_test.cc
@@ -0,0 +1,290 @@
+
+#include <stdexcept>
+
+#ifdef PLATFORM_WINDOWS
+#include <windows.h> // only for Sleep
+#endif
+
+#include <glibmm/miscutils.h>
+
+#include "ardour/jack_utils.h"
+
+#include "jack_utils_test.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION (JackUtilsTest);
+
+using namespace std;
+using namespace ARDOUR;
+
+void
+JackUtilsTest::test_driver_names ()
+{
+ vector<string> driver_names;
+
+ get_jack_audio_driver_names (driver_names);
+
+ CPPUNIT_ASSERT(!driver_names.empty());
+
+ cout << endl;
+ cout << "Number of possible JACK Audio drivers found on this system: " << driver_names.size () << endl;
+
+ for (vector<string>::const_iterator i = driver_names.begin(); i != driver_names.end(); ++i) {
+ cout << "JACK Audio driver found: " << *i << endl;
+ }
+
+ string default_audio_driver;
+ get_jack_default_audio_driver_name (default_audio_driver);
+
+ cout << "The default audio driver on this system is: " << default_audio_driver << endl;
+
+ driver_names.clear();
+
+ get_jack_midi_system_names (default_audio_driver, driver_names);
+
+ CPPUNIT_ASSERT(!driver_names.empty());
+
+ cout << "Number of possible JACK MIDI drivers found on this system for default audio driver: " << driver_names.size () << endl;
+
+ for (vector<string>::const_iterator i = driver_names.begin(); i != driver_names.end(); ++i) {
+ cout << "JACK MIDI driver found: " << *i << endl;
+ }
+
+ string default_midi_driver;
+ get_jack_default_midi_system_name (default_audio_driver, default_midi_driver);
+
+ cout << "The default midi driver on this system is: " << default_midi_driver << endl;
+}
+
+string
+devices_string (const vector<string>& devices)
+{
+ std::string str;
+ for (vector<string>::const_iterator i = devices.begin(); i != devices.end();) {
+ str += *i;
+ if (++i != devices.end()) str += ", ";
+ }
+ return str;
+}
+
+void
+JackUtilsTest::test_device_names ()
+{
+ vector<string> driver_names;
+
+ get_jack_audio_driver_names (driver_names);
+
+ CPPUNIT_ASSERT(!driver_names.empty());
+
+ cout << endl;
+
+ for (vector<string>::const_iterator i = driver_names.begin(); i != driver_names.end(); ++i) {
+ string devices = devices_string (get_jack_device_names_for_audio_driver (*i));
+ cout << "JACK Audio driver found: " << *i << " with devices: " << devices << endl;
+ }
+}
+
+void
+JackUtilsTest::test_samplerates ()
+{
+ vector<string> samplerates;
+
+ get_jack_sample_rate_strings (samplerates);
+ cout << endl;
+ cout << "Number of possible Samplerates supported by JACK: " << samplerates.size () << endl;
+
+ for (vector<string>::const_iterator i = samplerates.begin(); i != samplerates.end(); ++i) {
+ cout << "Samplerate: " << *i << endl;
+ }
+}
+
+void
+JackUtilsTest::test_period_sizes ()
+{
+ vector<string> period_sizes;
+
+ get_jack_period_size_strings (period_sizes);
+ cout << endl;
+ cout << "Number of possible Period sizes supported by JACK: " << period_sizes.size () << endl;
+
+ for (vector<string>::const_iterator i = period_sizes.begin(); i != period_sizes.end(); ++i) {
+ cout << "Period size: " << *i << endl;
+ }
+}
+
+void
+JackUtilsTest::test_dither_modes ()
+{
+ vector<string> driver_names;
+
+ get_jack_audio_driver_names (driver_names);
+
+ CPPUNIT_ASSERT(!driver_names.empty());
+
+ cout << endl;
+
+ for (vector<string>::const_iterator i = driver_names.begin(); i != driver_names.end(); ++i) {
+ vector<string> dither_modes;
+
+ get_jack_dither_mode_strings (*i, dither_modes);
+ cout << "Number of possible Dither Modes supported by JACK driver " << *i <<
+ ": " << dither_modes.size () << endl;
+ for (vector<string>::const_iterator j = dither_modes.begin(); j != dither_modes.end(); ++j) {
+ cout << "Dither Mode: " << *j << endl;
+ }
+ cout << endl;
+ }
+
+}
+
+void
+JackUtilsTest::test_connect_server ()
+{
+ cout << endl;
+ if (jack_server_running ()) {
+ cout << "Jack server running " << endl;
+ } else {
+ cout << "Jack server not running " << endl;
+ }
+}
+
+void
+JackUtilsTest::test_set_jack_path_env ()
+{
+ cout << endl;
+
+ bool path_env_set = false;
+
+ string path_env = Glib::getenv ("PATH", path_env_set);
+
+ if (path_env_set) {
+ cout << "PATH env set to: " << path_env << endl;
+ } else {
+ cout << "PATH env not set" << endl;
+ }
+ vector<string> server_dirs;
+ get_jack_server_dir_paths (server_dirs);
+ set_path_env_for_jack_autostart (server_dirs);
+
+ path_env_set = false;
+
+ path_env = Glib::getenv ("PATH", path_env_set);
+
+ CPPUNIT_ASSERT (path_env_set);
+
+ cout << "After set_jack_path_env PATH env set to: " << path_env << endl;
+}
+
+void
+JackUtilsTest::test_server_paths ()
+{
+ cout << endl;
+
+ vector<std::string> server_dirs;
+
+ CPPUNIT_ASSERT (get_jack_server_dir_paths (server_dirs));
+
+ cout << "Number of Directories that may contain JACK servers: " << server_dirs.size () << endl;
+
+ for (vector<std::string>::const_iterator i = server_dirs.begin(); i != server_dirs.end(); ++i) {
+ cout << "JACK server directory path: " << *i << endl;
+ }
+
+ vector<string> server_names;
+
+ CPPUNIT_ASSERT (get_jack_server_application_names (server_names));
+
+ cout << "Number of possible JACK server names on this system: " << server_names.size () << endl;
+
+ for (vector<string>::const_iterator i = server_names.begin(); i != server_names.end(); ++i) {
+ cout << "JACK server name: " << *i << endl;
+ }
+
+ vector<std::string> server_paths;
+
+ CPPUNIT_ASSERT (get_jack_server_paths (server_dirs, server_names, server_paths));
+
+ cout << "Number of JACK servers on this system: " << server_paths.size () << endl;
+
+ for (vector<std::string>::const_iterator i = server_paths.begin(); i != server_paths.end(); ++i) {
+ cout << "JACK server path: " << *i << endl;
+ }
+
+ vector<std::string> server_paths2;
+
+ CPPUNIT_ASSERT (get_jack_server_paths (server_paths2));
+
+ CPPUNIT_ASSERT (server_paths.size () == server_paths2.size ());
+
+ std::string default_server_path;
+
+ CPPUNIT_ASSERT (get_jack_default_server_path (default_server_path));
+
+ cout << "The default JACK server on this system: " << default_server_path << endl;
+}
+
+bool
+get_default_jack_command_line (std::string& command_line)
+{
+ cout << endl;
+
+ JackCommandLineOptions options;
+
+ CPPUNIT_ASSERT (get_jack_default_server_path (options.server_path));
+
+ get_jack_default_audio_driver_name (options.driver);
+
+
+ // should fail, haven't set any device yet
+ CPPUNIT_ASSERT (!get_jack_command_line_string (options, command_line));
+
+ vector<string> devices = get_jack_device_names_for_audio_driver (options.driver);
+
+ if (!devices.empty()) {
+ options.input_device = devices.front ();
+ options.output_device = devices.front ();
+ } else {
+ cout << "No audio devices available using default JACK driver using Dummy driver" << endl;
+ options.driver = dummy_driver_name;
+ devices = get_jack_device_names_for_audio_driver (options.driver);
+ CPPUNIT_ASSERT (!devices.empty ());
+ options.input_device = devices.front ();
+ options.output_device = devices.front ();
+ }
+
+ options.input_device = devices.front ();
+ options.output_device = devices.front ();
+
+ string midi_driver;
+
+ get_jack_default_midi_system_name (options.driver, options.midi_driver);
+ //
+ // this at least should create a valid jack command line
+ return get_jack_command_line_string (options, command_line);
+
+}
+
+void
+JackUtilsTest::test_config ()
+{
+ std::string config_path(get_jack_server_user_config_file_path());
+
+ cout << "Jack server config file path: " << config_path << endl;
+
+ std::string command_line;
+
+ CPPUNIT_ASSERT (get_default_jack_command_line (command_line));
+
+ CPPUNIT_ASSERT (write_jack_config_file (config_path, command_line));
+}
+
+
+void
+JackUtilsTest::test_command_line ()
+{
+ string command_line;
+
+ // this at least should create a valid jack command line
+ CPPUNIT_ASSERT (get_default_jack_command_line (command_line));
+
+ cout << "Default JACK command line: " << command_line << endl;
+}
diff --git a/libs/ardour/test/jack_utils_test.h b/libs/ardour/test/jack_utils_test.h
new file mode 100644
index 0000000000..08fad2fc36
--- /dev/null
+++ b/libs/ardour/test/jack_utils_test.h
@@ -0,0 +1,31 @@
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class JackUtilsTest : public CppUnit::TestFixture
+{
+ CPPUNIT_TEST_SUITE (JackUtilsTest);
+ CPPUNIT_TEST (test_driver_names);
+ CPPUNIT_TEST (test_device_names);
+ CPPUNIT_TEST (test_samplerates);
+ CPPUNIT_TEST (test_period_sizes);
+ CPPUNIT_TEST (test_dither_modes);
+ CPPUNIT_TEST (test_connect_server);
+ CPPUNIT_TEST (test_set_jack_path_env);
+ CPPUNIT_TEST (test_server_paths);
+ CPPUNIT_TEST (test_config);
+ CPPUNIT_TEST (test_command_line);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+ void test_driver_names ();
+ void test_device_names ();
+ void test_samplerates ();
+ void test_period_sizes ();
+ void test_dither_modes ();
+ void test_connect_server ();
+ void test_set_jack_path_env ();
+ void test_server_paths ();
+ void test_config ();
+ void test_command_line ();
+};
diff --git a/libs/ardour/test/midi_clock_slave_test.cc b/libs/ardour/test/midi_clock_slave_test.cc
index dcb159cb2c..4349df22eb 100644
--- a/libs/ardour/test/midi_clock_slave_test.cc
+++ b/libs/ardour/test/midi_clock_slave_test.cc
@@ -27,7 +27,7 @@ MIDIClock_SlaveTest::testStepResponse ()
for (framecnt_t i = 1; i<= 100 * period_size; i++) {
// simulate jitter
- framecnt_t input_delta = framecnt_t (one_ppqn_in_frames + 0.1 * (double(random()) / double (RAND_MAX)) * one_ppqn_in_frames);
+ framecnt_t input_delta = framecnt_t (one_ppqn_in_frames + 0.1 * (double(g_random_int()) / double (RAND_MAX)) * one_ppqn_in_frames);
if (i % input_delta == 0) {
update_midi_clock (*parser, start_time + i);
diff --git a/libs/ardour/test/plugins_test.cc b/libs/ardour/test/plugins_test.cc
new file mode 100644
index 0000000000..0e4bddcda6
--- /dev/null
+++ b/libs/ardour/test/plugins_test.cc
@@ -0,0 +1,54 @@
+#include <iostream>
+
+#include "ardour/plugin_manager.h"
+#include "ardour/ladspa_search_path.h"
+
+#include "plugins_test.h"
+#include "test_common.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION (PluginsTest);
+
+using namespace std;
+using namespace ARDOUR;
+using namespace PBD;
+
+void
+print_plugin_info (PluginInfoPtr pp)
+{
+ cout << "LADSPA Plugin, name " << pp->name
+ << ", category " << pp->category
+ << ", creator " << pp->creator
+ << ", path " << pp->path
+ << ", n_inputs " << pp->n_inputs.n_audio ()
+ << ", n_outputs " << pp->n_outputs.n_audio ()
+ << endl;
+
+}
+
+void
+PluginsTest::test ()
+{
+ PluginManager& pm = PluginManager::instance ();
+
+ pm.refresh ();
+
+ Searchpath ladspa_paths(ladspa_search_path ());
+
+ cout << "Number of Ladspa paths found: " << ladspa_paths.size () << endl;
+
+ for (vector<std::string>::iterator i = ladspa_paths.begin (); i != ladspa_paths.end(); ++i)
+ {
+ cout << "LADSPA search path includes: " << *i << endl;
+ }
+
+ PluginInfoList& ladspa_list = pm.ladspa_plugin_info ();
+
+ cout << "Number of Ladspa plugins found: " << ladspa_list.size () << endl;
+
+ for (PluginInfoList::iterator i = ladspa_list.begin (); i != ladspa_list.end(); ++i)
+ {
+ print_plugin_info (*i);
+ }
+
+
+}
diff --git a/libs/ardour/test/plugins_test.h b/libs/ardour/test/plugins_test.h
new file mode 100644
index 0000000000..1503b2bde2
--- /dev/null
+++ b/libs/ardour/test/plugins_test.h
@@ -0,0 +1,12 @@
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class PluginsTest : public CppUnit::TestFixture
+{
+ CPPUNIT_TEST_SUITE (PluginsTest);
+ CPPUNIT_TEST (test);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+ void test ();
+};
diff --git a/libs/ardour/test/resampled_source_test.cc b/libs/ardour/test/resampled_source_test.cc
index 5aaf71b7aa..c8ef0f4a95 100644
--- a/libs/ardour/test/resampled_source_test.cc
+++ b/libs/ardour/test/resampled_source_test.cc
@@ -1,4 +1,4 @@
-// this is included first to avoid SearchPath definition on windows
+// this is included first to avoid Searchpath definition on windows
#include "test_common.h"
#include "pbd/file_utils.h"
diff --git a/libs/ardour/test/test_common.cc b/libs/ardour/test/test_common.cc
index 61f92972d1..71eba65bbb 100644
--- a/libs/ardour/test/test_common.cc
+++ b/libs/ardour/test/test_common.cc
@@ -25,10 +25,10 @@
using namespace std;
-PBD::SearchPath
+PBD::Searchpath
test_search_path ()
{
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
std::string wsp(g_win32_get_package_installation_directory_of_module(NULL));
return Glib::build_filename (wsp, "ardour_testdata");
#else
diff --git a/libs/ardour/test/test_common.h b/libs/ardour/test/test_common.h
index 91fd066ac2..bfda543508 100644
--- a/libs/ardour/test/test_common.h
+++ b/libs/ardour/test/test_common.h
@@ -21,7 +21,7 @@
#include "pbd/search_path.h"
-PBD::SearchPath test_search_path ();
+PBD::Searchpath test_search_path ();
std::string new_test_output_dir (std::string prefix = "");