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

Revision 1742, 7.1 kB (checked in by arnonym, 11 years ago)

Extend the interface of the MatrixMixer?:

  • Have booleans indicating if names and/or connections are supported. These functions are pure virtual.
  • Allow names and connections to be read and written, the default implementations of these (not anymore pure) virtual functions do nothing and return false or nothing.
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     bool hasNames() const { return true; }
64     virtual std::string getRowName( const int );
65     virtual std::string getColName( const int );
66     virtual int canWrite( const int, const int );
67     virtual double setValue( const int, const int, const double );
68     virtual double getValue( const int, const int );
69     virtual int getRowCount( );
70     virtual int getColCount( );
71
72     bool canConnect() const { return false; }
73
74     // full map updates are unsupported
75     virtual bool getCoefficientMap(int &) {return false;};
76     virtual bool storeCoefficientMap(int &) {return false;};
77
78 protected:
79     enum eMonitorControl        m_control;
80     FireWorks::Device&          m_ParentDevice;
81 };
82
83
84 class SimpleControl : public Control::Continuous
85 {
86
87 public:
88     SimpleControl(FireWorks::Device& parent,
89                   enum eMixerTarget, enum eMixerCommand,
90                   int channel);
91     SimpleControl(FireWorks::Device& parent,
92                   enum eMixerTarget, enum eMixerCommand,
93                   int channel, std::string n);
94     virtual ~SimpleControl();
95
96     virtual void show();
97
98     virtual bool setValue( const double );
99     virtual double getValue( );
100     virtual bool setValue(int idx, double v)
101         {return setValue(v);};
102     virtual double getValue(int idx)
103         {return getValue();};
104
105     virtual double getMinimum() {return -100.0;};
106     virtual double getMaximum() {return 10.0;};
107
108 protected:
109     EfcGenericMixerCmd*         m_Slave;
110     FireWorks::Device&          m_ParentDevice;
111 };
112
113 // for on-off type of controls
114
115 class BinaryControl : public Control::Discrete
116 {
117
118 public:
119     BinaryControl(FireWorks::Device& parent,
120                   enum eMixerTarget, enum eMixerCommand,
121                   int channel, int bit);
122     BinaryControl(FireWorks::Device& parent,
123                   enum eMixerTarget, enum eMixerCommand,
124                   int channel, int bit, std::string n);
125     virtual ~BinaryControl();
126
127     virtual void show();
128
129     virtual bool setValue( const int );
130     virtual int getValue( );
131     virtual bool setValue(int idx, int v)
132         {return setValue(v);};
133     virtual int getValue(int idx)
134         {return getValue();};
135
136     virtual int getMinimum() {return 0;};
137     virtual int getMaximum() {return 1;};
138 protected:
139     int                         m_bit;
140     EfcGenericMixerCmd*         m_Slave;
141     FireWorks::Device&          m_ParentDevice;
142 };
143
144 class SpdifModeControl : public Control::Discrete
145 {
146
147 public:
148     SpdifModeControl(FireWorks::Device& parent);
149     SpdifModeControl(FireWorks::Device& parent,
150                     std::string n);
151     virtual ~SpdifModeControl();
152
153     virtual void show();
154
155     virtual bool setValue( const int );
156     virtual int getValue( );
157     virtual bool setValue(int idx, int v)
158         {return setValue(v);};
159     virtual int getValue(int idx)
160         {return getValue();};
161
162     virtual int getMinimum() {return 0;};
163     virtual int getMaximum() {return 0;};
164
165 protected:
166     FireWorks::Device&          m_ParentDevice;
167 };
168
169
170 // for on-off type of controls
171
172 class IOConfigControl : public Control::Discrete
173 {
174
175 public:
176     IOConfigControl(FireWorks::Device& parent,
177                     enum eIOConfigRegister);
178     IOConfigControl(FireWorks::Device& parent,
179                     enum eIOConfigRegister,
180                     std::string n);
181     virtual ~IOConfigControl();
182
183     virtual void show();
184
185     virtual bool setValue( const int );
186     virtual int getValue( );
187     virtual bool setValue(int idx, int v)
188         {return setValue(v);};
189     virtual int getValue(int idx)
190         {return getValue();};
191
192     virtual int getMinimum() {return 0;};
193     virtual int getMaximum() {return 0;};
194
195 protected:
196     int                         m_bit;
197     EfcGenericIOConfigCmd*      m_Slave;
198     FireWorks::Device&          m_ParentDevice;
199 };
200
201
202 class HwInfoControl : public Control::Discrete
203 {
204 public:
205
206     enum eHwInfoField {
207         eHIF_PhysicalAudioOutCount,
208         eHIF_PhysicalAudioInCount,
209         eHIF_1394PlaybackCount,
210         eHIF_1394RecordCount,
211         eHIF_GroupOutCount,
212         eHIF_GroupInCount,
213         eHIF_PhantomPower,
214     };
215 public:
216     HwInfoControl(FireWorks::Device& parent,
217                   enum eHwInfoField);
218     HwInfoControl(FireWorks::Device& parent,
219                   enum eHwInfoField, std::string n);
220     virtual ~HwInfoControl();
221
222     virtual void show();
223
224     virtual bool setValue( const int ) {return false;};
225     virtual int getValue( );
226     virtual bool setValue(int idx, int v)
227         {return setValue(v);};
228     virtual int getValue(int idx)
229         {return getValue();};
230
231     virtual int getMinimum() {return 0;};
232     virtual int getMaximum() {return 0;};
233
234 protected:
235     FireWorks::Device&          m_ParentDevice;
236     enum eHwInfoField           m_Field;
237 };
238
239 class MultiControl : public Control::Discrete
240 {
241 public:
242
243     enum eType {
244         eT_SaveSession,
245         eT_Identify,
246     };
247 public:
248     MultiControl(FireWorks::Device& parent, enum eType);
249     MultiControl(FireWorks::Device& parent, enum eType,
250                         std::string n);
251     virtual ~MultiControl();
252
253     virtual void show();
254
255     virtual bool setValue( const int );
256     virtual int getValue( ) {return 0;};
257     virtual bool setValue(int idx, int v)
258         {return setValue(v);};
259     virtual int getValue(int idx)
260         {return getValue();};
261
262     virtual int getMinimum() {return 0;};
263     virtual int getMaximum() {return 0;};
264
265 protected:
266     FireWorks::Device&  m_ParentDevice;
267     enum eType          m_Type;
268 };
269
270 } // namespace FireWorks
271
272 #endif
Note: See TracBrowser for help on using the browser.