Save LV2 presets with relative URIs to their own bundle, in the same style as Jalv.
[ardour.git] / libs / ardour / automation_watch.cc
index 5fefcaca8de22b1e9ff8b6c598f09fc050af9534..0fa98f2133a5469ac30e170b919a7353e7584015 100644 (file)
@@ -28,8 +28,6 @@
 
 using namespace ARDOUR;
 using namespace PBD;
-using std::cerr;
-using std::endl;
 
 AutomationWatch* AutomationWatch::_instance = 0;
 
@@ -57,16 +55,16 @@ AutomationWatch::~AutomationWatch ()
                _thread = 0;
        }
 
-       Glib::Mutex::Lock lm (automation_watch_lock);
+       Glib::Threads::Mutex::Lock lm (automation_watch_lock);
        automation_watches.clear ();
 }
 
 void
 AutomationWatch::add_automation_watch (boost::shared_ptr<AutomationControl> ac)
 {
-       Glib::Mutex::Lock lm (automation_watch_lock);
-       DEBUG_TRACE (DEBUG::Automation, string_compose ("now watching control %1 for automation\n", ac->name()));
-       automation_watches.push_back (ac);
+       Glib::Threads::Mutex::Lock lm (automation_watch_lock);
+       DEBUG_TRACE (DEBUG::Automation, string_compose ("now watching control %1 for automation, astate = %2\n", ac->name(), enum_2_string (ac->automation_state())));
+       automation_watches.insert (ac);
 
        /* if an automation control is added here while the transport is
         * rolling, make sure that it knows that there is a write pass going
@@ -102,9 +100,9 @@ AutomationWatch::remove_weak_automation_watch (boost::weak_ptr<AutomationControl
 void
 AutomationWatch::remove_automation_watch (boost::shared_ptr<AutomationControl> ac)
 {
-       Glib::Mutex::Lock lm (automation_watch_lock);
+       Glib::Threads::Mutex::Lock lm (automation_watch_lock);
        DEBUG_TRACE (DEBUG::Automation, string_compose ("remove control %1 from automation watch\n", ac->name()));
-       automation_watches.remove (ac);
+       automation_watches.erase (ac);
        ac->list()->set_in_write_pass (false);
 }
 
@@ -116,8 +114,8 @@ AutomationWatch::timer ()
        }
 
        {
-               Glib::Mutex::Lock lm (automation_watch_lock);
-               
+               Glib::Threads::Mutex::Lock lm (automation_watch_lock);
+
                framepos_t time = _session->audible_frame ();
 
                for (AutomationWatches::iterator aw = automation_watches.begin(); aw != automation_watches.end(); ++aw) {
@@ -134,7 +132,7 @@ void
 AutomationWatch::thread ()
 {
        while (_run_thread) {
-               usleep (100000); // Config->get_automation_interval() * 10);
+               usleep ((useconds_t) floor (Config->get_automation_interval_msecs() * 1000));
                timer ();
        }
 }
@@ -154,8 +152,7 @@ AutomationWatch::set_session (Session* s)
 
        if (_session) {
                _run_thread = true;
-               _thread = Glib::Thread::create (boost::bind (&AutomationWatch::thread, this),
-                                               500000, true, true, Glib::THREAD_PRIORITY_NORMAL);
+               _thread = Glib::Threads::Thread::create (boost::bind (&AutomationWatch::thread, this));
                
                _session->TransportStateChange.connect_same_thread (transport_connection, boost::bind (&AutomationWatch::transport_state_change, this));
        }
@@ -171,7 +168,7 @@ AutomationWatch::transport_state_change ()
        bool rolling = _session->transport_rolling();
 
        {
-               Glib::Mutex::Lock lm (automation_watch_lock);
+               Glib::Threads::Mutex::Lock lm (automation_watch_lock);
 
                for (AutomationWatches::iterator aw = automation_watches.begin(); aw != automation_watches.end(); ++aw) {
                        DEBUG_TRACE (DEBUG::Automation, string_compose ("%1: transport state changed, speed %2, in write pass ? %3 writing ? %4\n",