2 * Copyright (C) 2005-2008 by Pieter Palmers
4 * This file is part of FFADO
5 * FFADO = Free Firewire (pro-)audio drivers for linux
7 * FFADO is based upon FreeBoB
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.
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.
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/>.
25 #include "efc_cmds_monitor.h"
27 #include "libutil/ByteSwap.h"
34 const char *eMonitorCommandToString(const enum eMonitorCommand command
) {
49 EfcGenericMonitorCmd::EfcGenericMonitorCmd(enum eCmdType type
,
50 enum eMonitorCommand command
)
56 , m_command ( command
)
58 m_category_id
=EFC_CAT_MONITOR_MIX
;
59 if (type
== eCT_Get
) {
62 m_command_id
=EFC_CMD_MIXER_GET_GAIN
;
65 m_command_id
=EFC_CMD_MIXER_GET_SOLO
;
68 m_command_id
=EFC_CMD_MIXER_GET_MUTE
;
71 m_command_id
=EFC_CMD_MIXER_GET_PAN
;
74 debugError("Invalid mixer get command: %d\n", command
);
79 m_command_id
=EFC_CMD_MIXER_SET_GAIN
;
82 m_command_id
=EFC_CMD_MIXER_SET_SOLO
;
85 m_command_id
=EFC_CMD_MIXER_SET_MUTE
;
88 m_command_id
=EFC_CMD_MIXER_SET_PAN
;
91 debugError("Invalid mixer set command: %d\n", command
);
97 EfcGenericMonitorCmd::serialize( Util::Cmd::IOSSerialize
& se
)
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;
106 result
&= EfcCmd::serialize ( se
);
108 result
&= se
.write(CondSwapToBus32(m_input
), "Input" );
109 result
&= se
.write(CondSwapToBus32(m_output
), "Output" );
112 // the length should be specified before
113 // the header is serialized
114 m_length
=EFC_HEADER_LENGTH_QUADLETS
+3;
116 result
&= EfcCmd::serialize ( se
);
118 result
&= se
.write(CondSwapToBus32(m_input
), "Input" );
119 result
&= se
.write(CondSwapToBus32(m_output
), "Output" );
120 result
&= se
.write(CondSwapToBus32(m_value
), "Value" );
126 EfcGenericMonitorCmd::deserialize( Util::Cmd::IISDeserialize
& de
)
130 result
&= EfcCmd::deserialize ( de
);
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
);
139 debugWarning("Deserialization failed\n");
146 EfcGenericMonitorCmd::showEfcCmd()
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
);
157 // --- The specific commands
161 } // namespace FireWorks