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

« back to all changes in this revision

Viewing changes to libs/surfaces/control_protocol/control_protocol/control_protocol.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 Paul Davis 
 
3
 
 
4
    This program is free software; you can redistribute it
 
5
    and/or modify it under the terms of the GNU Lesser
 
6
    General Public License as published by the Free Software
 
7
    Foundation; either version 2 of the License, or (at your
 
8
    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
 
 
21
#ifndef ardour_control_protocols_h
 
22
#define ardour_control_protocols_h
 
23
 
 
24
#include <string>
 
25
#include <vector>
 
26
#include <list>
 
27
 
 
28
#include <boost/shared_ptr.hpp>
 
29
 
 
30
#include "pbd/stateful.h"
 
31
#include "pbd/signals.h"
 
32
 
 
33
#include "control_protocol/basic_ui.h"
 
34
#include "control_protocol/types.h"
 
35
 
 
36
namespace ARDOUR {
 
37
 
 
38
class Route;
 
39
class Session;
 
40
class Bundle;
 
41
 
 
42
class ControlProtocol : public PBD::Stateful, public PBD::ScopedConnectionList, public BasicUI
 
43
{
 
44
  public:
 
45
        ControlProtocol (Session&, std::string name);
 
46
        virtual ~ControlProtocol();
 
47
 
 
48
        std::string name() const { return _name; }
 
49
 
 
50
        virtual int set_active (bool yn) = 0;
 
51
        bool get_active() const { return _active; }
 
52
 
 
53
        virtual int set_feedback (bool /*yn*/) { return 0; }
 
54
        virtual bool get_feedback () const { return false; }
 
55
 
 
56
        virtual void midi_connectivity_established () {}
 
57
 
 
58
        PBD::Signal0<void> ActiveChanged;
 
59
 
 
60
        /* signals that a control protocol can emit and other (presumably graphical)
 
61
           user interfaces can respond to
 
62
        */
 
63
 
 
64
        static PBD::Signal0<void> ZoomToSession;
 
65
        static PBD::Signal0<void> ZoomIn;
 
66
        static PBD::Signal0<void> ZoomOut;
 
67
        static PBD::Signal0<void> Enter;
 
68
        static PBD::Signal0<void> Undo;
 
69
        static PBD::Signal0<void> Redo;
 
70
        static PBD::Signal1<void,float> ScrollTimeline;
 
71
        static PBD::Signal1<void,uint32_t> GotoView;
 
72
        static PBD::Signal0<void> CloseDialog;
 
73
        static PBD::Signal0<void> VerticalZoomInAll;
 
74
        static PBD::Signal0<void> VerticalZoomOutAll;
 
75
        static PBD::Signal0<void> VerticalZoomInSelected;
 
76
        static PBD::Signal0<void> VerticalZoomOutSelected;
 
77
        static PBD::Signal0<void> StepTracksDown;
 
78
        static PBD::Signal0<void> StepTracksUp;
 
79
 
 
80
        static PBD::Signal1<void,uint32_t> AddRouteToSelection;
 
81
        static PBD::Signal1<void,uint32_t> SetRouteSelection;
 
82
        static PBD::Signal1<void,uint32_t> ToggleRouteSelection;
 
83
        static PBD::Signal1<void,uint32_t> RemoveRouteFromSelection;
 
84
        static PBD::Signal0<void>          ClearRouteSelection;
 
85
 
 
86
        /* signals that one UI (e.g. the GUI) can emit to get all other UI's to 
 
87
           respond. Typically this will always be GUI->"others" - the GUI pays
 
88
           no attention to these signals.
 
89
        */
 
90
        
 
91
        static PBD::Signal1<void,RouteNotificationListPtr> TrackSelectionChanged;
 
92
 
 
93
        /* the model here is as follows:
 
94
 
 
95
           we imagine most control surfaces being able to control
 
96
           from 1 to N tracks at a time, with a session that may
 
97
           contain 1 to M tracks, where M may be smaller, larger or
 
98
           equal to N. 
 
99
 
 
100
           the control surface has a fixed set of physical controllers
 
101
           which can potentially be mapped onto different tracks/busses
 
102
           via some mechanism.
 
103
 
 
104
           therefore, the control protocol object maintains
 
105
           a table that reflects the current mapping between
 
106
           the controls and route object.
 
107
        */
 
108
 
 
109
        void set_route_table_size (uint32_t size);
 
110
        void set_route_table (uint32_t table_index, boost::shared_ptr<ARDOUR::Route>);
 
111
        bool set_route_table (uint32_t table_index, uint32_t remote_control_id);
 
112
 
 
113
        void route_set_rec_enable (uint32_t table_index, bool yn);
 
114
        bool route_get_rec_enable (uint32_t table_index);
 
115
 
 
116
        float route_get_gain (uint32_t table_index);
 
117
        void route_set_gain (uint32_t table_index, float);
 
118
        float route_get_effective_gain (uint32_t table_index);
 
119
 
 
120
        float route_get_peak_input_power (uint32_t table_index, uint32_t which_input);
 
121
 
 
122
        bool route_get_muted (uint32_t table_index);
 
123
        void route_set_muted (uint32_t table_index, bool);
 
124
 
 
125
        bool route_get_soloed (uint32_t table_index);
 
126
        void route_set_soloed (uint32_t table_index, bool);
 
127
 
 
128
        std::string route_get_name (uint32_t table_index);
 
129
 
 
130
        virtual std::list<boost::shared_ptr<ARDOUR::Bundle> > bundles ();
 
131
 
 
132
        virtual bool  has_editor () const { return false; }
 
133
        virtual void* get_gui() const { return 0; }
 
134
        virtual void  tear_down_gui() { }
 
135
 
 
136
  protected:
 
137
        std::vector<boost::shared_ptr<ARDOUR::Route> > route_table;
 
138
        std::string _name;
 
139
        bool _active;
 
140
 
 
141
        void next_track (uint32_t initial_id);
 
142
        void prev_track (uint32_t initial_id);
 
143
 
 
144
  private:
 
145
        ControlProtocol (const ControlProtocol&); /* noncopyable */
 
146
};
 
147
 
 
148
extern "C" {
 
149
        class ControlProtocolDescriptor {
 
150
        public:
 
151
            const char* name;      /* descriptive */
 
152
            const char* id;        /* unique and version-specific */
 
153
            void*       ptr;       /* protocol can store a value here */
 
154
            void*       module;    /* not for public access */
 
155
            int         mandatory; /* if non-zero, always load and do not make optional */
 
156
            bool        supports_feedback; /* if true, protocol has toggleable feedback mechanism */
 
157
            bool             (*probe)(ControlProtocolDescriptor*);
 
158
            ControlProtocol* (*initialize)(ControlProtocolDescriptor*,Session*);
 
159
            void             (*destroy)(ControlProtocolDescriptor*,ControlProtocol*);
 
160
            
 
161
        };
 
162
}
 
163
 
 
164
}
 
165
 
 
166
#endif // ardour_control_protocols_h