ardour
pannable.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 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 __libardour_pannable_h__
21 #define __libardour_pannable_h__
22 
23 #include <string>
24 
25 #include <boost/shared_ptr.hpp>
26 
27 #include "pbd/stateful.h"
28 #include "evoral/Parameter.hpp"
29 
30 #include "ardour/automatable.h"
31 #include "ardour/session_handle.h"
32 
33 namespace ARDOUR {
34 
35 class Session;
36 class AutomationControl;
37 class Panner;
38 
40 {
41  public:
42  Pannable (Session& s);
43  ~Pannable ();
44 
50 
51  boost::shared_ptr<Panner> panner() const { return _panner.lock(); }
52  void set_panner(boost::shared_ptr<Panner>);
53 
54  Session& session() { return _session; }
55 
56  void set_automation_state (AutoState);
57  AutoState automation_state() const { return _auto_state; }
58  PBD::Signal1<void, AutoState> automation_state_changed;
59 
60  void set_automation_style (AutoStyle m);
61  AutoStyle automation_style() const { return _auto_style; }
62  PBD::Signal0<void> automation_style_changed;
63 
64  bool automation_playback() const {
65  return (_auto_state & Play) || ((_auto_state & Touch) && !touching());
66  }
67  bool automation_write () const {
68  return ((_auto_state & Write) || ((_auto_state & Touch) && touching()));
69  }
70 
72 
73  void start_touch (double when);
74  void stop_touch (bool mark, double when);
75  bool touching() const { return g_atomic_int_get (const_cast<gint*>(&_touching)); }
76  bool writing() const { return _auto_state == Write; }
77  bool touch_enabled() const { return _auto_state == Touch; }
78 
79  XMLNode& get_state ();
80  XMLNode& state (bool full_state);
81  int set_state (const XMLNode&, int version);
82 
83  bool has_state() const { return _has_state; }
84 
85  protected:
89  gint _touching;
90  bool _has_state;
92 
93  void control_auto_state_changed (AutoState);
94 
95  private:
96  void value_changed ();
97 };
98 
99 } // namespace
100 
101 #endif /* __libardour_pannable_h__ */
AutoState automation_state() const
Definition: pannable.h:57
AutoStyle _auto_style
Definition: pannable.h:88
bool automation_playback() const
Definition: pannable.h:64
PBD::Signal0< void > automation_style_changed
Definition: pannable.h:62
AutoState _auto_state
Definition: pannable.h:87
bool has_state() const
Definition: pannable.h:83
std::string value_as_string(const ARDOUR::ParameterDescriptor &desc, double v)
boost::shared_ptr< AutomationControl > pan_elevation_control
Definition: pannable.h:46
boost::weak_ptr< Panner > _panner
Definition: pannable.h:86
AutoStyle
Definition: types.h:155
bool writing() const
Definition: pannable.h:76
PBD::Signal1< void, AutoState > automation_state_changed
Definition: pannable.h:58
bool touching() const
Definition: pannable.h:75
Definition: amp.h:29
Session & session()
Definition: pannable.h:54
boost::shared_ptr< AutomationControl > pan_frontback_control
Definition: pannable.h:48
boost::shared_ptr< AutomationControl > pan_azimuth_control
Definition: pannable.h:45
AutoStyle automation_style() const
Definition: pannable.h:61
boost::shared_ptr< Panner > panner() const
Definition: pannable.h:51
uint32_t _responding_to_control_auto_state_change
Definition: pannable.h:91
#define LIBARDOUR_API
bool touch_enabled() const
Definition: pannable.h:77
boost::shared_ptr< AutomationControl > pan_width_control
Definition: pannable.h:47
Definition: xml++.h:95
boost::shared_ptr< AutomationControl > pan_lfe_control
Definition: pannable.h:49
bool automation_write() const
Definition: pannable.h:67
AutoState
Definition: types.h:145