root/trunk/libffado/src/bebob/focusrite/focusrite_saffire.cpp

Revision 945, 26.2 kB (checked in by ppalmers, 15 years ago)

Add mixer application for the Saffire LE (untested)

Line 
1 /*
2  * Copyright (C) 2005-2008 by Pieter Palmers
3  *
4  * This file is part of FFADO
5  * FFADO = Free Firewire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB.
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 2 of the License, or
12  * (at your option) version 3 of the License.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 #include "focusrite_saffire.h"
25 #include "focusrite_cmd.h"
26
27 namespace BeBoB {
28 namespace Focusrite {
29
30 SaffireDevice::SaffireDevice( DeviceManager& d, std::auto_ptr<ConfigRom>( configRom ))
31     : FocusriteDevice( d, configRom)
32 {
33     debugOutput( DEBUG_LEVEL_VERBOSE, "Created BeBoB::Focusrite::SaffireDevice (NodeID %d)\n",
34                  getConfigRom().getNodeId() );
35
36     // the saffire doesn't seem to like it if the commands are too fast
37     if (AVC::AVCCommand::getSleepAfterAVCCommand() < 1000) {
38         AVC::AVCCommand::setSleepAfterAVCCommand( 1000 );
39     }
40
41     if(getConfigRom().getGuid() < 0x130e0100040000LL) {
42         m_isSaffireLE = false;
43     } else {
44         m_isSaffireLE = true;
45     }
46 }
47
48 bool
49 SaffireDevice::buildMixer()
50 {
51     bool result=true;
52     debugOutput(DEBUG_LEVEL_VERBOSE, "Building a Focusrite Saffire mixer...\n");
53
54     destroyMixer();
55
56     // create the mixer object container
57     m_MixerContainer = new Control::Container("Mixer");
58
59     if (!m_MixerContainer) {
60         debugError("Could not create mixer container...\n");
61         return false;
62     }
63    
64     if(m_isSaffireLE) {
65         // create control objects for the saffire LE
66         result &= m_MixerContainer->addElement(
67             new BinaryControl(*this,
68                     FR_SAFFIRELE_CMD_ID_SPDIF_TRANSPARENT, 0,
69                     "SpdifTransparent", "S/PDIF Transparent", "S/PDIF Transparent"));
70         result &= m_MixerContainer->addElement(
71             new BinaryControl(*this,
72                     FR_SAFFIRELE_CMD_ID_MIDITHRU, 0,
73                     "MidiThru", "MIDI Thru", "MIDI Thru"));
74         result &= m_MixerContainer->addElement(
75             new BinaryControl(*this,
76                     FR_SAFFIRELE_CMD_ID_SAVE_SETTINGS, 0,
77                     "SaveSettings", "Save Settings", "Save Settings"));
78         result &= m_MixerContainer->addElement(
79             new BinaryControl(*this,
80                     FR_SAFFIRELE_CMD_ID_HIGH_GAIN_LINE3, 0,
81                     "HighGainLine3", "High Gain Line-in 3", "High Gain Line-in 3"));
82         result &= m_MixerContainer->addElement(
83             new BinaryControl(*this,
84                     FR_SAFFIRELE_CMD_ID_HIGH_GAIN_LINE4, 0,
85                     "HighGainLine4", "High Gain Line-in 4", "High Gain Line-in 4"));
86
87         // output mute controls
88         result &= m_MixerContainer->addElement(
89             new BinaryControl(*this,
90                     FR_SAFFIRELE_CMD_ID_BITFIELD_OUT12, FR_SAFFIRELE_CMD_ID_BITFIELD_BIT_MUTE,
91                     "Out12Mute", "Out1/2 Mute", "Output 1/2 Mute"));
92         result &= m_MixerContainer->addElement(
93             new BinaryControl(*this,
94                     FR_SAFFIRELE_CMD_ID_BITFIELD_OUT34, FR_SAFFIRELE_CMD_ID_BITFIELD_BIT_MUTE,
95                     "Out34Mute", "Out3/4 Mute", "Output 3/4 Mute"));
96         result &= m_MixerContainer->addElement(
97             new BinaryControl(*this,
98                     FR_SAFFIRELE_CMD_ID_BITFIELD_OUT56, FR_SAFFIRELE_CMD_ID_BITFIELD_BIT_MUTE,
99                     "Out56Mute", "Out5/6 Mute", "Output 5/6 Mute"));
100     } else {
101         // create control objects for the saffire
102         result &= m_MixerContainer->addElement(
103             new BinaryControl(*this,
104                     FR_SAFFIRE_CMD_ID_SPDIF_SWITCH, 0,
105                     "SpdifSwitch", "S/PDIF Switch", "S/PDIF Switch"));
106
107         // output mute controls
108         result &= m_MixerContainer->addElement(
109             new BinaryControl(*this,
110                     FR_SAFFIRE_CMD_ID_BITFIELD_OUT12, FR_SAFFIRE_CMD_ID_BITFIELD_BIT_MUTE,
111                     "Out12Mute", "Out1/2 Mute", "Output 1/2 Mute"));
112         result &= m_MixerContainer->addElement(
113             new BinaryControl(*this,
114                     FR_SAFFIRE_CMD_ID_BITFIELD_OUT34, FR_SAFFIRE_CMD_ID_BITFIELD_BIT_MUTE,
115                     "Out34Mute", "Out3/4 Mute", "Output 3/4 Mute"));
116         result &= m_MixerContainer->addElement(
117             new BinaryControl(*this,
118                     FR_SAFFIRE_CMD_ID_BITFIELD_OUT56, FR_SAFFIRE_CMD_ID_BITFIELD_BIT_MUTE,
119                     "Out56Mute", "Out5/6 Mute", "Output 5/6 Mute"));
120         result &= m_MixerContainer->addElement(
121             new BinaryControl(*this,
122                     FR_SAFFIRE_CMD_ID_BITFIELD_OUT78, FR_SAFFIRE_CMD_ID_BITFIELD_BIT_MUTE,
123                     "Out78Mute", "Out7/8 Mute", "Output 7/8 Mute"));
124         result &= m_MixerContainer->addElement(
125             new BinaryControl(*this,
126                     FR_SAFFIRE_CMD_ID_BITFIELD_OUT910, FR_SAFFIRE_CMD_ID_BITFIELD_BIT_MUTE,
127                     "Out910Mute", "Out9/10 Mute", "Output 9/10 Mute"));
128
129         // output front panel hw volume control
130         result &= m_MixerContainer->addElement(
131             new BinaryControl(*this,
132                     FR_SAFFIRE_CMD_ID_BITFIELD_OUT12, FR_SAFFIRE_CMD_ID_BITFIELD_BIT_HWCTRL,
133                     "Out12HwCtrl", "Out1/2 HwCtrl", "Output 1/2 Front Panel Hardware volume control"));
134         result &= m_MixerContainer->addElement(
135             new BinaryControl(*this,
136                     FR_SAFFIRE_CMD_ID_BITFIELD_OUT34, FR_SAFFIRE_CMD_ID_BITFIELD_BIT_HWCTRL,
137                     "Out34HwCtrl", "Out3/4 HwCtrl", "Output 3/4 Front Panel Hardware volume control"));
138         result &= m_MixerContainer->addElement(
139             new BinaryControl(*this,
140                     FR_SAFFIRE_CMD_ID_BITFIELD_OUT56, FR_SAFFIRE_CMD_ID_BITFIELD_BIT_HWCTRL,
141                     "Out56HwCtrl", "Out5/6 HwCtrl", "Output 5/6 Front Panel Hardware volume control"));
142         result &= m_MixerContainer->addElement(
143             new BinaryControl(*this,
144                     FR_SAFFIRE_CMD_ID_BITFIELD_OUT78, FR_SAFFIRE_CMD_ID_BITFIELD_BIT_HWCTRL,
145                     "Out78HwCtrl", "Out7/8 HwCtrl", "Output 7/8 Front Panel Hardware volume control"));
146
147         // output level dim
148         result &= m_MixerContainer->addElement(
149             new BinaryControl(*this,
150                     FR_SAFFIRE_CMD_ID_BITFIELD_OUT12, FR_SAFFIRE_CMD_ID_BITFIELD_BIT_DIM,
151                     "Out12Dim", "Out1/2 Dim", "Output 1/2 Level Dim"));
152
153         // output level controls
154         result &= m_MixerContainer->addElement(
155             new VolumeControlLowRes(*this,
156                     FR_SAFFIRE_CMD_ID_BITFIELD_OUT12, 0,
157                     "Out12Level", "Out1/2 Level", "Output 1/2 Level"));
158         result &= m_MixerContainer->addElement(
159             new VolumeControlLowRes(*this,
160                     FR_SAFFIRE_CMD_ID_BITFIELD_OUT34, 0,
161                     "Out34Level", "Out3/4 Level", "Output 3/4 Level"));
162         result &= m_MixerContainer->addElement(
163             new VolumeControlLowRes(*this,
164                     FR_SAFFIRE_CMD_ID_BITFIELD_OUT56, 0,
165                     "Out56Level", "Out5/6 Level", "Output 5/6 Level"));
166         result &= m_MixerContainer->addElement(
167             new VolumeControlLowRes(*this,
168                     FR_SAFFIRE_CMD_ID_BITFIELD_OUT78, 0,
169                     "Out78Level", "Out7/8 Level", "Output 7/8 Level"));
170     }
171    
172     // matrix mix controls
173     if(m_isSaffireLE) {
174         result &= m_MixerContainer->addElement(
175             new SaffireMatrixMixer(*this, SaffireMatrixMixer::eMMT_LEMix48, "LEMix48"));
176    
177         result &= m_MixerContainer->addElement(
178             new SaffireMatrixMixer(*this, SaffireMatrixMixer::eMMT_LEMix96, "LEMix96"));
179
180         result &= m_MixerContainer->addElement(
181             new BinaryControl(*this,
182                     FR_SAFFIRELE_CMD_ID_SWAP_OUT4_OUT1_48K, 0,
183                     "Swap41_48", "Swap41_48", "Swap41_48"));
184         result &= m_MixerContainer->addElement(
185             new BinaryControl(*this,
186                     FR_SAFFIRELE_CMD_ID_SWAP_OUT4_OUT1_96K, 0,
187                     "Swap41_96", "Swap41_96", "Swap41_96"));
188
189     } else {
190         result &= m_MixerContainer->addElement(
191             new SaffireMatrixMixer(*this, SaffireMatrixMixer::eMMT_InputMix, "InputMix"));
192    
193         result &= m_MixerContainer->addElement(
194             new SaffireMatrixMixer(*this, SaffireMatrixMixer::eMMT_PCMix, "PCMix"));
195     }
196
197     if (!result) {
198         debugWarning("One or more control elements could not be created.");
199         // clean up those that couldn't be created
200         destroyMixer();
201         return false;
202     }
203
204     if (!addElement(m_MixerContainer)) {
205         debugWarning("Could not register mixer to device\n");
206         // clean up
207         destroyMixer();
208         return false;
209     }
210
211     return true;
212 }
213
214 bool
215 SaffireDevice::destroyMixer()
216 {
217     debugOutput(DEBUG_LEVEL_VERBOSE, "destroy mixer...\n");
218    
219     if (m_MixerContainer == NULL) {
220         debugOutput(DEBUG_LEVEL_VERBOSE, "no mixer to destroy...\n");
221         return true;
222     }
223    
224     if (!deleteElement(m_MixerContainer)) {
225         debugError("Mixer present but not registered to the avdevice\n");
226         return false;
227     }
228    
229     // remove and delete (as in free) child control elements
230     m_MixerContainer->clearElements(true);
231     delete m_MixerContainer;
232     return true;
233 }
234
235 void
236 SaffireDevice::showDevice()
237 {
238     if(m_isSaffireLE) {
239         debugOutput(DEBUG_LEVEL_NORMAL, "This is a BeBoB::Focusrite::SaffireDevice (Saffire LE)\n");
240     } else {
241         debugOutput(DEBUG_LEVEL_NORMAL, "This is a BeBoB::Focusrite::SaffireDevice (Saffire)\n");
242     }
243     FocusriteDevice::showDevice();
244 }
245
246 void
247 SaffireDevice::setVerboseLevel(int l)
248 {
249     debugOutput( DEBUG_LEVEL_VERBOSE, "Setting verbose level to %d...\n", l );
250
251     FocusriteDevice::setVerboseLevel(l);
252 }
253
254 // Saffire pro matrix mixer element
255
256 SaffireMatrixMixer::SaffireMatrixMixer(SaffireDevice& p,
257                                        enum eMatrixMixerType type)
258 : FocusriteMatrixMixer(p, "MatrixMixer")
259 , m_type(type)
260 {
261     init();
262 }
263
264 SaffireMatrixMixer::SaffireMatrixMixer(SaffireDevice& p,
265                                        enum eMatrixMixerType type, std::string n)
266 : FocusriteMatrixMixer(p, n)
267 , m_type(type)
268 {
269     init();
270 }
271
272 void SaffireMatrixMixer::init()
273 {
274     if (m_type==eMMT_PCMix) {
275         addSignalInfo(m_RowInfo, "PC12", "PC 1/2", "PC Channel 1/2");
276         addSignalInfo(m_RowInfo, "PC34", "PC 3/4", "PC Channel 3/4");
277         addSignalInfo(m_RowInfo, "PC56", "PC 5/6", "PC Channel 5/6");
278         addSignalInfo(m_RowInfo, "PC78", "PC 7/8", "PC Channel 7/8");
279         addSignalInfo(m_RowInfo, "PC910", "PC 9/10", "PC Channel 9/10");
280        
281         addSignalInfo(m_ColInfo, "OUT12", "OUT 1/2", "Output 1/2");
282         addSignalInfo(m_ColInfo, "OUT34", "OUT 3/4", "Output 3/4");
283         addSignalInfo(m_ColInfo, "OUT56", "OUT 5/6", "Output 5/6");
284         addSignalInfo(m_ColInfo, "OUT78", "OUT 7/8", "Output 7/8");
285         addSignalInfo(m_ColInfo, "OUT910", "OUT 9/10", "Output 9/10");
286        
287         // init the cell matrix
288         #define FOCUSRITE_SAFFIRE_PCMIX_NB_COLS 5
289         #define FOCUSRITE_SAFFIRE_PCMIX_NB_ROWS 5
290        
291         std::vector<struct sCellInfo> tmp_cols( FOCUSRITE_SAFFIRE_PCMIX_NB_COLS );
292         std::vector< std::vector<struct sCellInfo> > tmp_all(FOCUSRITE_SAFFIRE_PCMIX_NB_ROWS, tmp_cols);
293         m_CellInfo = tmp_all;
294    
295         struct sCellInfo c;
296         c.row=-1;
297         c.col=-1;
298         c.valid=false;
299         c.address=0;
300        
301         for (int i=0;i<FOCUSRITE_SAFFIRE_PCMIX_NB_ROWS;i++) {
302             for (int j=0;j<FOCUSRITE_SAFFIRE_PCMIX_NB_COLS;j++) {
303                 m_CellInfo[i][j]=c;
304             }
305         }
306    
307         // now set the cells that are valid
308         setCellInfo(0,0,FR_SAFFIRE_CMD_ID_PC12_TO_OUT12, true);
309         setCellInfo(0,1,FR_SAFFIRE_CMD_ID_PC12_TO_OUT34, true);
310         setCellInfo(0,2,FR_SAFFIRE_CMD_ID_PC12_TO_OUT56, true);
311         setCellInfo(0,3,FR_SAFFIRE_CMD_ID_PC12_TO_OUT79, true);
312         setCellInfo(0,4,FR_SAFFIRE_CMD_ID_PC12_TO_OUT910, true);
313         setCellInfo(1,0,FR_SAFFIRE_CMD_ID_PC34_TO_OUT12, true);
314         setCellInfo(1,1,FR_SAFFIRE_CMD_ID_PC34_TO_OUT34, true);
315         setCellInfo(1,2,FR_SAFFIRE_CMD_ID_PC34_TO_OUT56, true);
316         setCellInfo(1,3,FR_SAFFIRE_CMD_ID_PC34_TO_OUT79, true);
317         setCellInfo(1,4,FR_SAFFIRE_CMD_ID_PC34_TO_OUT910, true);
318         setCellInfo(2,0,FR_SAFFIRE_CMD_ID_PC56_TO_OUT12, true);
319         setCellInfo(2,1,FR_SAFFIRE_CMD_ID_PC56_TO_OUT34, true);
320         setCellInfo(2,2,FR_SAFFIRE_CMD_ID_PC56_TO_OUT56, true);
321         setCellInfo(2,3,FR_SAFFIRE_CMD_ID_PC56_TO_OUT79, true);
322         setCellInfo(2,4,FR_SAFFIRE_CMD_ID_PC56_TO_OUT910, true);
323         setCellInfo(3,0,FR_SAFFIRE_CMD_ID_PC78_TO_OUT12, true);
324         setCellInfo(3,1,FR_SAFFIRE_CMD_ID_PC78_TO_OUT34, true);
325         setCellInfo(3,2,FR_SAFFIRE_CMD_ID_PC78_TO_OUT56, true);
326         setCellInfo(3,3,FR_SAFFIRE_CMD_ID_PC78_TO_OUT79, true);
327         setCellInfo(3,4,FR_SAFFIRE_CMD_ID_PC78_TO_OUT910, true);
328         setCellInfo(4,0,FR_SAFFIRE_CMD_ID_PC910_TO_OUT12, true);
329         setCellInfo(4,1,FR_SAFFIRE_CMD_ID_PC910_TO_OUT34, true);
330         setCellInfo(4,2,FR_SAFFIRE_CMD_ID_PC910_TO_OUT56, true);
331         setCellInfo(4,3,FR_SAFFIRE_CMD_ID_PC910_TO_OUT79, true);
332         setCellInfo(4,4,FR_SAFFIRE_CMD_ID_PC910_TO_OUT910, true);
333
334     } else if (m_type==eMMT_InputMix) {
335         addSignalInfo(m_RowInfo, "IN1", "Input 1", "Analog Input 1");
336         addSignalInfo(m_RowInfo, "IN2", "Input 2", "Analog Input 2");
337         addSignalInfo(m_RowInfo, "SPDIFL", "SPDIF L", "S/PDIF Left Input");
338         addSignalInfo(m_RowInfo, "SPDIFR", "SPDIF R", "S/PDIF Right Input");
339         addSignalInfo(m_RowInfo, "REV1", "REVERB 1", "Reverb CH1 return");
340         addSignalInfo(m_RowInfo, "REV1", "REVERB 2", "Reverb CH2 return");
341        
342         addSignalInfo(m_ColInfo, "OUT1", "OUT 1", "Output 1");
343         addSignalInfo(m_ColInfo, "OUT2", "OUT 2", "Output 2");
344         addSignalInfo(m_ColInfo, "OUT3", "OUT 3", "Output 3");
345         addSignalInfo(m_ColInfo, "OUT4", "OUT 4", "Output 4");
346         addSignalInfo(m_ColInfo, "OUT5", "OUT 5", "Output 5");
347         addSignalInfo(m_ColInfo, "OUT6", "OUT 6", "Output 6");
348         addSignalInfo(m_ColInfo, "OUT7", "OUT 7", "Output 7");
349         addSignalInfo(m_ColInfo, "OUT8", "OUT 8", "Output 8");
350         addSignalInfo(m_ColInfo, "OUT9", "OUT 9", "Output 9");
351         addSignalInfo(m_ColInfo, "OUT10", "OUT 10", "Output 10");
352        
353         // init the cell matrix
354         #define FOCUSRITE_SAFFIRE_INPUTMIX_NB_COLS 10
355         #define FOCUSRITE_SAFFIRE_INPUTMIX_NB_ROWS 6
356        
357         std::vector<struct sCellInfo> tmp_cols( FOCUSRITE_SAFFIRE_INPUTMIX_NB_COLS );
358         std::vector< std::vector<struct sCellInfo> > tmp_all(FOCUSRITE_SAFFIRE_INPUTMIX_NB_ROWS,tmp_cols);
359         m_CellInfo = tmp_all;
360    
361         struct sCellInfo c;
362         c.row=-1;
363         c.col=-1;
364         c.valid=false;
365         c.address=0;
366        
367         for (int i=0;i<FOCUSRITE_SAFFIRE_INPUTMIX_NB_ROWS;i++) {
368             for (int j=0;j<FOCUSRITE_SAFFIRE_INPUTMIX_NB_COLS;j++) {
369                 m_CellInfo[i][j]=c;
370             }
371         }
372
373         // now set the cells that are valid
374         setCellInfo(0,0,FR_SAFFIRE_CMD_ID_IN1_TO_OUT1, true);
375         setCellInfo(0,2,FR_SAFFIRE_CMD_ID_IN1_TO_OUT3, true);
376         setCellInfo(0,4,FR_SAFFIRE_CMD_ID_IN1_TO_OUT5, true);
377         setCellInfo(0,6,FR_SAFFIRE_CMD_ID_IN1_TO_OUT7, true);
378         setCellInfo(0,8,FR_SAFFIRE_CMD_ID_IN1_TO_OUT9, true);
379         setCellInfo(1,1,FR_SAFFIRE_CMD_ID_IN2_TO_OUT2, true);
380         setCellInfo(1,3,FR_SAFFIRE_CMD_ID_IN2_TO_OUT4, true);
381         setCellInfo(1,5,FR_SAFFIRE_CMD_ID_IN2_TO_OUT6, true);
382         setCellInfo(1,7,FR_SAFFIRE_CMD_ID_IN2_TO_OUT8, true);
383         setCellInfo(1,9,FR_SAFFIRE_CMD_ID_IN2_TO_OUT10, true);
384         setCellInfo(2,0,FR_SAFFIRE_CMD_ID_IN3_TO_OUT1, true);
385         setCellInfo(2,2,FR_SAFFIRE_CMD_ID_IN3_TO_OUT3, true);
386         setCellInfo(2,4,FR_SAFFIRE_CMD_ID_IN3_TO_OUT5, true);
387         setCellInfo(2,6,FR_SAFFIRE_CMD_ID_IN3_TO_OUT7, true);
388         setCellInfo(2,8,FR_SAFFIRE_CMD_ID_IN3_TO_OUT9, true);
389         setCellInfo(3,1,FR_SAFFIRE_CMD_ID_IN4_TO_OUT2, true);
390         setCellInfo(3,3,FR_SAFFIRE_CMD_ID_IN4_TO_OUT4, true);
391         setCellInfo(3,5,FR_SAFFIRE_CMD_ID_IN4_TO_OUT6, true);
392         setCellInfo(3,7,FR_SAFFIRE_CMD_ID_IN4_TO_OUT8, true);
393         setCellInfo(3,9,FR_SAFFIRE_CMD_ID_IN4_TO_OUT10, true);
394
395         setCellInfo(4,0,FR_SAFFIRE_CMD_ID_REV1_TO_OUT1, true);
396         setCellInfo(5,1,FR_SAFFIRE_CMD_ID_REV2_TO_OUT2, true);
397         setCellInfo(4,2,FR_SAFFIRE_CMD_ID_REV1_TO_OUT3, true);
398         setCellInfo(5,3,FR_SAFFIRE_CMD_ID_REV2_TO_OUT4, true);
399         setCellInfo(4,4,FR_SAFFIRE_CMD_ID_REV1_TO_OUT5, true);
400         setCellInfo(5,5,FR_SAFFIRE_CMD_ID_REV2_TO_OUT6, true);
401         setCellInfo(4,6,FR_SAFFIRE_CMD_ID_REV1_TO_OUT7, true);
402         setCellInfo(5,7,FR_SAFFIRE_CMD_ID_REV2_TO_OUT8, true);
403         setCellInfo(4,8,FR_SAFFIRE_CMD_ID_REV1_TO_OUT9, true);
404         setCellInfo(5,9,FR_SAFFIRE_CMD_ID_REV2_TO_OUT10, true);
405
406     } else if (m_type == eMMT_LEMix48) {
407         addSignalInfo(m_RowInfo, "IN1", "Input 1", "Analog Input 1");
408         addSignalInfo(m_RowInfo, "IN2", "Input 2", "Analog Input 2");
409         addSignalInfo(m_RowInfo, "IN3", "Input 3", "Analog Input 3");
410         addSignalInfo(m_RowInfo, "IN4", "Input 4", "Analog Input 4");
411         addSignalInfo(m_RowInfo, "SPDIFL", "SPDIF L", "S/PDIF Left Input");
412         addSignalInfo(m_RowInfo, "SPDIFR", "SPDIF R", "S/PDIF Right Input");
413
414         addSignalInfo(m_RowInfo, "PC1", "PC 1", "PC Channel 1");
415         addSignalInfo(m_RowInfo, "PC2", "PC 2", "PC Channel 2");
416         addSignalInfo(m_RowInfo, "PC3", "PC 3", "PC Channel 3");
417         addSignalInfo(m_RowInfo, "PC4", "PC 4", "PC Channel 4");
418         addSignalInfo(m_RowInfo, "PC5", "PC 5", "PC Channel 5");
419         addSignalInfo(m_RowInfo, "PC6", "PC 6", "PC Channel 6");
420         addSignalInfo(m_RowInfo, "PC7", "PC 7", "PC Channel 7");
421         addSignalInfo(m_RowInfo, "PC8", "PC 8", "PC Channel 8");
422
423         addSignalInfo(m_ColInfo, "OUT1", "OUT 1", "Output 1");
424         addSignalInfo(m_ColInfo, "OUT2", "OUT 2", "Output 2");
425         addSignalInfo(m_ColInfo, "OUT3", "OUT 3", "Output 3");
426         addSignalInfo(m_ColInfo, "OUT4", "OUT 4", "Output 4");
427
428         // init the cell matrix
429         #define FOCUSRITE_SAFFIRELE_48KMIX_NB_COLS 4
430         #define FOCUSRITE_SAFFIRELE_48KMIX_NB_ROWS 14
431        
432         std::vector<struct sCellInfo> tmp_cols( FOCUSRITE_SAFFIRELE_48KMIX_NB_COLS );
433         std::vector< std::vector<struct sCellInfo> > tmp_all(FOCUSRITE_SAFFIRELE_48KMIX_NB_ROWS,tmp_cols);
434         m_CellInfo = tmp_all;
435    
436         struct sCellInfo c;
437         c.row=-1;
438         c.col=-1;
439         c.valid=false;
440         c.address=0;
441        
442         for (int i=0;i<FOCUSRITE_SAFFIRELE_48KMIX_NB_COLS;i++) {
443             for (int j=0;j<FOCUSRITE_SAFFIRELE_48KMIX_NB_ROWS;j++) {
444                 m_CellInfo[i][j]=c;
445             }
446         }
447
448         // now set the cells that are valid
449         setCellInfo(0,0,FR_SAFFIRELE_CMD_ID_IN1_TO_OUT1, true);
450         setCellInfo(0,1,FR_SAFFIRELE_CMD_ID_IN1_TO_OUT2, true);
451         setCellInfo(0,2,FR_SAFFIRELE_CMD_ID_IN1_TO_OUT3, true);
452         setCellInfo(0,3,FR_SAFFIRELE_CMD_ID_IN1_TO_OUT4, true);
453         setCellInfo(1,0,FR_SAFFIRELE_CMD_ID_IN2_TO_OUT1, true);
454         setCellInfo(1,1,FR_SAFFIRELE_CMD_ID_IN2_TO_OUT2, true);
455         setCellInfo(1,2,FR_SAFFIRELE_CMD_ID_IN2_TO_OUT3, true);
456         setCellInfo(1,3,FR_SAFFIRELE_CMD_ID_IN2_TO_OUT4, true);
457         setCellInfo(2,0,FR_SAFFIRELE_CMD_ID_IN3_TO_OUT1, true);
458         setCellInfo(2,1,FR_SAFFIRELE_CMD_ID_IN3_TO_OUT2, true);
459         setCellInfo(2,2,FR_SAFFIRELE_CMD_ID_IN3_TO_OUT3, true);
460         setCellInfo(2,3,FR_SAFFIRELE_CMD_ID_IN3_TO_OUT4, true);
461         setCellInfo(3,0,FR_SAFFIRELE_CMD_ID_IN4_TO_OUT1, true);
462         setCellInfo(3,1,FR_SAFFIRELE_CMD_ID_IN4_TO_OUT2, true);
463         setCellInfo(3,2,FR_SAFFIRELE_CMD_ID_IN4_TO_OUT3, true);
464         setCellInfo(3,3,FR_SAFFIRELE_CMD_ID_IN4_TO_OUT4, true);
465        
466         setCellInfo(4,0,FR_SAFFIRELE_CMD_ID_SPDIF1_TO_OUT1, true);
467         setCellInfo(4,1,FR_SAFFIRELE_CMD_ID_SPDIF1_TO_OUT2, true);
468         setCellInfo(4,2,FR_SAFFIRELE_CMD_ID_SPDIF1_TO_OUT3, true);
469         setCellInfo(4,3,FR_SAFFIRELE_CMD_ID_SPDIF1_TO_OUT4, true);
470         setCellInfo(5,0,FR_SAFFIRELE_CMD_ID_SPDIF2_TO_OUT1, true);
471         setCellInfo(5,1,FR_SAFFIRELE_CMD_ID_SPDIF2_TO_OUT2, true);
472         setCellInfo(5,2,FR_SAFFIRELE_CMD_ID_SPDIF2_TO_OUT3, true);
473         setCellInfo(5,3,FR_SAFFIRELE_CMD_ID_SPDIF2_TO_OUT4, true);
474         setCellInfo(6,0,FR_SAFFIRELE_CMD_ID_PC1_TO_OUT1, true);
475         setCellInfo(6,1,FR_SAFFIRELE_CMD_ID_PC1_TO_OUT2, true);
476         setCellInfo(6,2,FR_SAFFIRELE_CMD_ID_PC1_TO_OUT3, true);
477         setCellInfo(6,3,FR_SAFFIRELE_CMD_ID_PC1_TO_OUT4, true);
478         setCellInfo(7,0,FR_SAFFIRELE_CMD_ID_PC2_TO_OUT1, true);
479         setCellInfo(7,1,FR_SAFFIRELE_CMD_ID_PC2_TO_OUT2, true);
480         setCellInfo(7,2,FR_SAFFIRELE_CMD_ID_PC2_TO_OUT3, true);
481         setCellInfo(7,3,FR_SAFFIRELE_CMD_ID_PC2_TO_OUT4, true);
482         setCellInfo(8,0,FR_SAFFIRELE_CMD_ID_PC3_TO_OUT1, true);
483         setCellInfo(8,1,FR_SAFFIRELE_CMD_ID_PC3_TO_OUT2, true);
484         setCellInfo(8,2,FR_SAFFIRELE_CMD_ID_PC3_TO_OUT3, true);
485         setCellInfo(8,3,FR_SAFFIRELE_CMD_ID_PC3_TO_OUT4, true);
486         setCellInfo(9,0,FR_SAFFIRELE_CMD_ID_PC4_TO_OUT1, true);
487         setCellInfo(9,1,FR_SAFFIRELE_CMD_ID_PC4_TO_OUT2, true);
488         setCellInfo(9,2,FR_SAFFIRELE_CMD_ID_PC4_TO_OUT3, true);
489         setCellInfo(9,3,FR_SAFFIRELE_CMD_ID_PC4_TO_OUT4, true);
490         setCellInfo(10,0,FR_SAFFIRELE_CMD_ID_PC5_TO_OUT1, true);
491         setCellInfo(10,1,FR_SAFFIRELE_CMD_ID_PC5_TO_OUT2, true);
492         setCellInfo(10,2,FR_SAFFIRELE_CMD_ID_PC5_TO_OUT3, true);
493         setCellInfo(10,3,FR_SAFFIRELE_CMD_ID_PC5_TO_OUT4, true);
494         setCellInfo(11,0,FR_SAFFIRELE_CMD_ID_PC6_TO_OUT1, true);
495         setCellInfo(11,1,FR_SAFFIRELE_CMD_ID_PC6_TO_OUT2, true);
496         setCellInfo(11,2,FR_SAFFIRELE_CMD_ID_PC6_TO_OUT3, true);
497         setCellInfo(11,3,FR_SAFFIRELE_CMD_ID_PC6_TO_OUT4, true);
498         setCellInfo(12,0,FR_SAFFIRELE_CMD_ID_PC7_TO_OUT1, true);
499         setCellInfo(12,1,FR_SAFFIRELE_CMD_ID_PC7_TO_OUT2, true);
500         setCellInfo(12,2,FR_SAFFIRELE_CMD_ID_PC7_TO_OUT3, true);
501         setCellInfo(12,3,FR_SAFFIRELE_CMD_ID_PC7_TO_OUT4, true);
502         setCellInfo(13,0,FR_SAFFIRELE_CMD_ID_PC8_TO_OUT1, true);
503         setCellInfo(13,1,FR_SAFFIRELE_CMD_ID_PC8_TO_OUT2, true);
504         setCellInfo(13,2,FR_SAFFIRELE_CMD_ID_PC8_TO_OUT3, true);
505         setCellInfo(13,3,FR_SAFFIRELE_CMD_ID_PC8_TO_OUT4, true);
506
507     } else if (m_type == eMMT_LEMix96) {
508         addSignalInfo(m_RowInfo, "IN1", "Input 1", "Analog Input 1");
509         addSignalInfo(m_RowInfo, "IN2", "Input 2", "Analog Input 2");
510         addSignalInfo(m_RowInfo, "IN3", "Input 3", "Analog Input 3");
511         addSignalInfo(m_RowInfo, "IN4", "Input 4", "Analog Input 4");
512         addSignalInfo(m_RowInfo, "SPDIFL", "SPDIF L", "S/PDIF Left Input");
513         addSignalInfo(m_RowInfo, "SPDIFR", "SPDIF R", "S/PDIF Right Input");
514
515         addSignalInfo(m_RowInfo, "PC1", "PC 1", "PC Channel 1");
516         addSignalInfo(m_RowInfo, "PC2", "PC 2", "PC Channel 2");
517         addSignalInfo(m_RowInfo, "PC3", "PC 3", "PC Channel 3");
518         addSignalInfo(m_RowInfo, "PC4", "PC 4", "PC Channel 4");
519         addSignalInfo(m_RowInfo, "PC5", "PC 5", "PC Channel 5");
520         addSignalInfo(m_RowInfo, "PC6", "PC 6", "PC Channel 6");
521         addSignalInfo(m_RowInfo, "PC7", "PC 7", "PC Channel 7");
522         addSignalInfo(m_RowInfo, "PC8", "PC 8", "PC Channel 8");
523         addSignalInfo(m_RowInfo, "RECMIXRETURN", "RECMIXRETURN", "Record mix (mono) return");
524
525         addSignalInfo(m_ColInfo, "OUT1", "OUT 1", "Output 1");
526         addSignalInfo(m_ColInfo, "OUT2", "OUT 2", "Output 2");
527         addSignalInfo(m_ColInfo, "OUT3", "OUT 3", "Output 3");
528         addSignalInfo(m_ColInfo, "OUT4", "OUT 4", "Output 4");
529         addSignalInfo(m_ColInfo, "RECMIX", "RECMIX", "Record mix (mono)");
530
531         // init the cell matrix
532         #define FOCUSRITE_SAFFIRELE_96KMIX_NB_COLS 5
533         #define FOCUSRITE_SAFFIRELE_96KMIX_NB_ROWS 15
534        
535         std::vector<struct sCellInfo> tmp_cols( FOCUSRITE_SAFFIRELE_96KMIX_NB_COLS );
536         std::vector< std::vector<struct sCellInfo> > tmp_all(FOCUSRITE_SAFFIRELE_96KMIX_NB_ROWS,tmp_cols);
537         m_CellInfo = tmp_all;
538    
539         struct sCellInfo c;
540         c.row=-1;
541         c.col=-1;
542         c.valid=false;
543         c.address=0;
544        
545         for (int i=0;i<FOCUSRITE_SAFFIRELE_96KMIX_NB_COLS;i++) {
546             for (int j=0;j<FOCUSRITE_SAFFIRELE_96KMIX_NB_ROWS;j++) {
547                 m_CellInfo[i][j]=c;
548             }
549         }
550
551         // now set the cells that are valid
552         setCellInfo(0,4,FR_SAFFIRELE_CMD_ID_IN1_TO_RECMIX_96K, true);
553         setCellInfo(1,4,FR_SAFFIRELE_CMD_ID_IN2_TO_RECMIX_96K, true);
554         setCellInfo(2,4,FR_SAFFIRELE_CMD_ID_IN3_TO_RECMIX_96K, true);
555         setCellInfo(3,4,FR_SAFFIRELE_CMD_ID_IN4_TO_RECMIX_96K, true);
556         setCellInfo(4,4,FR_SAFFIRELE_CMD_ID_SPDIF1_TO_RECMIX_96K, true);
557         setCellInfo(5,4,FR_SAFFIRELE_CMD_ID_SPDIF2_TO_RECMIX_96K, true);
558
559         setCellInfo(14,0,FR_SAFFIRELE_CMD_ID_RECMIX_TO_OUT1_96K, true);
560         setCellInfo(14,1,FR_SAFFIRELE_CMD_ID_RECMIX_TO_OUT2_96K, true);
561         setCellInfo(14,2,FR_SAFFIRELE_CMD_ID_RECMIX_TO_OUT3_96K, true);
562         setCellInfo(14,3,FR_SAFFIRELE_CMD_ID_RECMIX_TO_OUT4_96K, true);
563
564         setCellInfo(7,0,FR_SAFFIRELE_CMD_ID_PC1_TO_OUT1_96K, true);
565         setCellInfo(7,1,FR_SAFFIRELE_CMD_ID_PC1_TO_OUT2_96K, true);
566         setCellInfo(7,2,FR_SAFFIRELE_CMD_ID_PC1_TO_OUT3_96K, true);
567         setCellInfo(7,3,FR_SAFFIRELE_CMD_ID_PC1_TO_OUT4_96K, true);
568         setCellInfo(8,0,FR_SAFFIRELE_CMD_ID_PC2_TO_OUT1_96K, true);
569         setCellInfo(8,1,FR_SAFFIRELE_CMD_ID_PC2_TO_OUT2_96K, true);
570         setCellInfo(8,2,FR_SAFFIRELE_CMD_ID_PC2_TO_OUT3_96K, true);
571         setCellInfo(8,3,FR_SAFFIRELE_CMD_ID_PC2_TO_OUT4_96K, true);
572     } else {
573         debugError("Invalid mixer type\n");
574     }
575 }
576
577 void SaffireMatrixMixer::show()
578 {
579     debugOutput(DEBUG_LEVEL_NORMAL, "Saffire Matrix mixer type %d\n");
580 }
581
582 } // Focusrite
583 } // BeBoB
Note: See TracBrowser for help on using the browser.