2 * Copyright (C) 2005-2008 by Daniel Wagner
3 * Copyright (C) 2005-2008 by Pieter Palmers
5 * This file is part of FFADO
6 * FFADO = Free Firewire (pro-)audio drivers for linux
8 * FFADO is based upon FreeBoB.
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.
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.
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/>.
25 #ifndef FIREWORKS_MATRIX_CONTROL_H
26 #define FIREWORKS_MATRIX_CONTROL_H
28 #include "debugmodule/debugmodule.h"
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"
36 #include "libcontrol/BasicElements.h"
37 #include "libcontrol/MatrixMixer.h"
42 class Ieee1394Service
;
46 class MonitorControl
: public Control::MatrixMixer
49 enum eMonitorControl
{
57 MonitorControl(FireWorks::Device
& parent
, enum eMonitorControl
);
58 MonitorControl(FireWorks::Device
& parent
, enum eMonitorControl
, std::string n
);
59 virtual ~MonitorControl() {};
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( );
72 bool canConnect() const { return false; }
74 // full map updates are unsupported
75 virtual bool getCoefficientMap(int &) {return false;};
76 virtual bool storeCoefficientMap(int &) {return false;};
79 enum eMonitorControl m_control
;
80 FireWorks::Device
& m_ParentDevice
;
84 class SimpleControl
: public Control::Continuous
88 SimpleControl(FireWorks::Device
& parent
,
89 enum eMixerTarget
, enum eMixerCommand
,
91 SimpleControl(FireWorks::Device
& parent
,
92 enum eMixerTarget
, enum eMixerCommand
,
93 int channel
, std::string n
);
94 virtual ~SimpleControl();
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();};
105 virtual double getMinimum() {return -100.0;};
106 virtual double getMaximum() {return 10.0;};
109 EfcGenericMixerCmd
* m_Slave
;
110 FireWorks::Device
& m_ParentDevice
;
113 // for on-off type of controls
115 class BinaryControl
: public Control::Discrete
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();
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();};
136 virtual int getMinimum() {return 0;};
137 virtual int getMaximum() {return 1;};
140 EfcGenericMixerCmd
* m_Slave
;
141 FireWorks::Device
& m_ParentDevice
;
144 class SpdifModeControl
: public Control::Discrete
148 SpdifModeControl(FireWorks::Device
& parent
);
149 SpdifModeControl(FireWorks::Device
& parent
,
151 virtual ~SpdifModeControl();
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();};
162 virtual int getMinimum() {return 0;};
163 virtual int getMaximum() {return 0;};
166 FireWorks::Device
& m_ParentDevice
;
170 // for on-off type of controls
172 class IOConfigControl
: public Control::Discrete
176 IOConfigControl(FireWorks::Device
& parent
,
177 enum eIOConfigRegister
);
178 IOConfigControl(FireWorks::Device
& parent
,
179 enum eIOConfigRegister
,
181 virtual ~IOConfigControl();
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();};
192 virtual int getMinimum() {return 0;};
193 virtual int getMaximum() {return 0;};
197 EfcGenericIOConfigCmd
* m_Slave
;
198 FireWorks::Device
& m_ParentDevice
;
201 class PlaybackRoutingControl
: public Control::Discrete
204 PlaybackRoutingControl(FireWorks::Device
& parent
);
205 PlaybackRoutingControl(FireWorks::Device
& parent
, std::string n
);
207 virtual ~PlaybackRoutingControl();
211 virtual bool setValue(int idx
, int v
);
212 virtual int getValue(int idx
);
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;};
220 bool GetState(EfcIsocMapIOConfigCmd
*cmd
);
221 FireWorks::Device
& m_ParentDevice
;
224 class HwInfoControl
: public Control::Discrete
229 eHIF_PhysicalAudioOutCount
,
230 eHIF_PhysicalAudioInCount
,
231 eHIF_1394PlaybackCount
,
232 eHIF_1394RecordCount
,
236 eHIF_OpticalInterface
,
240 HwInfoControl(FireWorks::Device
& parent
,
242 HwInfoControl(FireWorks::Device
& parent
,
243 enum eHwInfoField
, std::string n
);
244 virtual ~HwInfoControl();
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();};
255 virtual int getMinimum() {return 0;};
256 virtual int getMaximum() {return 0;};
259 FireWorks::Device
& m_ParentDevice
;
260 enum eHwInfoField m_Field
;
263 class MultiControl
: public Control::Discrete
272 MultiControl(FireWorks::Device
& parent
, enum eType
);
273 MultiControl(FireWorks::Device
& parent
, enum eType
,
275 virtual ~MultiControl();
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();};
286 virtual int getMinimum() {return 0;};
287 virtual int getMaximum() {return 0;};
290 FireWorks::Device
& m_ParentDevice
;
294 } // namespace FireWorks