~ubuntu-branches/ubuntu/utopic/ardour3/utopic

« back to all changes in this revision

Viewing changes to libs/surfaces/mackie/controls.h

  • Committer: Package Import Robot
  • Author(s): Felipe Sateler
  • Date: 2013-09-21 19:05:02 UTC
  • Revision ID: package-import@ubuntu.com-20130921190502-8gsftrku6jnzhd7v
Tags: upstream-3.4~dfsg
ImportĀ upstreamĀ versionĀ 3.4~dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
        Copyright (C) 2006,2007 John Anderson
 
3
        Copyright (C) 2012 Paul Davis
 
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
 
16
        along with this program; if not, write to the Free Software
 
17
        Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
18
*/
 
19
 
 
20
#ifndef __mackie_controls_h__
 
21
#define __mackie_controls_h__
 
22
 
 
23
#include <map>
 
24
#include <vector>
 
25
#include <string>
 
26
#include <stdint.h>
 
27
 
 
28
#include <boost/smart_ptr.hpp>
 
29
 
 
30
#include "pbd/signals.h"
 
31
 
 
32
#include "mackie_control_exception.h"
 
33
#include "midi_byte_array.h"
 
34
 
 
35
namespace ARDOUR {
 
36
        class AutomationControl;
 
37
}
 
38
 
 
39
namespace Mackie
 
40
{
 
41
 
 
42
class Strip;
 
43
class Group;
 
44
class Surface;
 
45
 
 
46
class Control
 
47
{
 
48
public:
 
49
        Control (int id, std::string name, Group& group);
 
50
        virtual ~Control() {}
 
51
        
 
52
        int id() const { return _id; }
 
53
        const std::string & name() const  { return _name; }
 
54
        Group & group() const { return _group; }
 
55
 
 
56
        bool in_use () const;
 
57
        void set_in_use (bool);
 
58
        
 
59
        /// Keep track of the timeout so it can be updated with more incoming events
 
60
        sigc::connection in_use_connection;
 
61
 
 
62
        virtual MidiByteArray zero() = 0;
 
63
 
 
64
        /** If we are doing an in_use timeout for a fader without touch, this
 
65
         *  is its touch button control; otherwise 0.
 
66
         */
 
67
        Control* in_use_touch_control;
 
68
 
 
69
        boost::shared_ptr<ARDOUR::AutomationControl> control () const { return normal_ac; }
 
70
        virtual void set_control (boost::shared_ptr<ARDOUR::AutomationControl>);
 
71
 
 
72
        float get_value ();
 
73
        void set_value (float val);
 
74
        
 
75
        virtual void start_touch (double when);
 
76
        virtual void stop_touch (double when, bool mark);
 
77
 
 
78
  protected:
 
79
        boost::shared_ptr<ARDOUR::AutomationControl> normal_ac;
 
80
 
 
81
  private:
 
82
        int _id; /* possibly device-dependent ID */
 
83
        std::string _name;
 
84
        Group& _group;
 
85
        bool _in_use;
 
86
};
 
87
 
 
88
std::ostream & operator <<  (std::ostream & os, const Control & control);
 
89
 
 
90
}
 
91
 
 
92
#endif /* __mackie_controls_h__ */