allow ardour to use the (hard) maximum number of open files (this one's for you essej)

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3044 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2008-02-13 01:56:33 +00:00
parent ea41f0f37b
commit 22a407fb6b
8 changed files with 55 additions and 20 deletions

View file

@ -146,7 +146,7 @@ class PluginInsert : public Insert
nframes_t latency();
void transport_stopped (nframes_t now);
void automation_snapshot (nframes_t now);
void automation_snapshot (nframes_t now, bool force);
private:

View file

@ -258,7 +258,10 @@ class IO : public PBD::StatefulDestructible
sigc::signal<void> gain_automation_style_changed;
virtual void transport_stopped (nframes_t now);
void automation_snapshot (nframes_t now);
bool should_snapshot (nframes_t now) {
return (last_automation_snapshot > now || (now - last_automation_snapshot) > _automation_interval);
}
virtual void automation_snapshot (nframes_t now, bool force);
ARDOUR::Curve& gain_automation_curve () { return _gain_automation_curve; }

View file

@ -234,7 +234,7 @@ class Route : public IO
return _mute_control;
}
void automation_snapshot (nframes_t now);
void automation_snapshot (nframes_t now, bool force);
void protect_automation ();
void set_remote_control_id (uint32_t id);

View file

@ -539,7 +539,7 @@ AudioTrack::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
if (lm.locked()) {
// automation snapshot can also be called from the non-rt context
// and it uses the redirect list, so we take the lock out here
automation_snapshot (start_frame);
automation_snapshot (start_frame, false);
}
}

View file

@ -20,6 +20,8 @@
#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>
@ -249,6 +251,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)
{
@ -258,6 +287,9 @@ 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;

View file

@ -320,7 +320,7 @@ PluginInsert::connect_and_run (vector<Sample*>& bufs, uint32_t nbufs, nframes_t
}
void
PluginInsert::automation_snapshot (nframes_t now)
PluginInsert::automation_snapshot (nframes_t now, bool force)
{
map<uint32_t,AutomationList*>::iterator li;

View file

@ -2604,18 +2604,14 @@ IO::end_pan_touch (uint32_t which)
}
void
IO::automation_snapshot (nframes_t now)
IO::automation_snapshot (nframes_t now, bool force)
{
if (last_automation_snapshot > now || (now - last_automation_snapshot) > _automation_interval) {
if (gain_automation_recording()) {
_gain_automation_curve.rt_add (now, gain());
}
_panner->snapshot (now);
last_automation_snapshot = now;
if (gain_automation_recording()) {
_gain_automation_curve.rt_add (now, gain());
}
_panner->snapshot (now);
last_automation_snapshot = now;
}
void

View file

@ -2194,7 +2194,7 @@ Route::handle_transport_stopped (bool abort_ignored, bool did_locate, bool can_f
Glib::RWLock::ReaderLock lm (redirect_lock);
if (!did_locate) {
automation_snapshot (now);
automation_snapshot (now, true);
}
for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
@ -2301,7 +2301,7 @@ Route::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nfra
if (lm.locked()) {
// automation snapshot can also be called from the non-rt context
// and it uses the redirect list, so we take the lock out here
automation_snapshot (_session.transport_frame());
automation_snapshot (_session.transport_frame(), false);
}
}
@ -2442,12 +2442,16 @@ Route::set_latency_delay (nframes_t longest_session_latency)
}
void
Route::automation_snapshot (nframes_t now)
Route::automation_snapshot (nframes_t now, bool force)
{
IO::automation_snapshot (now);
if (!force && !should_snapshot(now)) {
return;
}
IO::automation_snapshot (now, force);
for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
(*i)->automation_snapshot (now);
(*i)->automation_snapshot (now, force);
}
}