root/trunk/libffado/src/fireworks/fireworks_control.h

Revision 1630, 7.0 kB (checked in by ppalmers, 12 years ago)

add base level support for the DICE EAP based mixers (incomplete)

Line 
1 /*
2  * Copyright (C) 2005-2008 by Daniel Wagner
3  * Copyright (C) 2005-2008 by Pieter Palmers
4  *
5  * This file is part of FFADO
6  * FFADO = Free Firewire (pro-)audio drivers for linux
7  *
8  * FFADO is based upon FreeBoB.
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 2 of the License, or
13  * (at your option) version 3 of the License.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22  *
23  */
24
25 #ifndef FIREWORKS_MATRIX_CONTROL_H
26 #define FIREWORKS_MATRIX_CONTROL_H
27
28 #include "debugmodule/debugmodule.h"
29
30 #include "efc/efc_cmd.h"
31 #include "efc/efc_cmds_hardware.h"
32 #include "efc/efc_cmds_mixer.h"
33 #include "efc/efc_cmds_monitor.h"
34 #include "efc/efc_cmds_ioconfig.h"
35
36 #include "libcontrol/BasicElements.h"
37 #include "libcontrol/MatrixMixer.h"
38
39 #include <pthread.h>
40
41 class ConfigRom;
42 class Ieee1394Service;
43
44 namespace FireWorks {
45
46 class MonitorControl : public Control::MatrixMixer
47 {
48 public:
49     enum eMonitorControl {
50         eMC_Gain,
51         eMC_Solo,
52         eMC_Mute,
53         eMC_Pan,
54     };
55
56 public:
57     MonitorControl(FireWorks::Device& parent, enum eMonitorControl);
58     MonitorControl(FireWorks::Device& parent, enum eMonitorControl, std::string n);
59     virtual ~MonitorControl() {};
60
61     virtual void show();
62
63     virtual std::string getRowName( const int );
64     virtual std::string getColName( const int );
65     virtual int canWrite( const int, const int );
66     virtual double setValue( const int, const int, const double );
67     virtual double getValue( const int, const int );
68     virtual int getRowCount( );
69     virtual int getColCount( );
70
71     // full map updates are unsupported
72     virtual bool getCoefficientMap(int &) {return false;};
73     virtual bool storeCoefficientMap(int &) {return false;};
74
75 protected:
76     enum eMonitorControl        m_control;
77     FireWorks::Device&          m_ParentDevice;
78 };
79
80
81 class SimpleControl : public Control::Continuous
82 {
83
84 public:
85     SimpleControl(FireWorks::Device& parent,
86                   enum eMixerTarget, enum eMixerCommand,
87                   int channel);
88     SimpleControl(FireWorks::Device& parent,
89                   enum eMixerTarget, enum eMixerCommand,
90                   int channel, std::string n);
91     virtual ~SimpleControl();
92
93     virtual void show();
94
95     virtual bool setValue( const double );
96     virtual double getValue( );
97     virtual bool setValue(int idx, double v)
98         {return setValue(v);};
99     virtual double getValue(int idx)
100         {return getValue();};
101
102     virtual double getMinimum() {return -100.0;};
103     virtual double getMaximum() {return 10.0;};
104
105 protected:
106     EfcGenericMixerCmd*         m_Slave;
107     FireWorks::Device&          m_ParentDevice;
108 };
109
110 // for on-off type of controls
111
112 class BinaryControl : public Control::Discrete
113 {
114
115 public:
116     BinaryControl(FireWorks::Device& parent,
117                   enum eMixerTarget, enum eMixerCommand,
118                   int channel, int bit);
119     BinaryControl(FireWorks::Device& parent,
120                   enum eMixerTarget, enum eMixerCommand,
121                   int channel, int bit, std::string n);
122     virtual ~BinaryControl();
123
124     virtual void show();
125
126     virtual bool setValue( const int );
127     virtual int getValue( );
128     virtual bool setValue(int idx, int v)
129         {return setValue(v);};
130     virtual int getValue(int idx)
131         {return getValue();};
132
133     virtual int getMinimum() {return 0;};
134     virtual int getMaximum() {return 1;};
135 protected:
136     int                         m_bit;
137     EfcGenericMixerCmd*         m_Slave;
138     FireWorks::Device&          m_ParentDevice;
139 };
140
141 class SpdifModeControl : public Control::Discrete
142 {
143
144 public:
145     SpdifModeControl(FireWorks::Device& parent);
146     SpdifModeControl(FireWorks::Device& parent,
147                     std::string n);
148     virtual ~SpdifModeControl();
149
150     virtual void show();
151
152     virtual bool setValue( const int );
153     virtual int getValue( );
154     virtual bool setValue(int idx, int v)
155         {return setValue(v);};
156     virtual int getValue(int idx)
157         {return getValue();};
158
159     virtual int getMinimum() {return 0;};
160     virtual int getMaximum() {return 0;};
161
162 protected:
163     FireWorks::Device&          m_ParentDevice;
164 };
165
166
167 // for on-off type of controls
168
169 class IOConfigControl : public Control::Discrete
170 {
171
172 public:
173     IOConfigControl(FireWorks::Device& parent,
174                     enum eIOConfigRegister);
175     IOConfigControl(FireWorks::Device& parent,
176                     enum eIOConfigRegister,
177                     std::string n);
178     virtual ~IOConfigControl();
179
180     virtual void show();
181
182     virtual bool setValue( const int );
183     virtual int getValue( );
184     virtual bool setValue(int idx, int v)
185         {return setValue(v);};
186     virtual int getValue(int idx)
187         {return getValue();};
188
189     virtual int getMinimum() {return 0;};
190     virtual int getMaximum() {return 0;};
191
192 protected:
193     int                         m_bit;
194     EfcGenericIOConfigCmd*      m_Slave;
195     FireWorks::Device&          m_ParentDevice;
196 };
197
198
199 class HwInfoControl : public Control::Discrete
200 {
201 public:
202
203     enum eHwInfoField {
204         eHIF_PhysicalAudioOutCount,
205         eHIF_PhysicalAudioInCount,
206         eHIF_1394PlaybackCount,
207         eHIF_1394RecordCount,
208         eHIF_GroupOutCount,
209         eHIF_GroupInCount,
210         eHIF_PhantomPower,
211     };
212 public:
213     HwInfoControl(FireWorks::Device& parent,
214                   enum eHwInfoField);
215     HwInfoControl(FireWorks::Device& parent,
216                   enum eHwInfoField, std::string n);
217     virtual ~HwInfoControl();
218
219     virtual void show();
220
221     virtual bool setValue( const int ) {return false;};
222     virtual int getValue( );
223     virtual bool setValue(int idx, int v)
224         {return setValue(v);};
225     virtual int getValue(int idx)
226         {return getValue();};
227
228     virtual int getMinimum() {return 0;};
229     virtual int getMaximum() {return 0;};
230
231 protected:
232     FireWorks::Device&          m_ParentDevice;
233     enum eHwInfoField           m_Field;
234 };
235
236 class MultiControl : public Control::Discrete
237 {
238 public:
239
240     enum eType {
241         eT_SaveSession,
242         eT_Identify,
243     };
244 public:
245     MultiControl(FireWorks::Device& parent, enum eType);
246     MultiControl(FireWorks::Device& parent, enum eType,
247                         std::string n);
248     virtual ~MultiControl();
249
250     virtual void show();
251
252     virtual bool setValue( const int );
253     virtual int getValue( ) {return 0;};
254     virtual bool setValue(int idx, int v)
255         {return setValue(v);};
256     virtual int getValue(int idx)
257         {return getValue();};
258
259     virtual int getMinimum() {return 0;};
260     virtual int getMaximum() {return 0;};
261
262 protected:
263     FireWorks::Device&  m_ParentDevice;
264     enum eType          m_Type;
265 };
266
267 } // namespace FireWorks
268
269 #endif
Note: See TracBrowser for help on using the browser.