summaryrefslogtreecommitdiff
path: root/libs/ardour/globals.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-02-16 22:55:47 +0000
committerDavid Robillard <d@drobilla.net>2008-02-16 22:55:47 +0000
commit859e9106e72a7908fa093d946111d148223225a0 (patch)
treeec47825b5f5746bcbc5d321d40da7fc798f5c380 /libs/ardour/globals.cc
parent8aa9508c82f32efcf9c7c00e2c9e76268d4dddce (diff)
Merge with 2.0-ongoing R3071.
git-svn-id: svn://localhost/ardour2/branches/3.0@3074 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/globals.cc')
-rw-r--r--libs/ardour/globals.cc73
1 files changed, 73 insertions, 0 deletions
diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc
index 6aba688cae..02c4a5ced6 100644
--- a/libs/ardour/globals.cc
+++ b/libs/ardour/globals.cc
@@ -19,9 +19,12 @@
#include <cstdio> // Needed so that libraptor (included in lrdf) won't complain
#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
#include <unistd.h>
#include <fcntl.h>
#include <locale.h>
+#include <errno.h>
#ifdef VST_SUPPORT
#include <fst.h>
@@ -31,12 +34,16 @@
#include <xmmintrin.h>
#endif
+#include <glibmm/fileutils.h>
+#include <glibmm/miscutils.h>
+
#include <lrdf.h>
#include <pbd/error.h>
#include <pbd/id.h>
#include <pbd/strsplit.h>
#include <pbd/fpu.h>
+#include <pbd/file_utils.h>
#include <midi++/port.h>
#include <midi++/manager.h>
@@ -54,6 +61,7 @@
#include <ardour/source_factory.h>
#include <ardour/control_protocol_manager.h>
#include <ardour/audioengine.h>
+#include <ardour/filesystem_paths.h>
#ifdef HAVE_LIBLO
#include <ardour/osc.h>
@@ -96,6 +104,8 @@ apply_gain_to_buffer_t ARDOUR::apply_gain_to_buffer = 0;
mix_buffers_with_gain_t ARDOUR::mix_buffers_with_gain = 0;
mix_buffers_no_gain_t ARDOUR::mix_buffers_no_gain = 0;
+sigc::signal<void,std::string> ARDOUR::BootMessage;
+
#ifdef HAVE_LIBLO
static int
setup_osc ()
@@ -107,6 +117,7 @@ setup_osc ()
osc = new OSC (Config->get_osc_port());
if (Config->get_use_osc ()) {
+ BootMessage (_("Starting OSC"));
return osc->start ();
} else {
return 0;
@@ -122,6 +133,8 @@ setup_midi ()
return 0;
}
+ BootMessage (_("Configuring MIDI ports"));
+
for (std::map<string,XMLNode>::iterator i = Config->midi_ports.begin(); i != Config->midi_ports.end(); ++i) {
MIDI::Manager::instance()->add_port (i->second);
}
@@ -253,6 +266,33 @@ setup_hardware_optimization (bool try_optimization)
}
}
+static void
+lotsa_files_please ()
+{
+ struct rlimit rl;
+
+ if (getrlimit (RLIMIT_NOFILE, &rl) == 0) {
+
+ rl.rlim_cur = rl.rlim_max;
+
+ if (setrlimit (RLIMIT_NOFILE, &rl) != 0) {
+ if (rl.rlim_cur == RLIM_INFINITY) {
+ error << _("Could not set system open files limit to \"unlimited\"") << endmsg;
+ } else {
+ error << string_compose (_("Could not set system open files limit to %1"), rl.rlim_cur) << endmsg;
+ }
+ } else {
+ if (rl.rlim_cur == RLIM_INFINITY) {
+ info << _("Removed open file count limit. Excellent!") << endmsg;
+ } else {
+ info << string_compose (_("Ardour will be limited to %1 open files"), rl.rlim_cur) << endmsg;
+ }
+ }
+ } else {
+ error << string_compose (_("Could not get system open files limit (%1)"), strerror (errno)) << endmsg;
+ }
+}
+
int
ARDOUR::init (bool use_vst, bool try_optimization)
{
@@ -262,9 +302,14 @@ ARDOUR::init (bool use_vst, bool try_optimization)
setup_enum_writer ();
+ // allow ardour the absolute maximum number of open files
+ lotsa_files_please ();
+
lrdf_init();
Library = new AudioLibrary;
+ BootMessage (_("Loading configuration"));
+
Config = new Configuration;
if (Config->load_state ()) {
@@ -367,6 +412,34 @@ ARDOUR::get_ardour_revision ()
return "$Rev$";
}
+void
+ARDOUR::find_bindings_files (map<string,string>& files)
+{
+ vector<sys::path> found;
+
+ SearchPath spath = ardour_search_path() + user_config_directory() + system_config_search_path();
+
+ if (getenv ("ARDOUR_SAE")) {
+ Glib::PatternSpec pattern("*SAE-*.bindings");
+ find_matching_files_in_search_path (spath, pattern, found);
+ } else {
+ Glib::PatternSpec pattern("*.bindings");
+ find_matching_files_in_search_path (spath, pattern, found);
+ }
+
+ if (found.empty()) {
+ return;
+ }
+
+ for (vector<sys::path>::iterator x = found.begin(); x != found.end(); ++x) {
+ sys::path path = *x;
+ pair<string,string> namepath;
+ namepath.second = path.to_string();
+ namepath.first = path.leaf().substr (0, path.leaf().find_first_of ('.'));
+ files.insert (namepath);
+ }
+}
+
ARDOUR::LocaleGuard::LocaleGuard (const char* str)
{
old = strdup (setlocale (LC_NUMERIC, NULL));