root/trunk/libffado/src/fireworks/fireworks_control.cpp

Revision 2732, 22.1 kB (checked in by jwoithe, 3 years ago)

Fix typos throughout the source tree.

Rectify some long-lived typos in strings throughout the source code. in the
FFADO desktop file. This benefits Debian and possibly others. Patch by
Nicolas Boulenguez for Debian and provided to FFADO by Benoit Delcour via
the ffado-user mailing list.

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 "fireworks_device.h"
25 #include "fireworks_control.h"
26 #include "efc/efc_avc_cmd.h"
27 #include "efc/efc_cmd.h"
28 #include "efc/efc_cmds_mixer.h"
29 #include "efc/efc_cmds_monitor.h"
30 #include "efc/efc_cmds_hardware_ctrl.h"
31
32 #include <string>
33 #include <sstream>
34
35 using namespace std;
36
37 // These classes provide support for the controls on the echo devices
38 namespace FireWorks {
39
40 MonitorControl::MonitorControl(FireWorks::Device& p, enum eMonitorControl c)
41 : Control::MatrixMixer(&p, "MonitorControl")
42 , m_control(c)
43 , m_ParentDevice(p)
44 {
45 }
46
47 MonitorControl::MonitorControl(FireWorks::Device& p, enum eMonitorControl c, std::string n)
48 : Control::MatrixMixer(&p, n)
49 , m_control(c)
50 , m_ParentDevice(p)
51 {
52 }
53
54 void MonitorControl::show()
55 {
56     debugOutput(DEBUG_LEVEL_NORMAL, "MonitorControl\n");
57 }
58
59 std::string MonitorControl::getRowName( const int row )
60 {
61     std::ostringstream rowname;
62     rowname << "IN" << row;
63     debugOutput(DEBUG_LEVEL_VERBOSE, "name for row %d is %s\n",
64                                      row, rowname.str().c_str());
65     return rowname.str();
66 }
67
68 std::string MonitorControl::getColName( const int col )
69 {
70     std::ostringstream colname;
71     colname << "OUT" << col;
72     debugOutput(DEBUG_LEVEL_VERBOSE, "name for col %d is %s\n",
73                                      col, colname.str().c_str());
74     return colname.str();
75 }
76
77 int MonitorControl::canWrite( const int row, const int col )
78 {
79     debugOutput(DEBUG_LEVEL_VERBOSE, "canWrite for row %d col %d is %d\n",
80                                      row, col, true);
81     return true;
82 }
83
84 double MonitorControl::setValue( const int row, const int col, const double val )
85 {
86     double retval=0.0;
87     bool did_command=false;
88
89     if(row >= (int)m_ParentDevice.getHwInfo().m_nb_phys_audio_in) {
90         debugError("specified row (%u) larger than number of rows (%d)\n",
91             row, m_ParentDevice.getHwInfo().m_nb_phys_audio_in);
92         return 0.0;
93     }
94     if(col >= (int)m_ParentDevice.getHwInfo().m_nb_phys_audio_out) {
95         debugError("specified col (%u) larger than number of cols (%d)\n",
96             col, m_ParentDevice.getHwInfo().m_nb_phys_audio_out);
97         return 0.0;
98     }
99
100     // not a switch since we create variables
101     if(m_control==eMC_Gain) {
102         EfcSetMonitorGainCmd setCmd;
103         setCmd.m_input = row;
104         setCmd.m_output = col;
105         setCmd.m_value = (uint32_t)val;
106         if (!m_ParentDevice.doEfcOverAVC(setCmd))
107         {
108             debugError("Cmd failed\n");
109         }
110         // update the session block
111         m_ParentDevice.m_session.h.monitorgains[row][col] = setCmd.m_value;
112         retval = setCmd.m_value;
113         did_command = true;
114     }
115     if(m_control==eMC_Pan) {
116         EfcSetMonitorPanCmd setCmd;
117         setCmd.m_input = row;
118         setCmd.m_output = col;
119         setCmd.m_value = (uint32_t)val;
120         if (!m_ParentDevice.doEfcOverAVC(setCmd))
121         {
122             debugError("Cmd failed\n");
123         }
124         // update the session block
125         m_ParentDevice.m_session.s.monitorpans[row][col] = setCmd.m_value;
126         retval = setCmd.m_value;
127         did_command = true;
128     }
129     if(m_control==eMC_Mute) {
130         EfcSetMonitorMuteCmd setCmd;
131         setCmd.m_input = row;
132         setCmd.m_output = col;
133         setCmd.m_value = (uint32_t)val;
134         if (!m_ParentDevice.doEfcOverAVC(setCmd))
135         {
136             debugError("Cmd failed\n");
137         }
138         // update the session block
139         if(setCmd.m_value) {
140             m_ParentDevice.m_session.s.monitorflags[row][col] |= ECHO_SESSION_MUTE_BIT;
141         } else {
142             m_ParentDevice.m_session.s.monitorflags[row][col] &= ~ECHO_SESSION_MUTE_BIT;
143         }
144         retval = setCmd.m_value;
145         did_command = true;
146     }
147     if(m_control==eMC_Solo) {
148         EfcSetMonitorSoloCmd setCmd;
149         setCmd.m_input = row;
150         setCmd.m_output = col;
151         setCmd.m_value = (uint32_t)val;
152         if (!m_ParentDevice.doEfcOverAVC(setCmd))
153         {
154             debugError("Cmd failed\n");
155         }
156         // update the session block
157         if(setCmd.m_value) {
158             m_ParentDevice.m_session.s.monitorflags[row][col] |= ECHO_SESSION_SOLO_BIT;
159         } else {
160             m_ParentDevice.m_session.s.monitorflags[row][col] &= ~ECHO_SESSION_SOLO_BIT;
161         }
162         retval = setCmd.m_value;
163         did_command = true;
164     }
165
166     debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for row %d col %d = %lf\n",
167                                          row, col, retval);
168
169     if (!did_command) {
170         debugError("BUG: this should never happen due to enum\n");
171     }
172     return retval;
173 }
174
175 double MonitorControl::getValue( const int row, const int col )
176 {
177     double retval=0.0;
178     bool did_command=false;
179
180     if(row >= (int)m_ParentDevice.getHwInfo().m_nb_phys_audio_in) {
181         debugError("specified row (%u) larger than number of rows (%d)\n",
182             row, m_ParentDevice.getHwInfo().m_nb_phys_audio_in);
183         return 0.0;
184     }
185     if(col >= (int)m_ParentDevice.getHwInfo().m_nb_phys_audio_out) {
186         debugError("specified col (%u) larger than number of cols (%d)\n",
187             col, m_ParentDevice.getHwInfo().m_nb_phys_audio_out);
188         return 0.0;
189     }
190
191     if(m_control==eMC_Gain) {
192         EfcGetMonitorGainCmd getCmd;
193         getCmd.m_input=row;
194         getCmd.m_output=col;
195         if (!m_ParentDevice.doEfcOverAVC(getCmd))
196         {
197             debugError("Cmd failed\n");
198         }
199         retval=getCmd.m_value;
200         did_command=true;
201     }
202     if(m_control==eMC_Pan) {
203         EfcGetMonitorPanCmd getCmd;
204         getCmd.m_input=row;
205         getCmd.m_output=col;
206         if (!m_ParentDevice.doEfcOverAVC(getCmd))
207         {
208             debugError("Cmd failed\n");
209         }
210         retval=getCmd.m_value;
211         did_command=true;
212     }
213     if(m_control==eMC_Mute) {
214         EfcGetMonitorMuteCmd getCmd;
215         getCmd.m_input=row;
216         getCmd.m_output=col;
217         if (!m_ParentDevice.doEfcOverAVC(getCmd))
218         {
219             debugError("Cmd failed\n");
220         }
221         retval=getCmd.m_value;
222         did_command=true;
223     }
224     if(m_control==eMC_Solo) {
225         EfcGetMonitorSoloCmd getCmd;
226         getCmd.m_input=row;
227         getCmd.m_output=col;
228         if (!m_ParentDevice.doEfcOverAVC(getCmd))
229         {
230             debugError("Cmd failed\n");
231         }
232         retval=getCmd.m_value;
233         did_command=true;
234     }
235
236     debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for row %d col %d = %lf\n",
237                                          row, col, retval);
238
239     if (!did_command) {
240         debugError("BUG: this should never happen due to enum\n");
241     }
242     return retval;
243 }
244
245 int MonitorControl::getRowCount( )
246 {
247     return m_ParentDevice.getHwInfo().m_nb_phys_audio_in;
248 }
249
250 int MonitorControl::getColCount( )
251 {
252     return m_ParentDevice.getHwInfo().m_nb_phys_audio_out;
253 }
254
255 // --- the generic control element for single-value controls
256
257 SimpleControl::SimpleControl(FireWorks::Device& p,
258                              enum eMixerTarget t,
259                              enum eMixerCommand c,
260                              int channel)
261 : Control::Continuous(&p, "SimpleControl")
262 , m_Slave(new EfcGenericMixerCmd(t, c, channel))
263 , m_ParentDevice(p)
264 {
265 }
266
267 SimpleControl::SimpleControl(FireWorks::Device& p,
268                              enum eMixerTarget t,
269                              enum eMixerCommand c,
270                              int channel,
271                              std::string n)
272 : Control::Continuous(&p, n)
273 , m_Slave(new EfcGenericMixerCmd(t, c, channel))
274 , m_ParentDevice(p)
275 {
276 }
277
278 SimpleControl::~SimpleControl()
279 {
280     delete m_Slave;
281 }
282
283 void SimpleControl::show()
284 {
285     debugOutput(DEBUG_LEVEL_NORMAL, "SimpleControl\n");
286     if(m_Slave) m_Slave->showEfcCmd();
287 }
288
289 bool SimpleControl::setValue( const double val )
290 {
291     if(m_Slave) {
292         m_Slave->setType(eCT_Set);
293         m_Slave->m_value = (uint32_t)val;
294         if (!m_ParentDevice.doEfcOverAVC(*m_Slave))
295         {
296             debugError("Cmd failed\n");
297             return 0.0;
298         }
299
300         // update the session block
301         switch(m_Slave->getTarget()) {
302         case eMT_PlaybackMix:
303             switch(m_Slave->getCommand()) {
304             case eMC_Gain:
305                 m_ParentDevice.m_session.h.playbackgains[m_Slave->m_channel] = m_Slave->m_value;
306                 break;
307             default: // nothing
308                 break;
309             }
310             break;
311         case eMT_PhysicalOutputMix:
312             switch(m_Slave->getCommand()) {
313             case eMC_Gain:
314                 m_ParentDevice.m_session.h.outputgains[m_Slave->m_channel] = m_Slave->m_value;
315                 break;
316             default: // nothing
317                 break;
318             }
319             break;
320         default: // nothing
321             break;
322         }
323         debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for channel %d to %lf = %u\n",
324                                             m_Slave->m_channel, val, m_Slave->m_value);
325         return true;
326     } else {
327         debugError("No slave EFC command present\n");
328         return false;
329     }
330 }
331
332 double SimpleControl::getValue( )
333 {
334     if(m_Slave) {
335         m_Slave->setType(eCT_Get);
336         if (!m_ParentDevice.doEfcOverAVC(*m_Slave))
337         {
338             debugError("Cmd failed\n");
339             return 0.0;
340         }
341         debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for channel %d = %u\n",
342                                             m_Slave->m_channel, m_Slave->m_value);
343         return m_Slave->m_value;
344     } else {
345         debugError("No slave EFC command present\n");
346         return 0.0;
347     }
348 }
349
350 // --- the generic control element for on-off controls
351
352 BinaryControl::BinaryControl(FireWorks::Device& p,
353                              enum eMixerTarget t,
354                              enum eMixerCommand c,
355                              int channel, int bit)
356 : Control::Discrete(&p, "BinaryControl")
357 , m_bit(bit)
358 , m_Slave(new EfcGenericMixerCmd(t, c, channel))
359 , m_ParentDevice(p)
360 {
361 }
362
363 BinaryControl::BinaryControl(FireWorks::Device& p,
364                              enum eMixerTarget t,
365                              enum eMixerCommand c,
366                              int channel, int bit,
367                              std::string n)
368 : Control::Discrete(&p, n)
369 , m_bit(bit)
370 , m_Slave(new EfcGenericMixerCmd(t, c, channel))
371 , m_ParentDevice(p)
372 {
373 }
374
375 BinaryControl::~BinaryControl()
376 {
377     delete m_Slave;
378 }
379
380 void BinaryControl::show()
381 {
382     debugOutput(DEBUG_LEVEL_NORMAL, "BinaryControl\n");
383     if(m_Slave) m_Slave->showEfcCmd();
384 }
385
386 bool BinaryControl::setValue( const int val )
387 {
388
389     if(m_Slave) {
390         uint32_t reg;
391         uint32_t old_reg;
392        
393         m_Slave->setType(eCT_Get);
394         reg=m_Slave->m_value;
395        
396         old_reg=reg;
397         if (val) {
398             reg |= (1<<m_bit);
399         } else {
400             reg &= ~(1<<m_bit);
401         }
402    
403         m_Slave->setType(eCT_Set);
404         m_Slave->m_value=reg;
405         if (!m_ParentDevice.doEfcOverAVC(*m_Slave))
406         {
407             debugError("Cmd failed\n");
408             return 0;
409         }
410
411         // update the session block
412         switch(m_Slave->getTarget()) {
413         case eMT_PlaybackMix:
414             switch(m_Slave->getCommand()) {
415             case eMC_Mute:
416                 m_ParentDevice.m_session.s.playbacks[m_Slave->m_channel].mute = m_Slave->m_value;
417                 break;
418             case eMC_Solo:
419                 m_ParentDevice.m_session.s.playbacks[m_Slave->m_channel].solo = m_Slave->m_value;
420                 break;
421             default: // nothing
422                 break;
423             }
424             break;
425         case eMT_PhysicalOutputMix:
426             switch(m_Slave->getCommand()) {
427             case eMC_Mute:
428                 m_ParentDevice.m_session.s.outputs[m_Slave->m_channel].mute = m_Slave->m_value;
429                 break;
430             case eMC_Nominal:
431                 m_ParentDevice.m_session.s.outputs[m_Slave->m_channel].shift = m_Slave->m_value;
432                 break;
433             default: // nothing
434                 break;
435             }
436             break;
437         case eMT_PhysicalInputMix:
438             switch(m_Slave->getCommand()) {
439             //case eMC_Pad:
440             //    m_ParentDevice.m_session.s.inputs[m_Slave->m_channel].pad = m_Slave->m_value;
441             //    break;
442             case eMC_Nominal:
443                 m_ParentDevice.m_session.s.inputs[m_Slave->m_channel].shift = m_Slave->m_value;
444                 break;
445             default: // nothing
446                 break;
447             }
448             break;
449         default: // nothing
450             break;
451         }
452
453         debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for channel %d to %d (reg: 0x%08X => 0x%08X)\n",
454                                             m_Slave->m_channel, val, old_reg, reg);
455         return true;
456     } else {
457         debugError("No slave EFC command present\n");
458         return false;
459     }
460 }
461
462 int BinaryControl::getValue( )
463 {
464     if(m_Slave) {
465         // workaround for the failing get nominal command for input channels
466         // get it from the session block
467         if ((m_Slave->getTarget() == eMT_PhysicalInputMix)
468             && (m_Slave->getCommand() == eMC_Nominal)) {
469             int val = m_ParentDevice.m_session.s.inputs[m_Slave->m_channel].shift;
470             debugOutput(DEBUG_LEVEL_VERBOSE, "input pad workaround: %08X\n", val);
471             return val;
472         }
473         m_Slave->setType(eCT_Get);
474         if (!m_ParentDevice.doEfcOverAVC(*m_Slave))
475         {
476             debugError("Cmd failed\n");
477             return 0;
478         }
479         bool val= (m_Slave->m_value & (1<<m_bit)) != 0;
480         debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for channel %d: reg: 0x%08X, result=%d\n",
481                                          m_Slave->m_channel, m_Slave->m_value, val);
482         return val;
483     } else {
484         debugError("No slave EFC command present\n");
485         return 0;
486     }
487 }
488
489 // --- control element for flags
490
491 SpdifModeControl::SpdifModeControl(FireWorks::Device& parent)
492 : Control::Discrete(&parent, "SpdifModeControl")
493 , m_ParentDevice(parent)
494 {
495 }
496
497 SpdifModeControl::SpdifModeControl(FireWorks::Device& parent,
498                                    std::string n)
499 : Control::Discrete(&parent, n)
500 , m_ParentDevice(parent)
501 {
502 }
503
504 SpdifModeControl::~SpdifModeControl()
505 {
506 }
507
508 void SpdifModeControl::show()
509 {
510     debugOutput(DEBUG_LEVEL_NORMAL, "SpdifModeControl\n");
511 }
512
513 bool SpdifModeControl::setValue( const int val )
514 {
515     EfcChangeFlagsCmd setCmd;
516     if(val) {
517         setCmd.m_setmask = FIREWORKS_EFC_FLAG_SPDIF_PRO;
518     } else {
519         setCmd.m_clearmask = FIREWORKS_EFC_FLAG_SPDIF_PRO;
520     }
521     debugOutput(DEBUG_LEVEL_VERBOSE, "setValue val: %d setmask: %08X, clear: %08X\n",
522                                       val, setCmd.m_setmask, setCmd.m_clearmask);
523     if (!m_ParentDevice.doEfcOverAVC(setCmd))
524     {
525         debugError("Cmd failed\n");
526         return false;
527     }
528     return true;
529 }
530
531 int SpdifModeControl::getValue( )
532 {
533     EfcGetFlagsCmd getCmd;
534     if (!m_ParentDevice.doEfcOverAVC(getCmd))
535     {
536         debugError("Cmd failed\n");
537         return 0;
538     }
539     debugOutput(DEBUG_LEVEL_VERBOSE, "got flags: %08X\n",
540                                       getCmd.m_flags);
541     if(getCmd.m_flags & FIREWORKS_EFC_FLAG_SPDIF_PRO) return 1;
542     else return 0;
543 }
544
545 // --- io config controls
546
547 IOConfigControl::IOConfigControl(FireWorks::Device& parent,
548                                  enum eIOConfigRegister r)
549 : Control::Discrete(&parent, "IOConfigControl")
550 , m_Slave(new EfcGenericIOConfigCmd(r))
551 , m_ParentDevice(parent)
552 {
553 }
554
555 IOConfigControl::IOConfigControl(FireWorks::Device& parent,
556                                  enum eIOConfigRegister r,
557                                  std::string n)
558 : Control::Discrete(&parent, n)
559 , m_Slave(new EfcGenericIOConfigCmd(r))
560 , m_ParentDevice(parent)
561 {
562 }
563
564 IOConfigControl::~IOConfigControl()
565 {
566     delete m_Slave;
567 }
568
569 void IOConfigControl::show()
570 {
571     debugOutput(DEBUG_LEVEL_NORMAL, "IOConfigControl\n");
572     if(m_Slave) m_Slave->showEfcCmd();
573 }
574
575 bool IOConfigControl::setValue( const int val )
576 {
577     if(m_Slave) {
578         m_Slave->setType(eCT_Set);
579         m_Slave->m_value=val;
580         if (!m_ParentDevice.doEfcOverAVC(*m_Slave))
581         {
582             debugError("Cmd failed\n");
583             return 0;
584         }
585         debugOutput(DEBUG_LEVEL_VERBOSE, "setValue to %d \n", val);
586         return true;
587     } else {
588         debugError("No slave EFC command present\n");
589         return false;
590     }
591 }
592
593 int IOConfigControl::getValue( )
594 {
595     if(m_Slave) {
596         m_Slave->setType(eCT_Get);
597         if (!m_ParentDevice.doEfcOverAVC(*m_Slave))
598         {
599             debugError("Cmd failed\n");
600             return 0;
601         }
602         debugOutput(DEBUG_LEVEL_VERBOSE, "getValue: result=%d\n",
603                                           m_Slave->m_value);
604         return m_Slave->m_value;
605     } else {
606         debugError("No slave EFC command present\n");
607         return 0;
608     }
609 }
610
611 // PlaybackRouting controls
612
613 PlaybackRoutingControl::PlaybackRoutingControl(FireWorks::Device& parent)
614 : Control::Discrete(&parent, "PlaybackRouting")
615 , m_ParentDevice(parent)
616 {
617 }
618
619 PlaybackRoutingControl::PlaybackRoutingControl(FireWorks::Device& parent, std::string n)
620 : Control::Discrete(&parent, n)
621 , m_ParentDevice(parent)
622 {
623 }
624
625 PlaybackRoutingControl::~PlaybackRoutingControl()
626 {
627 }
628
629 void PlaybackRoutingControl::show()
630 {
631     debugOutput(DEBUG_LEVEL_NORMAL, "PlaybackRouting\n");
632 }
633
634 bool PlaybackRoutingControl::GetState(EfcIsocMapIOConfigCmd *cmd)
635 {
636     cmd->m_num_playmap_entries = 3;
637     cmd->m_playmap[0] = 0;
638     cmd->m_playmap[1] = 0;
639     cmd->m_playmap[2] = 0;
640
641     cmd->setType(eCT_Get);
642     if (!m_ParentDevice.doEfcOverAVC(*cmd))
643         return false;
644
645     return true;
646 }
647
648
649 bool PlaybackRoutingControl::setValue(int idx, int v)
650 {
651     EfcIsocMapIOConfigCmd setCmd;
652
653     /*
654      * NOTE:
655      * Playback Stream ch1/2: 0
656      * Playback Stream ch3/4: 2
657      * Playback Stream ch5/6: 4
658      */
659     unsigned int value = v * 2;
660
661     if (!GetState(&setCmd)) {
662         debugError("Cmd failed\n");
663         return false;
664     }
665
666     setCmd.m_playmap[idx] = value;
667
668     setCmd.setType(eCT_Set);
669     if (!m_ParentDevice.doEfcOverAVC(setCmd)) {
670         debugError("Cmd failed\n");
671         return false;
672     }
673
674     debugOutput(DEBUG_LEVEL_VERBOSE, "setValue: result=%d:%d\n",
675                                       idx,
676                                       setCmd.m_playmap[idx]);
677
678     return true;
679 }
680
681 int PlaybackRoutingControl::getValue(int idx)
682 {
683     EfcIsocMapIOConfigCmd getCmd;
684     GetState(&getCmd);
685
686     debugOutput(DEBUG_LEVEL_VERBOSE, "getValue: result=[%d][%d][%d]\n",
687                                       getCmd.m_playmap[0],
688                                       getCmd.m_playmap[1],
689                                       getCmd.m_playmap[2]);
690
691     return getCmd.m_playmap[idx] / 2;
692 }
693
694 // control to get hardware information
695 HwInfoControl::HwInfoControl(FireWorks::Device& p,
696                              enum eHwInfoField f)
697 : Control::Discrete(&p, "HwInfoControl")
698 , m_ParentDevice(p)
699 , m_Field(f)
700 {
701 }
702
703 HwInfoControl::HwInfoControl(FireWorks::Device& p,
704                              enum eHwInfoField f,
705                              std::string n)
706 : Control::Discrete(&p, n)
707 , m_ParentDevice(p)
708 , m_Field(f)
709 {
710 }
711
712 HwInfoControl::~HwInfoControl()
713 {
714 }
715
716 int HwInfoControl::getValue()
717 {
718     switch (m_Field) {
719         case eHIF_PhysicalAudioOutCount:
720             return m_ParentDevice.getHwInfo().m_nb_phys_audio_out;
721         case eHIF_PhysicalAudioInCount:
722             return m_ParentDevice.getHwInfo().m_nb_phys_audio_in;
723         case eHIF_1394PlaybackCount:
724             return m_ParentDevice.getHwInfo().m_nb_1394_playback_channels;
725         case eHIF_1394RecordCount:
726             return m_ParentDevice.getHwInfo().m_nb_1394_record_channels;
727         case eHIF_GroupOutCount:
728             return m_ParentDevice.getHwInfo().m_nb_out_groups;
729         case eHIF_GroupInCount:
730             return m_ParentDevice.getHwInfo().m_nb_in_groups;
731         case eHIF_PhantomPower:
732             return m_ParentDevice.getHwInfo().hasSoftwarePhantom();
733         case eHIF_OpticalInterface:
734             return m_ParentDevice.getHwInfo().hasOpticalInterface();
735         case eHIF_PlaybackRouting:
736             return m_ParentDevice.getHwInfo().hasPlaybackRouting();
737         default:
738             debugError("Bogus field\n");
739             return 0;
740     }
741 }
742
743 void HwInfoControl::show()
744 {
745     debugOutput(DEBUG_LEVEL_NORMAL, "HwInfoControl\n");
746 }
747
748
749 // control to save settings
750 MultiControl::MultiControl(FireWorks::Device& p, enum eType t)
751 : Control::Discrete(&p, "MultiControl")
752 , m_ParentDevice(p)
753 , m_Type(t)
754 {
755 }
756
757 MultiControl::MultiControl(FireWorks::Device& p,
758                            enum eType t, std::string n)
759 : Control::Discrete(&p, n)
760 , m_ParentDevice(p)
761 , m_Type(t)
762 {
763 }
764
765 MultiControl::~MultiControl()
766 {
767 }
768
769 bool MultiControl::setValue(const int v)
770 {
771     switch(m_Type) {
772     case eT_SaveSession:
773         debugOutput(DEBUG_LEVEL_VERBOSE, "saving session\n");
774         return m_ParentDevice.saveSession();
775     case eT_Identify:
776         debugOutput(DEBUG_LEVEL_VERBOSE, "identify device\n");
777         {
778             EfcIdentifyCmd cmd;
779             if (!m_ParentDevice.doEfcOverAVC(cmd))
780             {
781                 debugError("Cmd failed\n");
782                 return false;
783             }
784         }
785         return true;
786     default:
787         debugError("Bad type\n");
788         return false;
789     }
790 }
791
792 void MultiControl::show()
793 {
794     debugOutput(DEBUG_LEVEL_NORMAL, "MultiControl\n");
795     switch(m_Type) {
796     case eT_SaveSession:
797         debugOutput(DEBUG_LEVEL_NORMAL, "Type: SaveSession\n");
798         break;
799     case eT_Identify:
800         debugOutput(DEBUG_LEVEL_NORMAL, "Type: Identify\n");
801         break;
802     default:
803         debugError("Bad type\n");
804     }
805 }
806
807 } // FireWorks
Note: See TracBrowser for help on using the browser.