summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2017-05-23 14:27:50 +1000
committerTim Mayberry <mojofunk@gmail.com>2017-05-23 14:32:15 +1000
commitf9b256044f8a645f294672c04d9ea9d95af78d6e (patch)
tree431d477ea70e012b252904e2f62439db17b679f0
parent39e7e11b5e605475199493a0f38bc3f4c986caa8 (diff)
Remove old jack_utils.h header that was moved to the JACK backend
Also remove a related test that has not been part of the unit tests since the move (years).
-rw-r--r--libs/ardour/ardour/jack_utils.h253
-rw-r--r--libs/ardour/test/jack_utils_test.cc290
-rw-r--r--libs/ardour/test/jack_utils_test.h31
3 files changed, 0 insertions, 574 deletions
diff --git a/libs/ardour/ardour/jack_utils.h b/libs/ardour/ardour/jack_utils.h
deleted file mode 100644
index 40eb30f9ea..0000000000
--- a/libs/ardour/ardour/jack_utils.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- Copyright (C) 2011 Tim Mayberry
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <stdint.h>
-
-#include <vector>
-#include <map>
-#include <string>
-
-namespace ARDOUR {
-
- // Names for the drivers on all possible systems
- extern const char * const portaudio_driver_name;
- extern const char * const coreaudio_driver_name;
- extern const char * const alsa_driver_name;
- extern const char * const oss_driver_name;
- extern const char * const freebob_driver_name;
- extern const char * const ffado_driver_name;
- extern const char * const netjack_driver_name;
- extern const char * const dummy_driver_name;
-
- /**
- * Get a list of possible JACK audio driver names based on platform
- */
- void get_jack_audio_driver_names (std::vector<std::string>& driver_names);
-
- /**
- * Get the default JACK audio driver based on platform
- */
- void get_jack_default_audio_driver_name (std::string& driver_name);
-
- /**
- * Get a list of possible JACK midi driver names based on platform
- */
- void get_jack_midi_system_names (const std::string& driver, std::vector<std::string>& driver_names);
-
- /**
- * Get the default JACK midi driver based on platform
- */
- void get_jack_default_midi_system_name (const std::string& driver_name, std::string& midi_system);
-
- /**
- * Get a list of possible samplerates supported be JACK
- */
- void get_jack_sample_rate_strings (std::vector<std::string>& sample_rates);
-
- /**
- * @return The default samplerate
- */
- std::string get_jack_default_sample_rate ();
-
- /**
- * @return true if sample rate string was able to be converted
- */
- bool get_jack_sample_rate_value_from_string (const std::string& srs, uint32_t& srv);
-
- /**
- * Get a list of possible period sizes supported be JACK
- */
- void get_jack_period_size_strings (std::vector<std::string>& samplerates);
-
- /**
- * @return The default period size
- */
- std::string get_jack_default_period_size ();
-
- /**
- * @return true if period size string was able to be converted
- */
- bool get_jack_period_size_value_from_string (const std::string& pss, uint32_t& psv);
-
- /**
- * These are driver specific I think, so it may require a driver arg
- * in future
- */
- void get_jack_dither_mode_strings (const std::string& driver, std::vector<std::string>& dither_modes);
-
- /**
- * @return The default dither mode
- */
- std::string get_jack_default_dither_mode (const std::string& driver);
-
- /**
- * @return Estimate of latency
- *
- * API matches current use in GUI
- */
- std::string get_jack_latency_string (std::string samplerate, float periods, std::string period_size);
-
- /**
- * @return true if a JACK server is running
- */
- bool jack_server_running ();
-
- /**
- * Key being a readable name to display in a GUI
- * Value being name used in a jack commandline
- */
- typedef std::map<std::string, std::string> device_map_t;
-
- /**
- * Use library specific code to find out what what devices exist for a given
- * driver that might work in JACK. There is no easy way to find out what
- * modules the JACK server supports so guess based on platform. For instance
- * portaudio is cross-platform but we only return devices if built for
- * windows etc
- */
- void get_jack_alsa_device_names (device_map_t& devices);
- void get_jack_portaudio_device_names (device_map_t& devices);
- void get_jack_coreaudio_device_names (device_map_t& devices);
- void get_jack_oss_device_names (device_map_t& devices);
- void get_jack_freebob_device_names (device_map_t& devices);
- void get_jack_ffado_device_names (device_map_t& devices);
- void get_jack_netjack_device_names (device_map_t& devices);
- void get_jack_dummy_device_names (device_map_t& devices);
-
- /*
- * @return true if there were devices found for the driver
- *
- * @param driver The driver name returned by get_jack_audio_driver_names
- * @param devices The map used to insert the drivers into, devices will be cleared before
- * adding the available drivers
- */
- bool get_jack_device_names_for_audio_driver (const std::string& driver, device_map_t& devices);
-
- /*
- * @return a list of readable device names for a specific driver.
- */
- std::vector<std::string> get_jack_device_names_for_audio_driver (const std::string& driver);
-
- /**
- * @return true if the driver supports playback and recording
- * on separate devices
- */
- bool get_jack_audio_driver_supports_two_devices (const std::string& driver);
-
- bool get_jack_audio_driver_supports_latency_adjustment (const std::string& driver);
-
- bool get_jack_audio_driver_supports_setting_period_count (const std::string& driver);
-
- /**
- * The possible names to use to try and find servers, this includes
- * any file extensions like .exe on Windows
- *
- * @return true if the JACK application names for this platform could be guessed
- */
- bool get_jack_server_application_names (std::vector<std::string>& server_names);
-
- /**
- * Sets the PATH environment variable to contain directories likely to contain
- * JACK servers so that if the JACK server is auto-started it can find the server
- * executable.
- *
- * This is only modifies PATH on the mac at the moment.
- */
- void set_path_env_for_jack_autostart (const std::vector<std::string>&);
-
- /**
- * Get absolute paths to directories that might contain JACK servers on the system
- *
- * @return true if !server_paths.empty()
- */
- bool get_jack_server_dir_paths (std::vector<std::string>& server_dir_paths);
-
- /**
- * Get absolute paths to JACK servers on the system
- *
- * @return true if a server was found
- */
- bool get_jack_server_paths (const std::vector<std::string>& server_dir_paths,
- const std::vector<std::string>& server_names,
- std::vector<std::string>& server_paths);
-
-
- bool get_jack_server_paths (std::vector<std::string>& server_paths);
-
- /**
- * Get absolute path to default JACK server
- */
- bool get_jack_default_server_path (std::string& server_path);
-
- /**
- * @return The name of the jack server config file
- */
- std::string get_jack_server_config_file_name ();
-
- std::string get_jack_server_user_config_dir_path ();
-
- std::string get_jack_server_user_config_file_path ();
-
- bool write_jack_config_file (const std::string& config_file_path, const std::string& command_line);
-
- struct JackCommandLineOptions {
-
- // see implementation for defaults
- JackCommandLineOptions ();
-
- //operator bool
- //operator ostream
-
- std::string server_path;
- uint32_t timeout;
- bool no_mlock;
- uint32_t ports_max;
- bool realtime;
- uint32_t priority;
- bool unlock_gui_libs;
- bool verbose;
- bool temporary;
- bool playback_only;
- bool capture_only;
- std::string driver;
- std::string input_device;
- std::string output_device;
- uint32_t num_periods;
- uint32_t period_size;
- uint32_t samplerate;
- uint32_t input_latency;
- uint32_t output_latency;
- bool hardware_metering;
- bool hardware_monitoring;
- std::string dither_mode;
- bool force16_bit;
- bool soft_mode;
- std::string midi_driver;
- };
-
- /**
- * @return true if able to build a valid command line based on options
- */
- bool get_jack_command_line_string (const JackCommandLineOptions& options, std::string& command_line);
-
- /**
- * We don't need this at the moment because the gui stores all its settings
- */
- //std::string get_jack_command_line_from_config_file (const std::string& config_file_path);
-}
diff --git a/libs/ardour/test/jack_utils_test.cc b/libs/ardour/test/jack_utils_test.cc
deleted file mode 100644
index d8a21ceb49..0000000000
--- a/libs/ardour/test/jack_utils_test.cc
+++ /dev/null
@@ -1,290 +0,0 @@
-
-#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
deleted file mode 100644
index 08fad2fc36..0000000000
--- a/libs/ardour/test/jack_utils_test.h
+++ /dev/null
@@ -1,31 +0,0 @@
-
-#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 ();
-};