Ardour  9.0-pre0-582-g084a23a80d
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 #pragma once
21 
22 #include <memory>
23 #include <string>
24 
25 #include "pbd/stateful.h"
26 #include "evoral/Parameter.h"
27 
28 #include "ardour/automatable.h"
29 #include "ardour/session_handle.h"
30 
31 namespace ARDOUR {
32 
33 class Session;
34 class AutomationControl;
35 class Panner;
36 
38 {
39 public:
42 
43  std::shared_ptr<AutomationControl> pan_azimuth_control;
44  std::shared_ptr<AutomationControl> pan_elevation_control;
45  std::shared_ptr<AutomationControl> pan_width_control;
46  std::shared_ptr<AutomationControl> pan_frontback_control;
47  std::shared_ptr<AutomationControl> pan_lfe_control;
48 
49  std::shared_ptr<Panner> panner() const { return _panner.lock(); }
50  void set_panner(std::shared_ptr<Panner>);
51 
52  const std::set<Evoral::Parameter>& what_can_be_automated() const;
53 
55  AutoState automation_state() const { return _auto_state; }
57 
58  bool automation_playback() const {
59  return (_auto_state & Play) || ((_auto_state & (Touch | Latch)) && !touching());
60  }
61  bool automation_write () const {
62  return ((_auto_state & Write) || ((_auto_state & (Touch | Latch)) && touching()));
63  }
64 
65  void start_touch (timepos_t const & when);
66  void stop_touch (timepos_t const & when);
67 
68  bool touching() const { return _touching.load(); }
69 
70  bool writing() const { return _auto_state == Write; }
71  bool touch_enabled() const { return _auto_state & (Touch | Latch); }
72 
73  XMLNode& get_state () const;
74  int set_state (const XMLNode&, int version);
75 
76  bool has_state() const { return _has_state; }
77 
80 
81 protected:
82  virtual XMLNode& state () const;
83 
84  std::weak_ptr<Panner> _panner;
86  bool _has_state;
88 
89  std::atomic<int> _touching;
90 
92 
93 private:
94  void value_changed ();
95 };
96 
97 } // namespace
98 
std::atomic< int > _touching
Definition: pannable.h:89
std::shared_ptr< AutomationControl > pan_frontback_control
Definition: pannable.h:46
int set_state(const XMLNode &, int version)
uint32_t _responding_to_control_auto_state_change
Definition: pannable.h:87
virtual XMLNode & state() const
void set_automation_state(AutoState)
bool automation_write() const
Definition: pannable.h:61
std::weak_ptr< Panner > _panner
Definition: pannable.h:84
AutoState _auto_state
Definition: pannable.h:85
std::shared_ptr< AutomationControl > pan_lfe_control
Definition: pannable.h:47
bool automation_playback() const
Definition: pannable.h:58
PBD::Signal< void(AutoState)> automation_state_changed
Definition: pannable.h:56
std::shared_ptr< AutomationControl > pan_azimuth_control
Definition: pannable.h:43
void stop_touch(timepos_t const &when)
AutoState automation_state() const
Definition: pannable.h:55
bool writing() const
Definition: pannable.h:70
std::shared_ptr< Panner > panner() const
Definition: pannable.h:49
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:76
std::shared_ptr< AutomationControl > pan_width_control
Definition: pannable.h:45
std::shared_ptr< AutomationControl > pan_elevation_control
Definition: pannable.h:44
bool touch_enabled() const
Definition: pannable.h:71
bool touching() const
Definition: pannable.h:68
void set_panner(std::shared_ptr< Panner >)
Definition: xml++.h:114
#define LIBARDOUR_API