add missing files
[ardour.git] / libs / ardour / ardour / automation_watch.h
1 /*
2     Copyright (C) 2012 Paul Davis
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #include <list>
21 #include <boost/shared_ptr.hpp>
22 #include <glibmm/thread.h>
23 #include <sigc++/signal.h>
24
25 #include "pbd/signals.h"
26
27 #include "ardour/session_handle.h"
28
29 namespace ARDOUR {
30
31 class AutomationControl;
32
33 class AutomationWatch : public sigc::trackable, public ARDOUR::SessionHandlePtr, public PBD::ScopedConnectionList {
34   public:
35     static AutomationWatch& instance();
36
37     void add_automation_watch (boost::shared_ptr<ARDOUR::AutomationControl>);
38     void remove_automation_watch (boost::shared_ptr<ARDOUR::AutomationControl>);
39     void set_session (ARDOUR::Session*);
40
41     gint timer ();
42
43   private:
44     typedef std::list<boost::shared_ptr<ARDOUR::AutomationControl> > AutomationWatches;
45
46     AutomationWatch ();
47     ~AutomationWatch();
48
49     static AutomationWatch* _instance;
50     Glib::Thread*           _thread;
51     bool                    _run_thread;
52     AutomationWatches        automation_watches;
53     Glib::Mutex              automation_watch_lock;
54
55     void remove_weak_automation_watch (boost::weak_ptr<ARDOUR::AutomationControl>);
56     void thread ();
57 };
58
59 }