Ardour  8.12
pannable.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011-2016 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef __libardour_pannable_h__
21 #define __libardour_pannable_h__
22 
23 #include <memory>
24 #include <string>
25 
26 #include "pbd/stateful.h"
27 #include "evoral/Parameter.h"
28 
29 #include "ardour/automatable.h"
30 #include "ardour/session_handle.h"
31 
32 namespace ARDOUR {
33 
34 class Session;
35 class AutomationControl;
36 class Panner;
37 
39 {
40 public:
43 
44  std::shared_ptr<AutomationControl> pan_azimuth_control;
45  std::shared_ptr<AutomationControl> pan_elevation_control;
46  std::shared_ptr<AutomationControl> pan_width_control;
47  std::shared_ptr<AutomationControl> pan_frontback_control;
48  std::shared_ptr<AutomationControl> pan_lfe_control;
49 
50  std::shared_ptr<Panner> panner() const { return _panner.lock(); }
51  void set_panner(std::shared_ptr<Panner>);
52 
53  const std::set<Evoral::Parameter>& what_can_be_automated() const;
54 
56  AutoState automation_state() const { return _auto_state; }
57  PBD::Signal1<void, AutoState> automation_state_changed;
58 
59  bool automation_playback() const {
60  return (_auto_state & Play) || ((_auto_state & (Touch | Latch)) && !touching());
61  }
62  bool automation_write () const {
63  return ((_auto_state & Write) || ((_auto_state & (Touch | Latch)) && touching()));
64  }
65 
66  void start_touch (timepos_t const & when);
67  void stop_touch (timepos_t const & when);
68 
69  bool touching() const { return _touching.load(); }
70 
71  bool writing() const { return _auto_state == Write; }
72  bool touch_enabled() const { return _auto_state & (Touch | Latch); }
73 
74  XMLNode& get_state () const;
75  int set_state (const XMLNode&, int version);
76 
77  bool has_state() const { return _has_state; }
78 
81 
82 protected:
83  virtual XMLNode& state () const;
84 
85  std::weak_ptr<Panner> _panner;
87  bool _has_state;
89 
90  std::atomic<int> _touching;
91 
93 
94 private:
95  void value_changed ();
96 };
97 
98 } // namespace
99 
100 #endif /* __libardour_pannable_h__ */
std::atomic< int > _touching
Definition: pannable.h:90
std::shared_ptr< AutomationControl > pan_frontback_control
Definition: pannable.h:47
int set_state(const XMLNode &, int version)
uint32_t _responding_to_control_auto_state_change
Definition: pannable.h:88
virtual XMLNode & state() const
void set_automation_state(AutoState)
bool automation_write() const
Definition: pannable.h:62
std::weak_ptr< Panner > _panner
Definition: pannable.h:85
AutoState _auto_state
Definition: pannable.h:86
std::shared_ptr< AutomationControl > pan_lfe_control
Definition: pannable.h:48
bool automation_playback() const
Definition: pannable.h:59
std::shared_ptr< AutomationControl > pan_azimuth_control
Definition: pannable.h:44
void stop_touch(timepos_t const &when)
AutoState automation_state() const
Definition: pannable.h:56
PBD::Signal1< void, AutoState > automation_state_changed
Definition: pannable.h:57
bool writing() const
Definition: pannable.h:71
std::shared_ptr< Panner > panner() const
Definition: pannable.h:50
XMLNode & get_state() const
void start_domain_bounce(Temporal::DomainBounceInfo &)
Pannable(Session &s, Temporal::TimeDomainProvider const &)
void start_touch(timepos_t const &when)
const std::set< Evoral::Parameter > & what_can_be_automated() const
void control_auto_state_changed(AutoState)
void finish_domain_bounce(Temporal::DomainBounceInfo &)
bool has_state() const
Definition: pannable.h:77
std::shared_ptr< AutomationControl > pan_width_control
Definition: pannable.h:46
std::shared_ptr< AutomationControl > pan_elevation_control
Definition: pannable.h:45
bool touch_enabled() const
Definition: pannable.h:72
bool touching() const
Definition: pannable.h:69
void set_panner(std::shared_ptr< Panner >)
Definition: xml++.h:114
#define LIBARDOUR_API