1 |
/* |
---|
2 |
* Copyright (C) 2005-2009 by Jonathan Woithe |
---|
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 |
#include "rme/rme_avdevice.h" |
---|
24 |
#include "rme/fireface_def.h" |
---|
25 |
|
---|
26 |
#include "debugmodule/debugmodule.h" |
---|
27 |
|
---|
28 |
namespace Rme { |
---|
29 |
|
---|
30 |
signed int |
---|
31 |
Device::getPhantom(unsigned int channel) { |
---|
32 |
|
---|
33 |
if (channel > 3) { |
---|
34 |
debugOutput(DEBUG_LEVEL_WARNING, "Channel %d phantom power not supported\n", channel); |
---|
35 |
return -1; |
---|
36 |
} |
---|
37 |
|
---|
38 |
return settings.mic_phantom[channel] != 0; |
---|
39 |
} |
---|
40 |
|
---|
41 |
signed int |
---|
42 |
Device::setPhantom(unsigned int channel, unsigned int status) { |
---|
43 |
|
---|
44 |
if (channel > 3) { |
---|
45 |
debugOutput(DEBUG_LEVEL_WARNING, "Channel %d phantom power not supported\n", channel); |
---|
46 |
return -1; |
---|
47 |
} |
---|
48 |
|
---|
49 |
settings.mic_phantom[channel] = (status != 0); |
---|
50 |
set_hardware_params(); |
---|
51 |
|
---|
52 |
return 0; |
---|
53 |
} |
---|
54 |
|
---|
55 |
signed int |
---|
56 |
Device::getInputPadOpt(unsigned int channel) { |
---|
57 |
if (m_rme_model!=RME_MODEL_FIREFACE400 || channel<3 || channel>4) { |
---|
58 |
debugOutput(DEBUG_LEVEL_WARNING, "Channel %d input pad option not supported for model %d\n", channel, m_rme_model); |
---|
59 |
return -1; |
---|
60 |
} |
---|
61 |
return settings.ff400_input_pad[channel-3] != 0; |
---|
62 |
} |
---|
63 |
|
---|
64 |
signed int |
---|
65 |
Device::setInputPadOpt(unsigned int channel, unsigned int status) { |
---|
66 |
if (m_rme_model!=RME_MODEL_FIREFACE400 || channel<3 || channel>4) { |
---|
67 |
debugOutput(DEBUG_LEVEL_WARNING, "Channel %d input pad option not supported for model %d\n", channel, m_rme_model); |
---|
68 |
return -1; |
---|
69 |
} |
---|
70 |
settings.ff400_input_pad[channel-3] = (status != 0); |
---|
71 |
set_hardware_params(); |
---|
72 |
return 0; |
---|
73 |
} |
---|
74 |
|
---|
75 |
signed int |
---|
76 |
Device::getInputInstrOpt(unsigned int channel) { |
---|
77 |
if (m_rme_model!=RME_MODEL_FIREFACE400 || channel<3 || channel>4) { |
---|
78 |
debugOutput(DEBUG_LEVEL_WARNING, "Channel %d input instrument option not supported for model %d\n", channel, m_rme_model); |
---|
79 |
return -1; |
---|
80 |
} |
---|
81 |
return settings.ff400_instr_input[channel-3] != 0; |
---|
82 |
} |
---|
83 |
|
---|
84 |
signed int |
---|
85 |
Device::setInputInstrOpt(unsigned int channel, unsigned int status) { |
---|
86 |
if (m_rme_model!=RME_MODEL_FIREFACE400 || channel<3 || channel>4) { |
---|
87 |
debugOutput(DEBUG_LEVEL_WARNING, "Channel %d input instrument option not supported for model %d\n", channel, m_rme_model); |
---|
88 |
return -1; |
---|
89 |
} |
---|
90 |
settings.ff400_instr_input[channel-3] = (status != 0); |
---|
91 |
set_hardware_params(); |
---|
92 |
return 0; |
---|
93 |
} |
---|
94 |
|
---|
95 |
signed int |
---|
96 |
Device::getAmpGain(unsigned int index) { |
---|
97 |
if (m_rme_model != RME_MODEL_FIREFACE400) { |
---|
98 |
debugOutput(DEBUG_LEVEL_WARNING, "Amp gains only supported on FF400\n"); |
---|
99 |
return -1; |
---|
100 |
} |
---|
101 |
if (index > 21) { |
---|
102 |
debugOutput(DEBUG_LEVEL_WARNING, "Amp gain index %d invalid\n", index); |
---|
103 |
return -1; |
---|
104 |
} |
---|
105 |
return settings.amp_gains[index]; |
---|
106 |
} |
---|
107 |
|
---|
108 |
signed int |
---|
109 |
Device::setAmpGain(unsigned int index, signed int val) { |
---|
110 |
quadlet_t regval = 0; |
---|
111 |
|
---|
112 |
if (m_rme_model != RME_MODEL_FIREFACE400) { |
---|
113 |
debugOutput(DEBUG_LEVEL_WARNING, "Amp gains only supported on FF400\n"); |
---|
114 |
return -1; |
---|
115 |
} |
---|
116 |
if (index > 21) { |
---|
117 |
debugOutput(DEBUG_LEVEL_WARNING, "Amp gain index %d invalid\n", index); |
---|
118 |
return -1; |
---|
119 |
} |
---|
120 |
settings.amp_gains[index] = val & 0xff; |
---|
121 |
return set_hardware_ampgain(index, val); |
---|
122 |
} |
---|
123 |
|
---|
124 |
} |
---|