root/trunk/libffado/src/fireworks/efc/efc_cmds_monitor.cpp

Revision 2803, 4.6 kB (checked in by jwoithe, 3 years ago)

Cosmetic: capitalise "L" in "Linux".

"Linux" is a proper noun so it should start with a capital letter. These
changes are almost all within comments.

This patch was originally proposed by pander on the ffado-devel mailing
list. It has been expanded to cover all similar cases to maintain
consistency throughout the source tree.

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 "efc_cmd.h"
25 #include "efc_cmds_monitor.h"
26
27 #include "libutil/ByteSwap.h"
28 #include <iostream>
29
30 using namespace std;
31
32 namespace FireWorks {
33
34 const char *eMonitorCommandToString(const enum eMonitorCommand command) {
35     switch (command) {
36         case eMoC_Gain:
37             return "eMC_Gain";
38         case eMoC_Solo:
39             return "eMoC_Solo";
40         case eMoC_Mute:
41             return "eMoC_Mute";
42         case eMoC_Pan:
43             return "eMoC_Pan";
44         default:
45             return "invalid";
46     }
47 }
48
49 EfcGenericMonitorCmd::EfcGenericMonitorCmd(enum eCmdType type,
50                                            enum eMonitorCommand command)
51     : EfcCmd()
52     , m_input ( -1 )
53     , m_output ( -1 )
54     , m_value ( 0 )
55     , m_type ( type )
56     , m_command ( command )
57 {
58     m_category_id=EFC_CAT_MONITOR_MIX;
59     if (type == eCT_Get) {
60         switch (command) {
61             case eMoC_Gain:
62                 m_command_id=EFC_CMD_MIXER_GET_GAIN;
63                 break;
64             case eMoC_Solo:
65                 m_command_id=EFC_CMD_MIXER_GET_SOLO;
66                 break;
67             case eMoC_Mute:
68                 m_command_id=EFC_CMD_MIXER_GET_MUTE;
69                 break;
70             case eMoC_Pan:
71                 m_command_id=EFC_CMD_MIXER_GET_PAN;
72                 break;
73             default:
74                 debugError("Invalid mixer get command: %d\n", command);
75         }
76     } else {
77         switch (command) {
78             case eMoC_Gain:
79                 m_command_id=EFC_CMD_MIXER_SET_GAIN;
80                 break;
81             case eMoC_Solo:
82                 m_command_id=EFC_CMD_MIXER_SET_SOLO;
83                 break;
84             case eMoC_Mute:
85                 m_command_id=EFC_CMD_MIXER_SET_MUTE;
86                 break;
87             case eMoC_Pan:
88                 m_command_id=EFC_CMD_MIXER_SET_PAN;
89                 break;
90             default:
91                 debugError("Invalid mixer set command: %d\n", command);
92         }
93     }
94 }
95
96 bool
97 EfcGenericMonitorCmd::serialize( Util::Cmd::IOSSerialize& se )
98 {
99     bool result=true;
100
101     if (m_type == eCT_Get) {
102         // the length should be specified before
103         // the header is serialized
104         m_length=EFC_HEADER_LENGTH_QUADLETS+2;
105
106         result &= EfcCmd::serialize ( se );
107        
108         result &= se.write(CondSwapToBus32(m_input), "Input" );
109         result &= se.write(CondSwapToBus32(m_output), "Output" );
110        
111     } else {
112         // the length should be specified before
113         // the header is serialized
114         m_length=EFC_HEADER_LENGTH_QUADLETS+3;
115
116         result &= EfcCmd::serialize ( se );
117        
118         result &= se.write(CondSwapToBus32(m_input), "Input" );
119         result &= se.write(CondSwapToBus32(m_output), "Output" );
120         result &= se.write(CondSwapToBus32(m_value), "Value" );
121     }
122     return result;
123 }
124
125 bool
126 EfcGenericMonitorCmd::deserialize( Util::Cmd::IISDeserialize& de )
127 {
128     bool result=true;
129
130     result &= EfcCmd::deserialize ( de );
131
132     if (m_type == eCT_Get) {
133         EFC_DESERIALIZE_AND_SWAP(de, (quadlet_t *)&m_input, result);
134         EFC_DESERIALIZE_AND_SWAP(de, (quadlet_t *)&m_output, result);
135         EFC_DESERIALIZE_AND_SWAP(de, &m_value, result);
136     }
137
138     if(!result) {
139         debugWarning("Deserialization failed\n");
140     }
141
142     return result;
143 }
144
145 void
146 EfcGenericMonitorCmd::showEfcCmd()
147 {
148     EfcCmd::showEfcCmd();
149     debugOutput(DEBUG_LEVEL_NORMAL, "EFC %s MONITOR %s:\n",
150                                     (m_type==eCT_Get?"GET":"SET"),
151                                     eMonitorCommandToString(m_command));
152     debugOutput(DEBUG_LEVEL_NORMAL, " Input       : %d\n", m_input);
153     debugOutput(DEBUG_LEVEL_NORMAL, " Output      : %d\n", m_output);
154     debugOutput(DEBUG_LEVEL_NORMAL, " Value       : %u\n", m_value);
155 }
156
157 // --- The specific commands
158
159
160
161 } // namespace FireWorks
Note: See TracBrowser for help on using the browser.