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

Revision 2802, 7.7 kB (checked in by jwoithe, 3 years ago)

Cosmetic: "Firewire" becomes "FireWire?".

Officially both the "F" and "W" were capitalised in the FireWire? name, so
reflect this throughout FFADO's source tree. This mostly affects comments.

This patch originated from pander on the ffado-devel mailing list. To
maintain consistency, the committed version has been expanded to include
files not originally included in the original patch.

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 class PlaybackRoutingControl : public Control::Discrete
202 {
203 public:
204     PlaybackRoutingControl(FireWorks::Device& parent);
205     PlaybackRoutingControl(FireWorks::Device& parent, std::string n);
206
207     virtual ~PlaybackRoutingControl();
208
209     virtual void show();
210
211     virtual bool setValue(int idx, int v);
212     virtual int getValue(int idx);
213
214     // not used
215     virtual bool setValue(int v) {return 0;};
216     virtual int getValue() {return 0;};
217     virtual int getMinimum() {return 0;};
218     virtual int getMaximum() {return 0;};
219 private:
220     bool GetState(EfcIsocMapIOConfigCmd *cmd);
221     FireWorks::Device&          m_ParentDevice;
222 };
223
224 class HwInfoControl : public Control::Discrete
225 {
226 public:
227
228     enum eHwInfoField {
229         eHIF_PhysicalAudioOutCount,
230         eHIF_PhysicalAudioInCount,
231         eHIF_1394PlaybackCount,
232         eHIF_1394RecordCount,
233         eHIF_GroupOutCount,
234         eHIF_GroupInCount,
235         eHIF_PhantomPower,
236         eHIF_OpticalInterface,
237         eHIF_PlaybackRouting
238     };
239 public:
240     HwInfoControl(FireWorks::Device& parent,
241                   enum eHwInfoField);
242     HwInfoControl(FireWorks::Device& parent,
243                   enum eHwInfoField, std::string n);
244     virtual ~HwInfoControl();
245
246     virtual void show();
247
248     virtual bool setValue( const int ) {return false;};
249     virtual int getValue( );
250     virtual bool setValue(int idx, int v)
251         {return setValue(v);};
252     virtual int getValue(int idx)
253         {return getValue();};
254
255     virtual int getMinimum() {return 0;};
256     virtual int getMaximum() {return 0;};
257
258 protected:
259     FireWorks::Device&          m_ParentDevice;
260     enum eHwInfoField           m_Field;
261 };
262
263 class MultiControl : public Control::Discrete
264 {
265 public:
266
267     enum eType {
268         eT_SaveSession,
269         eT_Identify,
270     };
271 public:
272     MultiControl(FireWorks::Device& parent, enum eType);
273     MultiControl(FireWorks::Device& parent, enum eType,
274                         std::string n);
275     virtual ~MultiControl();
276
277     virtual void show();
278
279     virtual bool setValue( const int );
280     virtual int getValue( ) {return 0;};
281     virtual bool setValue(int idx, int v)
282         {return setValue(v);};
283     virtual int getValue(int idx)
284         {return getValue();};
285
286     virtual int getMinimum() {return 0;};
287     virtual int getMaximum() {return 0;};
288
289 protected:
290     FireWorks::Device&  m_ParentDevice;
291     enum eType          m_Type;
292 };
293
294 } // namespace FireWorks
295
296 #endif
Note: See TracBrowser for help on using the browser.