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

Revision 1072, 26.6 kB (checked in by ppalmers, 16 years ago)

fix bug in saffire LE mixer code

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