1 // ****************************************************************************
2 //
3 // CEchoGals_info.cpp
4 //
5 // Implementation file for the CEchoGals driver class (info functions).
6 // Set editor tabs to 3 for your viewing pleasure.
7 //
8 // ----------------------------------------------------------------------------
9 //
10 // This file is part of Echo Digital Audio's generic driver library.
11 // Copyright Echo Digital Audio Corporation (c) 1998 - 2005
12 // All rights reserved
13 // www.echoaudio.com
14 //
15 // This library is free software; you can redistribute it and/or
16 // modify it under the terms of the GNU Lesser General Public
17 // License as published by the Free Software Foundation; either
18 // version 2.1 of the License, or (at your option) any later version.
19 //
20 // This library is distributed in the hope that it will be useful,
21 // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 // Lesser General Public License for more details.
24 //
25 // You should have received a copy of the GNU Lesser General Public
26 // License along with this library; if not, write to the Free Software
27 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 //
29 // ****************************************************************************
30
31 #include "CEchoGals.h"
32
33
34 /****************************************************************************
35
36 CEchoGals informational methods
37
38 ****************************************************************************/
39
40 //===========================================================================
41 //
42 // GetBaseCapabilities is used by the CEchoGals-derived classes to
43 // help fill out the ECHOGALS_CAPS struct.
44 //
45 //===========================================================================
46
GetBaseCapabilities(PECHOGALS_CAPS pCapabilities)47 ECHOSTATUS CEchoGals::GetBaseCapabilities
48 (
49 PECHOGALS_CAPS pCapabilities
50 )
51 {
52 CChannelMask DigMask, ChMask, AdatMask;
53 WORD i;
54
55 //
56 // Test only for no DSP object. We can still get capabilities even if
57 // board is bad.
58 //
59 if ( NULL == GetDspCommObject() )
60 return ECHOSTATUS_DSP_DEAD;
61
62 memset( pCapabilities, 0, sizeof(ECHOGALS_CAPS) );
63 strcpy( pCapabilities->szName, m_szCardInstallName );
64
65 pCapabilities->wCardType = GetDspCommObject()->GetCardType();
66 pCapabilities->wNumPipesOut = GetNumPipesOut();
67 pCapabilities->wNumPipesIn = GetNumPipesIn();
68 pCapabilities->wNumBussesOut = GetNumBussesOut();
69 pCapabilities->wNumBussesIn = GetNumBussesIn();
70
71 pCapabilities->wFirstDigitalBusOut = GetFirstDigitalBusOut();
72 pCapabilities->wFirstDigitalBusIn = GetFirstDigitalBusIn();
73
74 pCapabilities->wNumMidiOut = GetDspCommObject()->GetNumMidiOutChannels();
75 pCapabilities->wNumMidiIn = GetDspCommObject()->GetNumMidiInChannels();
76
77 pCapabilities->dwOutClockTypes = 0;
78 pCapabilities->dwInClockTypes = ECHO_CLOCK_BIT_INTERNAL;
79
80 //
81 // Add the controls to the output pipes that are
82 // the same for all cards
83 //
84 for (i = 0; i < GetNumPipesOut(); i++)
85 {
86 pCapabilities->dwPipeOutCaps[i] = ECHOCAPS_GAIN |
87 ECHOCAPS_MUTE;
88 }
89
90 //
91 // Add controls to the input busses that are the same for all cards
92 //
93 WORD wFirstDigitalBusIn = GetFirstDigitalBusIn();
94 for (i = 0; i < GetNumBussesIn(); i++)
95 {
96 pCapabilities->dwBusInCaps[i] = ECHOCAPS_PEAK_METER |
97 ECHOCAPS_VU_METER;
98 if (i >= wFirstDigitalBusIn)
99 pCapabilities->dwBusInCaps[i] |= ECHOCAPS_DIGITAL;
100 }
101
102 //
103 // And the output busses
104 //
105 WORD wFirstDigitalBusOut = GetFirstDigitalBusOut();
106 for (i = 0; i < GetNumBussesOut(); i++)
107 {
108 pCapabilities->dwBusOutCaps[i] = ECHOCAPS_PEAK_METER |
109 ECHOCAPS_VU_METER |
110 ECHOCAPS_GAIN |
111 ECHOCAPS_MUTE;
112 if (i >= wFirstDigitalBusOut)
113 pCapabilities->dwBusOutCaps[i] |= ECHOCAPS_DIGITAL;
114 }
115
116 //
117 // Digital modes & vmixer flag
118 //
119 pCapabilities->dwDigitalModes = GetDspCommObject()->GetDigitalModes();
120 pCapabilities->fHasVmixer = GetDspCommObject()->HasVmixer();
121
122 //
123 // If this is not a vmixer card, output pipes are hard-wired to output busses.
124 // Mark those pipes that are hard-wired to digital busses as digital pipes
125 //
126 if (GetDspCommObject()->HasVmixer())
127 {
128 pCapabilities->wFirstDigitalPipeOut = pCapabilities->wNumPipesOut;
129 }
130 else
131 {
132 pCapabilities->wFirstDigitalPipeOut = pCapabilities->wFirstDigitalBusOut;
133
134
135 for ( i = pCapabilities->wFirstDigitalPipeOut;
136 i < GetNumPipesOut();
137 i++)
138 {
139 pCapabilities->dwPipeOutCaps[i] |= ECHOCAPS_DIGITAL;
140 }
141
142 }
143
144 //
145 // Input pipes are the same, vmixer or no vmixer
146 //
147 pCapabilities->wFirstDigitalPipeIn = pCapabilities->wFirstDigitalBusIn;
148
149 for ( i = pCapabilities->wFirstDigitalPipeIn;
150 i < GetNumPipesIn();
151 i++)
152 {
153 pCapabilities->dwPipeInCaps[i] |= ECHOCAPS_DIGITAL;
154 }
155 return ECHOSTATUS_OK;
156
157 } // ECHOSTATUS CEchoGals::GetBaseCapabilities
158
159
160 //===========================================================================
161 //
162 // MakePipeIndex is a utility function; it takes a pipe number and an
163 // input or output flag and returns the pipe index. Refer to
164 // EchoGalsXface.h for more information.
165 //
166 //===========================================================================
167
MakePipeIndex(WORD wPipe,BOOL fInput)168 WORD CEchoGals::MakePipeIndex(WORD wPipe,BOOL fInput)
169 {
170 if (fInput)
171 return wPipe + GetNumPipesOut();
172
173 return wPipe;
174
175 } // MakePipeIndex
176
177
178 //===========================================================================
179 //
180 // Get the card name as an ASCII zero-terminated string
181 //
182 //===========================================================================
183
GetDeviceName()184 CONST PCHAR CEchoGals::GetDeviceName()
185 {
186 return m_szCardInstallName;
187 }
188
189
190 //===========================================================================
191 //
192 // Get numbers of pipes and busses
193 //
194 //===========================================================================
195
GetNumPipesOut()196 WORD CEchoGals::GetNumPipesOut()
197 {
198 if (NULL == GetDspCommObject())
199 return 0;
200
201 return GetDspCommObject()->GetNumPipesOut();
202 }
203
GetNumPipesIn()204 WORD CEchoGals::GetNumPipesIn()
205 {
206 if (NULL == GetDspCommObject())
207 return 0;
208
209 return GetDspCommObject()->GetNumPipesIn();
210 }
211
GetNumBussesOut()212 WORD CEchoGals::GetNumBussesOut()
213 {
214 if (NULL == GetDspCommObject())
215 return 0;
216
217 return GetDspCommObject()->GetNumBussesOut();
218 }
219
GetNumBussesIn()220 WORD CEchoGals::GetNumBussesIn()
221 {
222 if (NULL == GetDspCommObject())
223 return 0;
224
225 return GetDspCommObject()->GetNumBussesIn();
226 }
227
GetNumBusses()228 WORD CEchoGals::GetNumBusses()
229 {
230 if (NULL == GetDspCommObject())
231 return 0;
232
233 return GetDspCommObject()->GetNumBusses();
234 }
235
GetNumPipes()236 WORD CEchoGals::GetNumPipes()
237 {
238 if (NULL == GetDspCommObject())
239 return 0;
240
241 return GetDspCommObject()->GetNumPipes();
242 }
243
GetFirstDigitalBusOut()244 WORD CEchoGals::GetFirstDigitalBusOut()
245 {
246 if (NULL == GetDspCommObject())
247 return 0;
248
249 return GetDspCommObject()->GetFirstDigitalBusOut();
250 }
251
GetFirstDigitalBusIn()252 WORD CEchoGals::GetFirstDigitalBusIn()
253 {
254 if (NULL == GetDspCommObject())
255 return 0;
256
257 return GetDspCommObject()->GetFirstDigitalBusIn();
258 }
259
HasVmixer()260 BOOL CEchoGals::HasVmixer()
261 {
262 if (NULL == GetDspCommObject())
263 return 0;
264
265 return GetDspCommObject()->HasVmixer();
266 }
267
268
269 //===========================================================================
270 //
271 // Get access to the DSP comm object
272 //
273 //===========================================================================
274
GetDspCommObject()275 PCDspCommObject CEchoGals::GetDspCommObject()
276 {
277 return m_pDspCommObject;
278 }
279
280