root/trunk/libffado/src/dice/focusrite/saffire_pro40.cpp

Revision 2097, 5.3 kB (checked in by adi, 11 years ago)

DICE-EAP Undefine Mute destinations for Saffire Pro40 and 24

By Philippe Carriere:

Mute destinations, while existing in the hardware are confusing and not
user meaningful; then avoid to define them in the destinations. If some
usefulness will be provided in the future, just uncommenting the
corresponding line would be required.

Line 
1 /*
2  * Copyright (C) 2009 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 "saffire_pro40.h"
25
26 #include "focusrite_eap.h"
27
28 namespace Dice {
29 namespace Focusrite {
30
31 int SaffirePro40::SaffirePro40EAP::commandToFix(unsigned offset) {
32     if (offset<0x14) return 2;
33     if (offset<0x3C && offset>=0x14) return 1;
34     if (offset<0x5C && offset>=0x54) return 1;
35     if (offset<0x44 && offset>=0x3C) return 3;
36     if (offset == 0x5C) return 4;
37     return 0;
38 }
39 FocusriteEAP::Poti* SaffirePro40::SaffirePro40EAP::getMonitorPoti(std::string name) {
40     return new FocusriteEAP::Poti(this, name, 0x54);
41 }
42 FocusriteEAP::Poti* SaffirePro40::SaffirePro40EAP::getDimPoti(std::string name) {
43     return new FocusriteEAP::Poti(this, name, 0x58);
44 }
45
46 //
47 // Under 48kHz Saffire pro 40 has
48 //  - 8 analogic inputs (mic/line)
49 //  - 8 ADAT inputs
50 //  - 2 SPDIF inputs
51 //  - 20 ieee1394 inputs
52 //  - 18 mixer inputs
53 //
54 //  - 10 analogic outputs
55 //  - 8 ADAT outputs
56 //  - 2 SPDIF outputs
57 //  - 20 ieee1394 outputs
58 //  - 16 mixer outputs
59 //
60 void SaffirePro40::SaffirePro40EAP::setupSources_low() {
61     addSource("SPDIF",  0,  2, eRS_AES, 1);
62     addSource("ADAT",   0,  8, eRS_ADAT, 1);
63     addSource("Mic/Lin", 16,  8, eRS_InS0, 1);
64     addSource("Mixer",  0, 16, eRS_Mixer, 1);
65     addSource("1394",   0, 12, eRS_ARX0, 1);
66     addSource("1394",   0,  8, eRS_ARX1, 13);
67     addSource("Mute",   0,  1, eRS_Muted);
68 }
69
70 void SaffirePro40::SaffirePro40EAP::setupDestinations_low() {
71     addDestination("SPDIF",  0,  2, eRD_AES, 1);
72     addDestination("ADAT",   0,  8, eRD_ADAT, 1);
73     addDestination("Line", 0,  2, eRD_InS0, 1);
74     addDestination("Line", 0,  8, eRD_InS1, 3);
75     addDestination("Mixer",  0, 16, eRD_Mixer0, 1);
76     addDestination("Mixer",  0,  2, eRD_Mixer1, 17);
77     addDestination("1394",   0, 10, eRD_ATX0, 1);
78     addDestination("1394",   0,  8, eRD_ATX1, 11);
79     addDestination("Loop",   8,  2, eRD_ATX1, 1);
80 // Is a Mute destination useful ?
81 //    addDestination("Mute",   0,  1, eRD_Muted);
82 }
83
84 //
85 // Under 96kHz Saffire pro 40 has
86 //  - 8 analogic inputs (mic/line)
87 //  - 4 ADAT inputs
88 //  - 2 SPDIF inputs
89 //  - 16 ieee1394 inputs
90 //  - 18 mixer inputs
91 //
92 //  - 10 analogic outputs
93 //  - 4 ADAT outputs
94 //  - 2 SPDIF outputs
95 //  - 16 ieee1394 outputs
96 //  - 16 mixer outputs
97 //
98 void SaffirePro40::SaffirePro40EAP::setupSources_mid() {
99     addSource("SPDIF",  0,  2, eRS_AES, 1);
100     addSource("ADAT",   0,  4, eRS_ADAT, 1);
101     addSource("Mic/Lin", 16,  8, eRS_InS0, 1);
102     addSource("Mixer",  0, 16, eRS_Mixer, 1);
103     addSource("1394",   0, 16, eRS_ARX0, 1);
104     addSource("Mute",   0,  1, eRS_Muted);
105 }
106
107 void SaffirePro40::SaffirePro40EAP::setupDestinations_mid() {
108     addDestination("SPDIF",  0,  2, eRD_AES, 1);
109     addDestination("ADAT",   0,  4, eRD_ADAT, 1);
110     addDestination("Line", 0,  2, eRD_InS0, 1);
111     addDestination("Line", 0,  8, eRD_InS1, 3);
112     addDestination("Mixer",  0, 16, eRD_Mixer0, 1);
113     addDestination("Mixer",  0,  2, eRD_Mixer1, 17);
114     addDestination("1394",   0, 14, eRD_ATX0, 1);
115     addDestination("Loop",   14, 2, eRD_ATX0, 1);
116 // Is a Mute destination useful ?
117 //    addDestination("Mute",   0,  1, eRD_Muted);
118 }
119
120 //
121 // 192 kHz is not supported
122 //
123 void SaffirePro40::SaffirePro40EAP::setupSources_high() {
124     printMessage("High (192 kHz) sample rate not supported by Saffire Pro 40\n");
125 }
126
127 void SaffirePro40::SaffirePro40EAP::setupDestinations_high() {
128     printMessage("High (192 kHz) sample rate not supported by Saffire Pro 40\n");
129 }
130
131 SaffirePro40::SaffirePro40( DeviceManager& d,
132                                         std::auto_ptr<ConfigRom>( configRom ))
133     : Dice::Device( d , configRom)
134 {
135     debugOutput( DEBUG_LEVEL_VERBOSE, "Created Dice::Focusrite::SaffirePro40 (NodeID %d)\n",
136                  getConfigRom().getNodeId() );
137 }
138
139 SaffirePro40::~SaffirePro40()
140 {
141     getEAP()->storeFlashConfig();
142 }
143
144 bool SaffirePro40::discover() {
145     if (Dice::Device::discover()) {
146         m_monitor = new FocusriteEAP::MonitorSection(dynamic_cast<FocusriteEAP*>(getEAP()), "Monitoring");
147         getEAP()->addElement(m_monitor);
148         return true;
149     }
150     return false;
151 }
152
153 void
154 SaffirePro40::showDevice()
155 {
156     debugOutput(DEBUG_LEVEL_VERBOSE, "This is a Dice::Focusrite::SaffirePro40\n");
157     Dice::Device::showDevice();
158 }
159
160 Dice::EAP* SaffirePro40::createEAP() {
161     return new SaffirePro40EAP(*this);
162 }
163
164 bool SaffirePro40::setNickname(std::string name) {
165     return getEAP()->writeRegBlock(Dice::EAP::eRT_Application, 0x44, (quadlet_t*)name.c_str(), name.size());
166 }
167 std::string SaffirePro40::getNickname() {
168     char name[16];
169     getEAP()->readRegBlock(Dice::EAP::eRT_Application, 0x44, (quadlet_t*)name, 16);
170     return std::string(name);
171 }
172
173 }
174 }
175 // vim: et
Note: See TracBrowser for help on using the browser.