root/trunk/libffado/src/motu/motu_controls.h

Revision 1006, 5.7 kB (checked in by jwoithe, 13 years ago)

MOTU: implement "phones source" control.
MOTU: commence work on optical mode control. For various reasons this isn't functional yet.

Line 
1 /*
2  * Copyright (C) 2005-2008 by Daniel Wagner
3  * Copyright (C) 2005-2008 by Pieter Palmers
4  * Copyright (C) 2008 by Jonathan Woithe
5  *
6  * This file is part of FFADO
7  * FFADO = Free Firewire (pro-)audio drivers for linux
8  *
9  * FFADO is based upon FreeBoB.
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 2 of the License, or
14  * (at your option) version 3 of the License.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23  *
24  */
25
26 #include "debugmodule/debugmodule.h"
27
28 #include "libcontrol/BasicElements.h"
29 #include "libcontrol/MatrixMixer.h"
30
31 namespace Motu {
32
33 class MotuDevice;
34
35 #define MOTU_CTRL_CHANNEL_FADER   0x00000001
36 #define MOTU_CTRL_CHANNEL_PAN     0x00000002
37 #define MOTU_CTRL_CHANNEL_SOLO    0x00000004
38 #define MOTU_CTRL_CHANNEL_MUTE    0x00000008
39 #define MOTU_CTRL_MIX_FADER       0x00000100
40 #define MOTU_CTRL_MIX_MUTE        0x00000200
41 #define MOTU_CTRL_MIX_DEST        0x00000400
42
43 #define MOTU_CTRL_INPUT_LEVEL     0x10000000
44 #define MOTU_CTRL_INPUT_BOOST     0x20000000
45 #define MOTU_CTRL_PHONES_SRC      0x40000000
46 #define MOTU_CTRL_OPTICAL_MODE    0x80000000
47
48 #define MOTU_CTRL_STD_CHANNEL \
49     (MOTU_CTRL_CHANNEL_FADER|MOTU_CTRL_CHANNEL_PAN|\
50      MOTU_CTRL_CHANNEL_SOLO|MOTU_CTRL_CHANNEL_MUTE)
51
52 #define MOTU_CTRL_STD_MIX \
53     (MOTU_CTRL_MIX_FADER|MOTU_CTRL_MIX_MUTE|\
54      MOTU_CTRL_MIX_DEST)
55
56 #define MOTU_CTRL_TRAVELER_LINE_INPUT_CTRLS \
57     (MOTU_CTRL_INPUT_LEVEL|MOTU_CTRL_INPUT_BOOST)
58
59 #define MOTU_CTRL_MASK_MUTE_VALUE          0x00010000
60 #define MOTU_CTRL_MASK_MUTE_SETENABLE      0x01000000
61 #define MOTU_CTRL_MASK_SOLO_VALUE          0x00020000
62 #define MOTU_CTRL_MASK_SOLO_SETENABLE      0x02000000
63
64 #define MOTU_CTRL_MASK_ANA5_INPUT_LEVEL    0x00000010
65 #define MOTU_CTRL_MASK_ANA6_INPUT_LEVEL    0x00000020
66 #define MOTU_CTRL_MASK_ANA7_INPUT_LEVEL    0x00000040
67 #define MOTU_CTRL_MASK_ANA8_INPUT_LEVEL    0x00000080
68
69 #define MOTU_INFO_IS_STREAMING             0x00000001
70 #define MOTU_INFO_SAMPLE_RATE              0x00000002
71 #define MOTU_INFO_HAS_MIC_INPUTS           0x00000003
72 #define MOTU_INFO_HAS_AESEBU_INPUTS        0x00000004
73 #define MOTU_INFO_HAS_SPDIF_INPUTS         0x00000005
74
75 class MotuDiscreteCtrl
76     : public Control::Discrete
77 {
78 public:
79     MotuDiscreteCtrl(MotuDevice &parent, unsigned int dev_reg);
80     MotuDiscreteCtrl(MotuDevice &parent, unsigned int dev_reg,
81           std::string name, std::string label, std::string descr);
82
83 protected:
84     MotuDevice    &m_parent;
85     unsigned int  m_register;
86 };
87
88 class MotuBinarySwitch
89     : public MotuDiscreteCtrl
90 {
91 public:
92     MotuBinarySwitch(MotuDevice &parent, unsigned int dev_reg,
93       unsigned int val_mask, unsigned int setenable_mask);
94     MotuBinarySwitch(MotuDevice &parent, unsigned int dev_reg,
95         unsigned int val_mask, unsigned int setenable_mask,
96         std::string name, std::string label, std::string descr);
97
98     virtual bool setValue(int v);
99     virtual int getValue();
100
101 protected:
102     unsigned int m_value_mask;
103     unsigned int m_setenable_mask;
104 };
105
106 class ChannelFader
107     : public MotuDiscreteCtrl
108 {
109 public:
110     ChannelFader(MotuDevice &parent, unsigned int dev_reg);
111     ChannelFader(MotuDevice &parent, unsigned int dev_reg,
112           std::string name, std::string label, std::string descr);
113
114     virtual bool setValue(int v);
115     virtual int getValue();
116 };
117
118 class ChannelPan
119     : public MotuDiscreteCtrl
120 {
121 public:
122     ChannelPan(MotuDevice &parent, unsigned int dev_reg);
123     ChannelPan(MotuDevice &parent, unsigned int dev_reg,
124           std::string name, std::string label, std::string descr);
125
126     virtual bool setValue(int v);
127     virtual int getValue();
128 };
129
130 class MixFader
131     : public MotuDiscreteCtrl
132 {
133 public:
134     MixFader(MotuDevice &parent, unsigned int dev_reg);
135     MixFader(MotuDevice &parent, unsigned int dev_reg,
136           std::string name, std::string label, std::string descr);
137
138     virtual bool setValue(int v);
139     virtual int getValue();
140 };
141
142 class MixMute
143     : public MotuDiscreteCtrl
144 {
145 public:
146     MixMute(MotuDevice &parent, unsigned int dev_reg);
147     MixMute(MotuDevice &parent, unsigned int dev_reg,
148           std::string name, std::string label, std::string descr);
149
150     virtual bool setValue(int v);
151     virtual int getValue();
152 };
153
154 class MixDest
155     : public MotuDiscreteCtrl
156 {
157 public:
158     MixDest(MotuDevice &parent, unsigned int dev_reg);
159     MixDest(MotuDevice &parent, unsigned int dev_reg,
160           std::string name, std::string label, std::string descr);
161
162     virtual bool setValue(int v);
163     virtual int getValue();
164 };
165
166 class PhonesSrc
167     : public MotuDiscreteCtrl
168 {
169 public:
170     PhonesSrc(MotuDevice &parent);
171     PhonesSrc(MotuDevice &parent,
172           std::string name, std::string label, std::string descr);
173
174     virtual bool setValue(int v);
175     virtual int getValue();
176 };
177
178 class OpticalMode
179     : public MotuDiscreteCtrl
180 {
181 public:
182     OpticalMode(MotuDevice &parent, unsigned int dev_reg);
183     OpticalMode(MotuDevice &parent, unsigned int dev_reg,
184           std::string name, std::string label, std::string descr);
185
186     virtual bool setValue(int v);
187     virtual int getValue();
188 };
189
190 class InfoElement
191     : public MotuDiscreteCtrl
192 {
193 public:
194     InfoElement(MotuDevice &parent, unsigned infotype);
195     InfoElement(MotuDevice &parent, unsigned infotype,
196           std::string name, std::string label, std::string descr);
197     virtual bool setValue(int v);
198     virtual int getValue();
199 };
200
201 }
Note: See TracBrowser for help on using the browser.