ardour
automation_list.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002 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 #ifndef __ardour_automation_event_h__
21 #define __ardour_automation_event_h__
22 
23 #include <stdint.h>
24 #include <cstdlib>
25 #include <list>
26 #include <cmath>
27 
28 #include <glibmm/threads.h>
29 
30 #include "evoral/ControlList.hpp"
31 #include "evoral/Parameter.hpp"
32 
33 #include "pbd/undo.h"
34 #include "pbd/xml++.h"
36 #include "pbd/properties.h"
37 
38 #include "ardour/ardour.h"
39 
40 namespace ARDOUR {
41 
42 class AutomationList;
43 
46 {
47 public:
49  : PBD::SharedStatefulProperty<AutomationList> (d.property_id, p)
50  {}
51 
53  : PBD::SharedStatefulProperty<AutomationList> (d.property_id, o, c)
54  {}
55 
56  PBD::PropertyBase* clone () const;
57 
58 private:
59  /* No copy-construction nor assignment */
62 };
63 
65 {
66  public:
71  AutomationList (const AutomationList&, double start, double end);
72  ~AutomationList();
73 
74  virtual boost::shared_ptr<ControlList> create(const Evoral::Parameter& id,
75  const Evoral::ParameterDescriptor& desc);
76 
77  AutomationList& operator= (const AutomationList&);
78 
79  void thaw ();
80 
81  void set_automation_state (AutoState);
82  AutoState automation_state() const { return _state; }
83  PBD::Signal1<void, AutoState> automation_state_changed;
84 
85  void set_automation_style (AutoStyle m);
86  AutoStyle automation_style() const { return _style; }
87  PBD::Signal0<void> automation_style_changed;
88 
89  bool automation_playback() const {
90  return (_state & Play) || ((_state & Touch) && !touching());
91  }
92  bool automation_write () const {
93  return ((_state & Write) || ((_state & Touch) && touching()));
94  }
95 
96  PBD::Signal0<void> StateChanged;
97 
98  static PBD::Signal1<void,AutomationList*> AutomationListCreated;
99 
100  void start_touch (double when);
101  void stop_touch (bool mark, double when);
102  bool touching() const { return g_atomic_int_get (const_cast<gint*>(&_touching)); }
103  bool writing() const { return _state == Write; }
104  bool touch_enabled() const { return _state == Touch; }
105 
106  XMLNode& get_state ();
107  int set_state (const XMLNode &, int version);
108  XMLNode& state (bool full);
109  XMLNode& serialize_events ();
110 
111  bool operator!= (const AutomationList &) const;
112 
113  private:
114  void create_curve_if_necessary ();
115  int deserialize_events (const XMLNode&);
116 
117  void maybe_signal_changed ();
118 
121  gint _touching;
122 
123  bool operator== (const AutomationList&) const { /* not called */ abort(); return false; }
124 };
125 
126 } // namespace
127 
128 #endif /* __ardour_automation_event_h__ */
AutomationListProperty(PBD::PropertyDescriptor< boost::shared_ptr< AutomationList > > d, Ptr o, Ptr c)
bool operator!=(shared_ptr< T > const &a, shared_ptr< U > const &b)
Definition: shared_ptr.hpp:360
AutomationListProperty(PBD::PropertyDescriptor< boost::shared_ptr< AutomationList > > d, Ptr p)
bool touch_enabled() const
LIBARDOUR_API PBD::PropertyDescriptor< framepos_t > start
Definition: region.cc:63
AutoStyle
Definition: types.h:155
AutoStyle automation_style() const
AutoState automation_state() const
Definition: amp.h:29
bool automation_playback() const
bool automation_write() const
PBD::Signal0< void > automation_style_changed
#define LIBARDOUR_API
PBD::Signal0< void > StateChanged
Definition: xml++.h:95
bool operator==(const RouteProcessorSelection &a, const RouteProcessorSelection &b)
Definition: debug.h:30
static PBD::Signal1< void, AutomationList * > AutomationListCreated
PBD::Signal1< void, AutoState > automation_state_changed
AutoState
Definition: types.h:145