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

Revision 1003, 5.1 kB (checked in by jwoithe, 13 years ago)

MOTU updates:

  • cleanup of "define" namespace. All MOTU-related defines now start with "MOTU_" rather than a mix of this and "MOTUFW_".
  • Significant cleanup of motu mixer UI definition and python code. Far less glue code is now needed.
  • Use generic binary switch control in mixer dbus interface where possibe.
  • Implement proof-of-concept input level/boost switches.
  • Provide mechanism to feed some device status back to the mixer application. Currently this is done only at startup but in time we'll need a way to poll for some of it as the mixer runs.
  • When streaming is active, disable controls whose operation is incompatible with an active streaming system.
  • Adapt active channels in the mixer to the current device state. The handling of optical input mode is still to be done.
  • Minor updates to MOTU protocol documentation.
  • Whitespace cleanup in mixer_motu.py for consistency with the "tab is 4 spaces" rule used elsewhere in FFADO's source code.
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
46 #define MOTU_CTRL_STD_CHANNEL \
47     (MOTU_CTRL_CHANNEL_FADER|MOTU_CTRL_CHANNEL_PAN|\
48      MOTU_CTRL_CHANNEL_SOLO|MOTU_CTRL_CHANNEL_MUTE)
49
50 #define MOTU_CTRL_STD_MIX \
51     (MOTU_CTRL_MIX_FADER|MOTU_CTRL_MIX_MUTE|\
52      MOTU_CTRL_MIX_DEST)
53
54 #define MOTU_CTRL_TRAVELER_LINE_INPUT_CTRLS \
55     (MOTU_CTRL_INPUT_LEVEL|MOTU_CTRL_INPUT_BOOST)
56
57 #define MOTU_CTRL_MASK_MUTE_VALUE          0x00010000
58 #define MOTU_CTRL_MASK_MUTE_SETENABLE      0x01000000
59 #define MOTU_CTRL_MASK_SOLO_VALUE          0x00020000
60 #define MOTU_CTRL_MASK_SOLO_SETENABLE      0x02000000
61
62 #define MOTU_CTRL_MASK_ANA5_INPUT_LEVEL    0x00000010
63 #define MOTU_CTRL_MASK_ANA6_INPUT_LEVEL    0x00000020
64 #define MOTU_CTRL_MASK_ANA7_INPUT_LEVEL    0x00000040
65 #define MOTU_CTRL_MASK_ANA8_INPUT_LEVEL    0x00000080
66
67 #define MOTU_INFO_IS_STREAMING             0x00000001
68 #define MOTU_INFO_SAMPLE_RATE              0x00000002
69 #define MOTU_INFO_HAS_MIC_INPUTS           0x00000003
70 #define MOTU_INFO_HAS_AESEBU_INPUTS        0x00000004
71 #define MOTU_INFO_HAS_SPDIF_INPUTS         0x00000005
72
73 class MotuDiscreteCtrl
74     : public Control::Discrete
75 {
76 public:
77     MotuDiscreteCtrl(MotuDevice &parent, unsigned int dev_reg);
78     MotuDiscreteCtrl(MotuDevice &parent, unsigned int dev_reg,
79           std::string name, std::string label, std::string descr);
80
81 protected:
82     MotuDevice    &m_parent;
83     unsigned int  m_register;
84 };
85
86 class MotuBinarySwitch
87     : public MotuDiscreteCtrl
88 {
89 public:
90     MotuBinarySwitch(MotuDevice &parent, unsigned int dev_reg,
91       unsigned int val_mask, unsigned int setenable_mask);
92     MotuBinarySwitch(MotuDevice &parent, unsigned int dev_reg,
93         unsigned int val_mask, unsigned int setenable_mask,
94         std::string name, std::string label, std::string descr);
95
96     virtual bool setValue(int v);
97     virtual int getValue();
98
99 protected:
100     unsigned int m_value_mask;
101     unsigned int m_setenable_mask;
102 };
103
104 class ChannelFader
105     : public MotuDiscreteCtrl
106 {
107 public:
108     ChannelFader(MotuDevice &parent, unsigned int dev_reg);
109     ChannelFader(MotuDevice &parent, unsigned int dev_reg,
110           std::string name, std::string label, std::string descr);
111
112     virtual bool setValue(int v);
113     virtual int getValue();
114 };
115
116 class ChannelPan
117     : public MotuDiscreteCtrl
118 {
119 public:
120     ChannelPan(MotuDevice &parent, unsigned int dev_reg);
121     ChannelPan(MotuDevice &parent, unsigned int dev_reg,
122           std::string name, std::string label, std::string descr);
123
124     virtual bool setValue(int v);
125     virtual int getValue();
126 };
127
128 class MixFader
129     : public MotuDiscreteCtrl
130 {
131 public:
132     MixFader(MotuDevice &parent, unsigned int dev_reg);
133     MixFader(MotuDevice &parent, unsigned int dev_reg,
134           std::string name, std::string label, std::string descr);
135
136     virtual bool setValue(int v);
137     virtual int getValue();
138 };
139
140 class MixMute
141     : public MotuDiscreteCtrl
142 {
143 public:
144     MixMute(MotuDevice &parent, unsigned int dev_reg);
145     MixMute(MotuDevice &parent, unsigned int dev_reg,
146           std::string name, std::string label, std::string descr);
147
148     virtual bool setValue(int v);
149     virtual int getValue();
150 };
151
152 class MixDest
153     : public MotuDiscreteCtrl
154 {
155 public:
156     MixDest(MotuDevice &parent, unsigned int dev_reg);
157     MixDest(MotuDevice &parent, unsigned int dev_reg,
158           std::string name, std::string label, std::string descr);
159
160     virtual bool setValue(int v);
161     virtual int getValue();
162 };
163
164 class InfoElement
165     : public MotuDiscreteCtrl
166 {
167 public:
168     InfoElement(MotuDevice &parent, unsigned infotype);
169     InfoElement(MotuDevice &parent, unsigned infotype,
170           std::string name, std::string label, std::string descr);
171     virtual bool setValue(int v);
172     virtual int getValue();
173 };
174
175 }
Note: See TracBrowser for help on using the browser.