root/trunk/libffado/src/dice/presonus/firestudio_project.cpp

Revision 2257, 5.2 kB (checked in by philippe, 11 years ago)

Firestudio Project. Introduce specific routing support for this device. Compilation checked, but not yet called by dice_avdevice.cpp.

Line 
1 /*
2  * Copyright (C) 2009 by Pieter Palmers
3  * Copyright (C) 2012 by Philippe Carriere
4  *
5  * This file is part of FFADO
6  * FFADO = Free Firewire (pro-)audio drivers for linux
7  *
8  * FFADO is based upon FreeBoB.
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 2 of the License, or
13  * (at your option) version 3 of the License.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22  *
23  */
24
25 #include "firestudio_project.h"
26
27 namespace Dice {
28 namespace Presonus {
29
30 //
31 // Firestudio Project has
32 //  - 8 mic/line inputs
33 //  - 2 SPDIF inputs
34 //  - 10 ieee1394 inputs
35 //  - 18 mixer inputs
36 //
37 //  - 8 analogic line outputs
38 //  - 2 SPDIF outputs
39 //  - 10 ieee1394 outputs
40 //  - 16 mixer outputs
41 //
42 void FirestudioProject::FirestudioProjectEAP::setupSources_low() {
43     addSource("SPDIF/In",  2,  2, eRS_AES, 1);
44     addSource("Mic/Inst/In", 0,  2, eRS_InS0, 1);
45     addSource("Mic/Lin/In", 2,  6, eRS_InS0, 3);
46     addSource("Mixer/Out",  0, 16, eRS_Mixer, 1);
47     addSource("1394/In",   0, 10, eRS_ARX0, 1);
48     addSource("Mute",   0,  1, eRS_Muted);
49 }
50
51 void FirestudioProject::FirestudioProjectEAP::setupDestinations_low() {
52     addDestination("SPDIF/Out",  2,  2, eRD_AES, 1);
53     addDestination("Line/Out", 0,  8, eRD_InS0, 1);
54     addDestination("Mixer/In",  0, 16, eRD_Mixer0, 1);
55     addDestination("Mixer/In",  0,  2, eRD_Mixer1, 17);
56     addDestination("1394/Out",   0, 10, eRD_ATX0, 1);
57 // Is a Mute destination useful ?
58 //    addDestination("Mute",   0,  1, eRD_Muted);
59 }
60
61 //
62 // Independent of samplerate
63 void FirestudioProject::FirestudioProjectEAP::setupSources_mid() {
64     setupSources_low();
65 }
66
67 void FirestudioProject::FirestudioProjectEAP::setupDestinations_mid() {
68     setupDestinations_low();
69 }
70
71 //
72 // 192 kHz is not supported
73 //
74 void FirestudioProject::FirestudioProjectEAP::setupSources_high() {
75     printMessage("High (192 kHz) sample rate not supported by Firestudio Tube\n");
76 }
77
78 void FirestudioProject::FirestudioProjectEAP::setupDestinations_high() {
79     printMessage("High (192 kHz) sample rate not supported by Firestudio Tube\n");
80 }
81
82 /**
83  * The default configuration for the Firestudio Project.
84  * 82 destinations; each "group" every 32 registers
85  **FIXME What follows is extracted from a listing of an existing router configuration.
86  *       However, the origin of such a router configuration was unknown.
87  */
88 void
89 FirestudioProject::FirestudioProjectEAP::setupDefaultRouterConfig_low() {
90     unsigned int i;
91     // the 1394 stream receivers
92     for (i=0; i<8; i++) {
93         addRoute(eRS_InS0, i, eRD_ATX0, i);
94     }
95     for (i=0; i<2; i++) {
96         addRoute(eRS_AES, i+2, eRD_ATX0, i+8);
97     }
98     // Then 22 muted destinations
99     for (i=0; i<22; i++) {
100         addRoute(eRS_Muted, 0, eRD_Muted, 0);
101     }
102    
103     // the Mixer inputs
104     for (i=0; i<8; i++) {
105         addRoute(eRS_InS0, i, eRD_Mixer0, i);
106     }
107     for (i=0; i<2; i++) {
108         addRoute(eRS_AES, i+2, eRD_Mixer0, i+8);
109     }
110     for (i=0; i<6; i++) {
111         addRoute(eRS_ARX0, i, eRD_Mixer0, i+10);
112     }
113     for (i=0; i<2; i++) {
114         addRoute(eRS_ARX0, i+6, eRD_Mixer1, i);
115     }
116     // Then 14 muted destinations
117     for (i=0; i<14; i++) {
118         addRoute(eRS_Muted, 0, eRD_Muted, 0);
119     }
120
121     // The audio ports
122     // Ensure that audio port are not muted
123     for (i=0; i<8; i++) {
124         addRoute(eRS_ARX0, i, eRD_InS0, i);
125     }
126     // The SPDIF ports
127     for (i=0; i<2; i++) {
128         addRoute(eRS_ARX0, i+8, eRD_AES, i+2);
129     }
130     // Then 8 muted destinations
131     for (i=0; i<8; i++) {
132         addRoute(eRS_Muted, 0, eRD_Muted, 0);
133     } 
134 }
135
136 /**
137  *  Identical to mid-rate
138  */
139 void
140 FirestudioProject::FirestudioProjectEAP::setupDefaultRouterConfig_mid() {
141     setupDefaultRouterConfig_low();
142 }
143
144 /**
145  *  High rate not supported
146  */
147 void
148 FirestudioProject::FirestudioProjectEAP::setupDefaultRouterConfig_high() {
149     printMessage("High (192 kHz) sample rate not supported by Firestudio Project\n");
150 }
151
152
153 /**
154   Device
155 */
156 FirestudioProject::FirestudioProject( DeviceManager& d,
157                                     std::auto_ptr<ConfigRom>( configRom ))
158     : Dice::Device( d , configRom)
159 {
160     debugOutput( DEBUG_LEVEL_VERBOSE, "Created Dice::Presonus::FirestudioProject (NodeID %d)\n",
161                  getConfigRom().getNodeId() );
162 }
163
164 FirestudioProject::~FirestudioProject()
165 {
166     getEAP()->storeFlashConfig();
167 }
168
169 bool FirestudioProject::discover() {
170     if (Dice::Device::discover()) {
171         debugOutput(DEBUG_LEVEL_VERBOSE, "Discovering Dice::Presonus::FirestudioProject\n");
172         return true;
173     }
174     return false;
175 }
176
177 void
178 FirestudioProject::showDevice()
179 {
180     debugOutput(DEBUG_LEVEL_VERBOSE, "This is a Dice::Presonus::FirestudioProject\n");
181     Dice::Device::showDevice();
182 }
183
184 Dice::EAP* FirestudioProject::createEAP() {
185     return new FirestudioProjectEAP(*this);
186 }
187
188 }
189 }
190 // vim: et
Note: See TracBrowser for help on using the browser.