Ardour  9.0-pre0-384-ga76afae0e9
mackie/controls.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2007 John Anderson
3  * Copyright (C) 2008-2016 Paul Davis <paul@linuxaudiosystems.com>
4  * Copyright (C) 2011 Carl Hetherington <carl@carlh.net>
5  * Copyright (C) 2015-2017 Robin Gareus <robin@gareus.org>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21 
22 #ifndef __mackie_controls_h__
23 #define __mackie_controls_h__
24 
25 #include <map>
26 #include <vector>
27 #include <string>
28 #include <stdint.h>
29 
30 #include "pbd/controllable.h"
31 #include "pbd/signals.h"
32 
33 #include "temporal/timeline.h"
34 
36 #include "midi_byte_array.h"
37 
38 namespace ARDOUR {
39  class AutomationControl;
40 }
41 
42 namespace ArdourSurface { namespace MACKIE_NAMESPACE {
43 
44 class Strip;
45 class Group;
46 class Surface;
47 
48 class Control {
49 public:
50  Control (int id, std::string name, Group& group);
51  virtual ~Control() {}
52 
53  int id() const { return _id; }
54  const std::string & name() const { return _name; }
55  Group & group() const { return _group; }
56 
57  bool in_use () const;
58  void set_in_use (bool);
59 
60  // Keep track of the timeout so it can be updated with more incoming events
61  sigc::connection in_use_connection;
62 
63  virtual MidiByteArray zero() = 0;
64 
69 
70  std::shared_ptr<ARDOUR::AutomationControl> control () const { return normal_ac; }
71  virtual void set_control (std::shared_ptr<ARDOUR::AutomationControl>);
72 
73  float get_value ();
75 
76  virtual void start_touch (Temporal::timepos_t const & when);
77  virtual void stop_touch (Temporal::timepos_t const & when);
78 
79  protected:
80  std::shared_ptr<ARDOUR::AutomationControl> normal_ac;
81 
82  private:
83  int _id; /* possibly device-dependent ID */
84  std::string _name;
86  bool _in_use;
87 };
88 
89 }
90 }
91 
92 std::ostream & operator << (std::ostream & os, const ArdourSurface::MACKIE_NAMESPACE::Control & control);
93 
94 #endif /* __mackie_controls_h__ */
virtual void set_control(std::shared_ptr< ARDOUR::AutomationControl >)
std::shared_ptr< ARDOUR::AutomationControl > normal_ac
Control(int id, std::string name, Group &group)
virtual MidiByteArray zero()=0
std::shared_ptr< ARDOUR::AutomationControl > control() const
sigc::connection in_use_connection
virtual void start_touch(Temporal::timepos_t const &when)
void set_value(float val, PBD::Controllable::GroupControlDisposition gcd=PBD::Controllable::UseGroup)
const std::string & name() const
virtual void stop_touch(Temporal::timepos_t const &when)
GtkImageIconNameData name
Definition: gtkimage.h:6
std::ostream & operator<<(std::ostream &os, const ArdourSurface::NS_MCU ::Control &control)
#define MACKIE_NAMESPACE