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

Revision 1172, 28.4 kB (checked in by ppalmers, 16 years ago)

lay down the foundations for easy ALSA/Pulse support

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