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

Revision 1794, 3.3 kB (checked in by arnonym, 11 years ago)

This might (or might not) fix #256 by actually implementing EAP-support for the Pro40.

Please someone test this and report back.

Everything should work except:

  • The volume knob doesn't seem to have an effect on the Pro24, don't know about the Pro40. It writes to the right registers but somehow the hardware doesn't recognise it.
  • The "Use ADAT-Out as S/PDIF" and "Pad Output" are not implemented yet.
  • I don't know whether changing to nickname works with the Pro40. It doesn't with the Pro24 altough the correct registers are written to. Probably sending an OP-code is missing...
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 void SaffirePro40::SaffirePro40EAP::setupSources() {
47     addSource("SPDIF",  6,  2, eRS_AES);
48     addSource("ADAT",   0,  8, eRS_ADAT);
49     addSource("Analog", 0,  8, eRS_InS0);
50     addSource("Mixer",  0, 16, eRS_Mixer);
51     addSource("1394",   0, 16, eRS_ARX0);
52     addSource("Mute",   0,  1, eRS_Muted);
53 }
54 void SaffirePro40::SaffirePro40EAP::setupDestinations() {
55     addDestination("SPDIF",  6,  2, eRD_AES);
56     addDestination("ADAT",   0,  8, eRD_ADAT);
57     addDestination("Analog", 0,  8, eRD_InS0);
58     addDestination("Mixer",  0, 16, eRD_Mixer0);
59     addDestination("Mixer",  0,  2, eRD_Mixer1, 16);
60     addDestination("1394",   0, 16, eRD_ATX0);
61     addDestination("Mute",   0,  1, eRD_Muted);
62 }
63
64 SaffirePro40::SaffirePro40( DeviceManager& d,
65                                         std::auto_ptr<ConfigRom>( configRom ))
66     : Dice::Device( d , configRom)
67 {
68     debugOutput( DEBUG_LEVEL_VERBOSE, "Created Dice::Focusrite::SaffirePro40 (NodeID %d)\n",
69                  getConfigRom().getNodeId() );
70 }
71
72 SaffirePro40::~SaffirePro40()
73 {
74     getEAP()->storeFlashConfig();
75 }
76
77 bool SaffirePro40::discover() {
78     if (Dice::Device::discover()) {
79         m_monitor = new FocusriteEAP::MonitorSection(dynamic_cast<FocusriteEAP*>(getEAP()), "Monitoring");
80         getEAP()->addElement(m_monitor);
81         return true;
82     }
83     return false;
84 }
85
86 void
87 SaffirePro40::showDevice()
88 {
89     debugOutput(DEBUG_LEVEL_VERBOSE, "This is a Dice::Focusrite::SaffirePro40\n");
90     Dice::Device::showDevice();
91 }
92
93 Dice::EAP* SaffirePro40::createEAP() {
94     return new SaffirePro40EAP(*this);
95 }
96
97 bool SaffirePro40::setNickName(std::string name) {
98     return getEAP()->writeRegBlock(Dice::EAP::eRT_Application, 0x44, (quadlet_t*)name.c_str(), name.size());
99 }
100 std::string SaffirePro40::getNickName() {
101     char name[16];
102     getEAP()->readRegBlock(Dice::EAP::eRT_Application, 0x44, (quadlet_t*)name, 16);
103     return std::string(name);
104 }
105
106 }
107 }
108 // vim: et
Note: See TracBrowser for help on using the browser.