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

Revision 1181, 30.2 kB (checked in by ppalmers, 14 years ago)

fixes #113

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