diff options
author | David Robillard <d@drobilla.net> | 2008-01-10 22:22:29 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-01-10 22:22:29 +0000 |
commit | 8a2e30816ee392b871c5918f769f68cc0196a893 (patch) | |
tree | eb85739049c0adc6186eea635aaaf65ef03f038f /gtk2_ardour/engine_dialog.cc | |
parent | bb457bb960c5bd7ed538f9d31477293415739f68 (diff) |
Merge with 2.0-ongoing R2883.
git-svn-id: svn://localhost/ardour2/trunk@2885 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/engine_dialog.cc')
-rw-r--r-- | gtk2_ardour/engine_dialog.cc | 76 |
1 files changed, 46 insertions, 30 deletions
diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index 8a8f99f745..e511e59af2 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -1,6 +1,7 @@ #include <vector> #include <cmath> #include <fstream> +#include <map> #include <glibmm.h> #include <pbd/xml++.h> @@ -22,6 +23,7 @@ #include <pbd/convert.h> #include <pbd/error.h> +#include <pbd/pathscanner.h> #ifdef __APPLE #include <CFBundle.h> @@ -113,7 +115,6 @@ EngineControl::EngineControl () strings.push_back (X_("ALSA")); strings.push_back (X_("OSS")); strings.push_back (X_("FFADO")); - strings.push_back (X_("FreeBoB")); #endif strings.push_back (X_("NetJACK")); strings.push_back (X_("Dummy")); @@ -364,7 +365,7 @@ EngineControl::build_command_line (vector<string>& cmd) bool using_coreaudio = false; bool using_netjack = false; bool using_ffado = false; - bool using_freebob = false; + bool using_dummy = false; /* first, path to jackd */ @@ -427,10 +428,10 @@ EngineControl::build_command_line (vector<string>& cmd) } else if (driver == X_("FFADO")) { using_ffado = true; cmd.push_back ("firewire"); - } else if (driver == X_("FreeBoB")) { - using_freebob = true; - cmd.push_back ("freebob"); - } + } else if ( driver == X_("Dummy")) { + using_dummy = true; + cmd.push_back ("dummy"); + } /* driver arguments */ @@ -454,8 +455,10 @@ EngineControl::build_command_line (vector<string>& cmd) cmd.push_back ("-C"); } - cmd.push_back ("-n"); - cmd.push_back (to_string ((uint32_t) floor (periods_spinner.get_value()), std::dec)); + if (! using_dummy ) { + cmd.push_back ("-n"); + cmd.push_back (to_string ((uint32_t) floor (periods_spinner.get_value()), std::dec)); + } } cmd.push_back ("-r"); @@ -572,7 +575,6 @@ EngineControl::enumerate_devices () #else devices["ALSA"] = enumerate_alsa_devices (); devices["FFADO"] = enumerate_ffado_devices (); - devices["FreeBoB"] = enumerate_freebob_devices (); devices["OSS"] = enumerate_oss_devices (); devices["Dummy"] = enumerate_dummy_devices (); devices["NetJACK"] = enumerate_netjack_devices (); @@ -825,6 +827,11 @@ EngineControl::audio_mode_changed () } } +static bool jack_server_filter(const string& str, void *arg) +{ + return str == "jackd" || str == "jackdmp"; +} + void EngineControl::find_jack_servers (vector<string>& strings) { @@ -838,14 +845,11 @@ EngineControl::find_jack_servers (vector<string>& strings) _NSGetExecutablePath (execpath, &pathsz); - cerr << " execpath = " << execpath << endl; - Glib::ustring path (Glib::path_get_dirname (execpath)); path += "/jackd"; if (Glib::file_test (path, FILE_TEST_EXISTS)) { strings.push_back (path); - cerr << "Found jack in " << path << endl; } if (getenv ("ARDOUR_WITH_JACK")) { @@ -856,29 +860,30 @@ EngineControl::find_jack_servers (vector<string>& strings) } return; } +#else + string path; #endif - if (Glib::file_test ("/usr/bin/jackd", FILE_TEST_EXISTS)) { - strings.push_back ("/usr/bin/jackd"); - } - if (Glib::file_test ("/usr/local/bin/jackd", FILE_TEST_EXISTS)) { - strings.push_back ("/usr/local/bin/jackd"); - } - if (Glib::file_test ("/opt/bin/jackd", FILE_TEST_EXISTS)) { - strings.push_back ("/opt/bin/jackd"); - } - if (Glib::file_test ("/usr/bin/jackdmp", FILE_TEST_EXISTS)) { - strings.push_back ("/usr/bin/jackd"); - } - if (Glib::file_test ("/usr/local/bin/jackdmp", FILE_TEST_EXISTS)) { - strings.push_back ("/usr/local/bin/jackd"); - } - if (Glib::file_test ("/opt/bin/jackdmp", FILE_TEST_EXISTS)) { - strings.push_back ("/opt/bin/jackd"); + PathScanner scanner; + vector<string *> *jack_servers; + std::map<string,int> un; + + path = getenv ("PATH"); + + jack_servers = scanner (path, jack_server_filter, 0, false, true); + + vector<string *>::iterator iter; + + for (iter = jack_servers->begin(); iter != jack_servers->end(); iter++) { + string p = **iter; + + if (un[p]++ == 0) { + strings.push_back(p); + } } - } + string EngineControl::get_device_name (const string& driver, const string& human_readable) { @@ -1023,9 +1028,18 @@ EngineControl::set_state (const XMLNode& root) XMLNode* child; XMLProperty* prop; + bool using_dummy = false; + int val; string strval; + if ( (child = root.child("driver"))){ + prop = child->property("val"); + if (prop && (prop->value() == "Dummy") ) { + using_dummy = true; + } + } + clist = root.children(); for (citer = clist.begin(); citer != clist.end(); ++citer) { @@ -1035,6 +1049,8 @@ EngineControl::set_state (const XMLNode& root) prop = child->property ("val"); if (!prop || prop->value().empty()) { + if ( using_dummy && ( child->name() == "interface" || child->name() == "inputdevice" || child->name() == "outputdevice" )) + continue; error << string_compose (_("AudioSetup value for %1 is missing data"), child->name()) << endmsg; continue; } |