xref: /haiku/src/add-ons/kernel/drivers/audio/echo/generic/CEchoGals.h (revision dd2a1e350b303b855a50fd64e6cb55618be1ae6a)
1 // ****************************************************************************
2 //
3 //		CEchoGals.H
4 //
5 //		Include file for the CEchoGals generic driver class.
6 //		Set editor tabs to 3 for your viewing pleasure.
7 //
8 // 		CEchoGals is the big daddy class of the generic code.  It is the upper
9 //		edge of the generic code - that is, it is the interface between the
10 // 		operating system-specific code and the generic driver.
11 //
12 //		There are a number of terms in this file that won't make any sense unless
13 // 		you go read EchoGalsXface.h first.
14 //
15 // ----------------------------------------------------------------------------
16 //
17 // This file is part of Echo Digital Audio's generic driver library.
18 // Copyright Echo Digital Audio Corporation (c) 1998 - 2005
19 // All rights reserved
20 // www.echoaudio.com
21 //
22 // This library is free software; you can redistribute it and/or
23 // modify it under the terms of the GNU Lesser General Public
24 // License as published by the Free Software Foundation; either
25 // version 2.1 of the License, or (at your option) any later version.
26 //
27 // This library is distributed in the hope that it will be useful,
28 // but WITHOUT ANY WARRANTY; without even the implied warranty of
29 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
30 // Lesser General Public License for more details.
31 //
32 // You should have received a copy of the GNU Lesser General Public
33 // License along with this library; if not, write to the Free Software
34 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
35 //
36 // ****************************************************************************
37 
38 //	Prevent problems with multiple includes
39 #ifndef _ECHOGALSOBJECT_
40 #define _ECHOGALSOBJECT_
41 
42 #ifdef _DEBUG
43 #ifdef ECHO_WDM
44 #pragma optimize("",off)
45 #endif
46 #endif
47 
48 
49 //
50 //	Each project creates this file to support the OS it is targeted for
51 //
52 #include "OsSupport.h"
53 
54 //
55 // Include the definitions for the card family
56 //
57 #include "family.h"
58 
59 
60 //
61 //	Interface definitions
62 //
63 #include "EchoGalsXface.h"
64 #include "MixerXface.h"
65 #include "CLineLevel.h"
66 #include "CPipeOutCtrl.h"
67 #include "CMonitorCtrl.h"
68 #include "CEchoGals_mixer.h"
69 #include "CChannelMask.h"
70 #include "CDspCommObject.h"
71 #include "CMidiInQ.h"
72 
73 //
74 //	Pipe states
75 //
76 #define	PIPE_STATE_RESET			0	// Pipe has been reset
77 #define	PIPE_STATE_STOPPED		1	// Pipe has been stopped
78 #define	PIPE_STATE_STARTED		2	// Pipe has been started
79 #define	PIPE_STATE_PENDING		3	// Pipe has pending start
80 
81 
82 
83 //
84 // Prototypes to make the Mac compiler happy
85 //
86 ECHOSTATUS CheckSetting(INT32 iValue,INT32 iMin,INT32 iMax);
87 INT32 PanToDb( INT32 iPan );
88 
89 
90 //
91 //	Base class used for interfacing with the audio card.
92 //
93 class CEchoGals
94 {
95 public:
96 
97 	//***********************************************************************
98 	//
99 	//	Initialization (public)
100 	//
101 	//***********************************************************************
102 
103 	//
104 	//	Overload new & delete so memory for this object is allocated
105 	//	from non-paged memory.
106 	//
107 	PVOID operator new( size_t Size );
108 	VOID  operator delete( PVOID pVoid );
109 
110 	//
111 	// Constructor and destructor
112 	//
113 	// Note that you must call AssignResources and InitHw
114 	// before you can do anything useful.
115 	//
116 	CEchoGals( PCOsSupport pOsSupport );
117 	virtual ~CEchoGals();
118 
119 	//
120 	//	Validate and save resources assigned by PNP.
121 	//	Each card uses one IRQ vector and accesses the DSP through
122 	//	shared memory
123 	//
124 	virtual ECHOSTATUS AssignResources
125 	(
126 		PVOID		pvSharedMemory,		// Virtual pointer to DSP registers
127 		const char*		pszCardName				// Caller gets from registry
128     );
129 
130 	//
131 	//	Initialize the hardware using data from AssignResources,
132 	//	create the CDspCommObject class, return status.
133 	//
134 	virtual ECHOSTATUS InitHw();
135 
136 
137 
138 	//***********************************************************************
139 	//
140 	//	PCI card information (public)
141 	//
142 	//***********************************************************************
143 
144 	//
145 	//	Return the capabilities of this card; card type, card name,
146 	//	# analog inputs, # analog outputs, # digital channels,
147 	//	# MIDI ports and supported clocks.
148 	//	See ECHOGALS_CAPS definition above.
149 	//
150 	virtual ECHOSTATUS GetCapabilities
151 	(
152 		PECHOGALS_CAPS	pCapabilities
153 	)
154 	{ return GetBaseCapabilities(pCapabilities); }
155 
156 
157 	CONST PCHAR GetDeviceName();
158 
159 	WORD MakePipeIndex(WORD wPipe,BOOL fInput);
160 
161 
162 
163 	//***********************************************************************
164 	//
165 	//	Mixer interface (public) - used to set volume levels and other
166 	// miscellaneous stuff.
167 	//
168 	//***********************************************************************
169 
170 	//
171 	// Open and close the mixer
172 	//
173 	ECHOSTATUS OpenMixer(NUINT &Cookie);
174 	ECHOSTATUS CloseMixer(NUINT Cookie);
175 
176 	//
177 	// Is the mixer open by one or more clients?
178 	//
179 	BOOL IsMixerOpen();
180 
181 	//
182 	//	Process mixer functions
183 	//
184 	virtual ECHOSTATUS ProcessMixerFunction
185 	(
186 		PMIXER_FUNCTION	pMixerFunction,	// Request from mixer
187 		INT32 &				iRtnDataSz			// # bytes returned (if any)
188 	);
189 
190 	//
191 	//	Process multiple mixer functions
192 	//
193 	virtual ECHOSTATUS ProcessMixerMultiFunction
194 	(
195 		PMIXER_MULTI_FUNCTION	pMixerFunctions,	// Request from mixer
196 		INT32 &						iRtnDataSz			// # bytes returned (if any)
197 	);
198 
199 	//
200 	// Get all the control notifies since last time this was called
201 	// for this client.  dwNumNotifies is the size of the array passed in
202 	// pNotifies; dwNumReturned specifies how many were actually copied in.
203 	//
204 	// Takes the cookie as a separate parameter; the one in MIXER_MULTI_NOTIFY
205 	// is ignored since it's not 64 bits
206 	//
207 	ECHOSTATUS GetControlChanges
208 	(
209 		PMIXER_MULTI_NOTIFY	pNotifies,
210 		NUINT MixerCookie
211 	);
212 
213 	//
214 	// Get a bunch of useful polled stuff- audio meters,
215 	// clock detect bits, and pending notifies
216 	//
217 	ECHOSTATUS GetPolledStuff
218 	(
219 		ECHO_POLLED_STUFF *pPolledStuff,
220 		NUINT MixerCookie
221 	);
222 
223 	//
224 	// Get the digital mode
225 	//
226 	virtual BYTE GetDigitalMode()
227 		{ return( ( NULL == GetDspCommObject() )
228 						? (BYTE) DIGITAL_MODE_SPDIF_RCA
229 						: GetDspCommObject()->GetDigitalMode() ); }
230 
231 	//
232 	//	Get, set and clear CEchoGals flags.
233 	//	See ECHOGALS_FLAG_??? definitions in EchoGalsXface.h
234 	//
235 	virtual WORD GetFlags()
236 	{
237 		return m_wFlags;
238 	}
239 	virtual ECHOSTATUS SetFlags(WORD wFlags);
240 	virtual ECHOSTATUS ClearFlags(WORD	wFlags);
241 
242 	//
243 	// Get/set the locked sample rate - if the sample rate is locked,
244 	// the card will be fixed at the locked rate.  Only applies if
245 	// the card is set to internal clock.
246 	//
247 	virtual ECHOSTATUS GetAudioLockedSampleRate
248 	(
249 		DWORD		&dwSampleRate
250 	);
251 
252 	virtual ECHOSTATUS SetAudioLockedSampleRate
253 	(
254 		DWORD		dwSampleRate
255 	);
256 
257 	//
258 	//	Enable/disable audio metering.
259 	//
260 	ECHOSTATUS GetMetersOn( BOOL & bOn )
261 		{ return( ( NULL == GetDspCommObject() )
262 						? ECHOSTATUS_DSP_DEAD
263 						: GetDspCommObject()->GetMetersOn( bOn ) ); }
264 
265 	ECHOSTATUS SetMetersOn( BOOL bOn )
266 		{ return( ( NULL == GetDspCommObject() )
267 						? ECHOSTATUS_DSP_DEAD
268 						: GetDspCommObject()->SetMetersOn( bOn ) ); }
269 	//
270 	//	Get/Set Professional or consumer S/PDIF status
271 	//
272 	virtual BOOL IsProfessionalSpdif()
273 		{ return( ( NULL == GetDspCommObject() )
274 						? FALSE
275 						: GetDspCommObject()->IsProfessionalSpdif() ); }
276 	virtual void SetProfessionalSpdif( BOOL bNewStatus );
277 
278 	//
279 	// Get/Set S/PDIF out non-audio status bit
280 	//
281 	virtual BOOL IsSpdifOutNonAudio()
282 		{ return( ( NULL == GetDspCommObject() )
283 						? FALSE
284 						: GetDspCommObject()->IsSpdifOutNonAudio() ); }
285 	virtual void SetSpdifOutNonAudio(BOOL bNonAudio )
286 	{
287 		if (GetDspCommObject())
288 			GetDspCommObject()->SetSpdifOutNonAudio(bNonAudio);
289 	}
290 
291 
292 
293 	//
294 	//	Set digital mode
295 	//
296 	virtual ECHOSTATUS SetDigitalMode( BYTE byDigitalMode );
297 
298 	//
299 	// Get and set input and output clocks
300 	//
301 	virtual ECHOSTATUS SetInputClock(WORD	wClock);
302 	virtual ECHOSTATUS GetInputClock(WORD	&wClock);
303 	virtual ECHOSTATUS SetOutputClock(WORD wClock);
304 	virtual ECHOSTATUS GetOutputClock(WORD &wClock);
305 
306 	//
307 	//	Audio Line Levels Functions:
308 	//	Nominal level is either -10dBV or +4dBu.
309 	//	Output level data is scaled by 256 and ranges from -128dB to
310 	//	+6dB (0xffff8000 to 0x600).
311 	//	Input level data is scaled by 256 and ranges from -25dB to +25dB
312 	//	( 0xffffe700 to 0x1900 ).
313 	//
314 	virtual ECHOSTATUS GetAudioLineLevel
315 	(
316 		PMIXER_FUNCTION	pMF
317 	);
318 
319 	virtual ECHOSTATUS SetAudioLineLevel
320 	(
321 		PMIXER_FUNCTION	pMF
322 	);
323 
324 	virtual ECHOSTATUS GetAudioNominal
325 	(
326 		PMIXER_FUNCTION	pMF
327 	);
328 
329 	virtual ECHOSTATUS SetAudioNominal
330 	(
331 		PMIXER_FUNCTION	pMF
332 	);
333 
334 	//
335 	//	Audio mute controls
336 	//
337 	virtual ECHOSTATUS SetAudioMute
338 	(
339 		PMIXER_FUNCTION	pMF
340 	);
341 
342 	virtual ECHOSTATUS GetAudioMute
343 	(
344 		PMIXER_FUNCTION	pMF
345 	);
346 
347 	//
348 	//	Audio Monitors Functions:
349 	//
350 	virtual ECHOSTATUS SetAudioMonitor
351 	(
352 		WORD	wBusIn,
353 		WORD	wBusOut,
354 		INT32	iGain						// New gain
355 	);
356 
357 	virtual ECHOSTATUS GetAudioMonitor
358 	(
359 		WORD	wBusIn,
360 		WORD	wBusOut,
361 		INT32 &	iGain						// Returns current gain
362 	);
363 
364 	virtual ECHOSTATUS SetAudioMonitorPan
365 	(
366 		WORD	wBusIn,
367 		WORD	wBusOut,
368 		INT32	iPan						// New pan (0 - MAX_MIXER_PAN)
369 	);
370 
371 	virtual ECHOSTATUS GetAudioMonitorPan
372 	(
373 		WORD	wBusIn,
374 		WORD	wBusOut,
375 		INT32 &	iPan						// Returns current pan (0 - MAX_MIXER_PAN)
376 	);
377 
378 	virtual ECHOSTATUS SetAudioMonitorMute
379 	(
380 		WORD	wBusIn,
381 		WORD	wBusOut,
382 		BOOL	bMute						// New state
383 	);
384 
385 	virtual ECHOSTATUS GetAudioMonitorMute
386 	(
387 		WORD	wBusIn,
388 		WORD	wBusOut,
389 		BOOL &bMute						// Returns current state
390 	);
391 
392 
393 	//
394 	// Get and set audio pan
395 	//
396 	virtual ECHOSTATUS GetAudioPan(PMIXER_FUNCTION pMixerFunction);
397 	virtual ECHOSTATUS SetAudioPan(PMIXER_FUNCTION pMixerFunction);
398 
399 	//
400 	// Get a bitmask of all the clocks the hardware is currently detecting
401 	//
402 	virtual ECHOSTATUS GetInputClockDetect(DWORD &dwClockDetectBits);
403 
404 
405 #ifdef PHANTOM_POWER_CONTROL
406 	//
407 	// Phantom power on/off for Gina3G
408 	//
409 	virtual void GetPhantomPower(BOOL *pfPhantom) { *pfPhantom = 0; }
410 	virtual void SetPhantomPower(BOOL fPhantom) {}
411 #endif
412 
413 
414 	//***********************************************************************
415 	//
416 	//	Audio transport (public) - playing and recording audio
417 	//
418 	//***********************************************************************
419 
420 	//
421 	// Set the scatter-gather list for a pipe
422 	//
423 	ECHOSTATUS SetDaffyDuck( WORD wPipeIndex, CDaffyDuck *pDuck);
424 
425 	//
426 	//	Reserve a pipe.  Please refer to the definition of
427 	// ECHOGALS_OPENAUDIOPARAMETERS.
428 	//
429 	// If the fCheckHardware flag is true, then the open will fail
430 	// if the DSP and ASIC firmware have not been loaded (usually means
431 	// your external box is turned off).
432 	//
433 	// If you want to manage your own CDaffyDuck object for this pipe,
434 	// then pass a pointer to a CDaffyDuck object.  If you pass NULL,
435 	// one will be created for you.
436 	//
437 	virtual ECHOSTATUS OpenAudio
438 	(
439 		PECHOGALS_OPENAUDIOPARAMETERS	pOpenParameters,	// Info on channel
440 		PWORD									pwPipeIndex,		// Ptr to pipe index
441 		BOOL									fCheckHardware = TRUE,
442 		CDaffyDuck							*pDuck = NULL
443 	);
444 
445 	//
446 	//	Close a pipe
447 	//
448 	virtual ECHOSTATUS CloseAudio
449 	(
450 		PECHOGALS_CLOSEAUDIOPARAMETERS	pCloseParameters,
451 		BOOL										fFreeDuck = TRUE
452 	);
453 
454 	//
455 	//	Find out if the audio format is supported.
456 	//
457 	virtual ECHOSTATUS QueryAudioFormat
458 	(
459 		WORD							wPipeIndex,
460 		PECHOGALS_AUDIOFORMAT	pAudioFormat
461 	);
462 
463 	//
464 	// Set the audio format for a single pipe
465 	virtual ECHOSTATUS SetAudioFormat
466 	(
467 		WORD							wPipeIndex,
468 		PECHOGALS_AUDIOFORMAT	pAudioFormat
469 	);
470 
471 	//
472 	// Set the audio format for a bunch of pipes at once
473 	//
474 	virtual ECHOSTATUS SetAudioFormat
475 	(
476 		PCChannelMask				pChannelMask,
477 		PECHOGALS_AUDIOFORMAT	pAudioFormat
478 	);
479 
480 	//
481 	//	Get the current audio format for a pipe
482 	//
483 	virtual ECHOSTATUS GetAudioFormat
484 	(
485 		WORD							wPipeIndex,
486 		PECHOGALS_AUDIOFORMAT	pAudioFormat
487 	);
488 
489 	//
490 	// Call this to find out if this card can handle a given sample rate
491 	//
492 	virtual ECHOSTATUS QueryAudioSampleRate
493 	(
494 		DWORD		dwSampleRate
495 	) = 0;
496 
497 	virtual void QuerySampleRateRange(DWORD &dwMinRate,DWORD &dwMaxRate) = 0;
498 
499 	//
500 	// I'm not going to tell you what the next two functions do; you'll just
501 	// have to guess.
502 	//
503 	virtual ECHOSTATUS SetAudioSampleRate
504 	(
505 		DWORD		dwSampleRate
506 	);
507 
508 	virtual ECHOSTATUS GetAudioSampleRate
509 	(
510 		PDWORD	pdwSampleRate
511 	);
512 
513 
514 	//
515 	//	Start transport for several pipes at once
516 	//
517 	virtual ECHOSTATUS Start
518 	(
519 		PCChannelMask	pChannelMask
520 	);
521 
522 	//
523 	//	Start transport for a single audio pipe
524 	//
525 	virtual ECHOSTATUS Start
526 	(
527 		WORD		wPipeIndex
528 	);
529 
530 	//
531 	//	Stop transport for several pipes at once
532 	//
533 	virtual ECHOSTATUS Stop
534 	(
535 		PCChannelMask	pChannelMask
536 	);
537 
538 	//
539 	//	Stop transport for a single pipe
540 	//
541 	virtual ECHOSTATUS Stop
542 	(
543 		WORD		wPipeIndex
544 	);
545 
546 	//
547 	//	Stop and reset selected output and/or input audio pipes
548 	//
549 	virtual ECHOSTATUS Reset
550 	(
551 		PCChannelMask	pChannelMask
552 	);
553 
554 	//
555 	//	Stop and reset single audio pipe
556 	//
557 	virtual ECHOSTATUS Reset
558 	(
559 		WORD		wPipeIndex
560 	);
561 
562 	//
563 	// Get mask with active pipes - that is, those pipes that
564 	// are currently moving data.
565 	//
566 	virtual ECHOSTATUS GetActivePipes
567 	(
568 		PCChannelMask	pChannelMask
569 	);
570 
571 	//
572 	// Get mask with open pipes
573 	//
574 	virtual ECHOSTATUS GetOpenPipes
575 	(
576 		PCChannelMask	pChannelMask
577 	);
578 
579 	//
580 	//	Get a pointer that can be dereferenced to read
581 	// the DSP's DMA counter for this pipe; see CEchoGals_transport.cpp
582 	// for more info.
583 	//
584 	virtual ECHOSTATUS GetAudioPositionPtr
585 	(
586 		WORD		wPipeIndex,
587 		PDWORD 	(&pdwPosition)
588 	);
589 
590 	//
591 	// Get the daffy duck pointer for a pipe
592 	//
593 	CDaffyDuck *GetDaffyDuck(WORD wPipeIndex);
594 
595 	//
596 	// Reset the 64 bit DMA position for this pipe
597 	//
598 	void ResetDmaPos( WORD wPipe );
599 
600 	//
601 	// Update the 64 bit DMA position for this pipe
602 	//
603 	void UpdateDmaPos( WORD wPipeIndex );
604 
605 	//
606 	//	Get the 64 bit DMA position for this pipe
607 	//
608 	void GetDmaPos( WORD wPipeIndex, PULONGLONG pPos )
609 	{
610 		UpdateDmaPos( wPipeIndex );
611 		*pPos = m_ullDmaPos[ wPipeIndex ];
612 	}
613 
614 	//
615 	// Get the state of a given pipe
616 	//
617 	DWORD GetPipeState( WORD wPipeIndex )
618 	{
619 		return (DWORD) m_byPipeState[ wPipeIndex ];
620 	}
621 
622 	//
623 	//	Verify a pipe is open and ready for business!
624 	//
625 	ECHOSTATUS VerifyAudioOpen
626 	(
627 		WORD		wPipeIndex
628 	);
629 
630 	//***********************************************************************
631 	//
632 	//	MIDI (public)
633 	//
634 	//***********************************************************************
635 
636 #ifdef MIDI_SUPPORT
637 
638 	// The context struct should be set to zero before calling OpenMidiInput
639 	virtual ECHOSTATUS OpenMidiInput(ECHOGALS_MIDI_IN_CONTEXT *pContext);
640 	virtual ECHOSTATUS CloseMidiInput(ECHOGALS_MIDI_IN_CONTEXT *pContext);
641 
642 	//
643 	// Reset the MIDI input buffer; MIDI input remains enabled and open
644 	//
645 	virtual ECHOSTATUS ResetMidiInput(ECHOGALS_MIDI_IN_CONTEXT *pContext);
646 
647 	virtual ECHOSTATUS WriteMidi
648 	(
649 		DWORD		dwExpectedCt,
650 		PBYTE		pBuffer,
651 		PDWORD	pdwActualCt
652 	);
653 
654 	virtual ECHOSTATUS ReadMidiByte(	ECHOGALS_MIDI_IN_CONTEXT	*pContext,
655 												DWORD								&dwMidiData,
656 												LONGLONG							&llTimestamp);
657 
658 	virtual void ServiceMtcSync()
659 	{
660 	}
661 
662 #endif // MIDI_SUPPORT
663 
664 
665 
666 	//***********************************************************************
667 	//
668 	//	Interrupt handler methods (public)
669 	//
670 	//***********************************************************************
671 
672 	//
673 	//	This is called from within an interrupt handler.  It starts interrupt
674 	//	handling.  Returns error status if this interrupt is not ours.
675 	// Returns ECHOSTATUS_OK if it is.
676 	//
677 	//	OS dependent code handles routing to this point.
678 	//
679 	virtual ECHOSTATUS ServiceIrq(BOOL &fMidiReceived);
680 
681 
682 	//***********************************************************************
683 	//
684 	//	Power management (public)
685 	//
686 	// Please do not do silly things like try and set a volume level or
687 	// play audio after calling GoComatose; be sure and call WakeUp first!
688 	//
689 	//***********************************************************************
690 
691 	//
692 	// Tell the hardware to go to sleep
693 	//
694 	virtual ECHOSTATUS GoComatose();
695 
696 	//
697 	// Tell the hardware to wake up
698 	//
699 	virtual ECHOSTATUS WakeUp();
700 
701 
702 
703 protected:
704 
705 	//***********************************************************************
706 	//
707 	//	Member variables (protected)
708 	//
709 	//***********************************************************************
710 
711 	PCOsSupport		m_pOsSupport;		// Ptr to OS Support methods & data
712 	WORD				m_wFlags;			// See ECHOGALS_FLAG_??? flags defined
713 												// in EchoGalsXface.h
714 	PVOID				m_pvSharedMemory;	// Shared memory addr assigned by PNP
715 	CHAR				m_szCardInstallName[ ECHO_MAXNAMELEN ];
716 												// Same as card except when multiple
717 												// boards of the same type installed.
718 												// Then becomes "Layla1", "Layla2" etc.
719 	CChannelMask	m_cmAudioOpen;		// Audio channels open mask
720 	CChannelMask	m_cmAudioCyclic;	// Audio use cyclic buffers mask
721 
722 	DWORD				m_dwSampleRate;	// Card sample rate in Hz
723 	DWORD				m_dwLockedSampleRate;
724 												// Card sample rate when locked
725 	ECHOGALS_AUDIO_PIPE
726 						m_Pipes[ ECHO_MAXAUDIOPIPES ];
727 												// Keep mapping info on open pipes
728 	BYTE				m_byPipeState[ ECHO_MAXAUDIOPIPES ];
729 												// Track state of all pipes
730 	PVOID				m_ProcessId[ ECHO_MAXAUDIOPIPES ];
731 												// Caller process ID for implementing
732 												// synchronous wave start
733 	DWORD				m_dwMeterOnCount;	// Track need for meter updates by DSP
734 	PCDspCommObject
735 						m_pDspCommObject;	// Ptr to DSP communication object
736 
737 	DWORD				m_dwMidiInOpen;	// Midi in channels open mask
738 	DWORD				m_dwMidiOutOpen; 	// Midi out channels open mask
739 
740 	BOOL				m_fMixerDisabled;
741 
742 	WORD				m_wAnalogOutputLatency;	// Latency in samples
743 	WORD				m_wAnalogInputLatency;
744 	WORD				m_wDigitalOutputLatency;
745 	WORD				m_wDigitalInputLatency;
746 
747 
748 
749 	//
750 	//	Monitor state info
751 	//
752 	CMonitorCtrl		m_MonitorCtrl;
753 
754 	//
755 	// Output pipe control
756 	//
757 	CPipeOutCtrl		m_PipeOutCtrl;
758 
759 	//
760 	// Input bus mute and gain settings
761 	//
762 	CBusInLineLevel	m_BusInLineLevels[ ECHO_MAXAUDIOINPUTS ];
763 
764 	//
765 	// Output bus mute and gain settings
766 	//
767 	CBusOutLineLevel	m_BusOutLineLevels[ ECHO_MAXAUDIOOUTPUTS ];
768 
769 	//
770 	//
771 	// Linked list of mixer clients
772 	//
773 	ECHO_MIXER_CLIENT	*m_pMixerClients;
774 
775 
776 	//
777 	// DMA position, in bytes, for each pipe
778 	//
779 	ULONGLONG		m_ullDmaPos[ ECHO_MAXAUDIOPIPES ];
780 	DWORD				m_dwLastDspPos[ ECHO_MAXAUDIOPIPES ];
781 
782 	//
783 	//	Pointers to daffy ducks for each pipe
784 	//
785 	PCDaffyDuck		m_DaffyDucks[ ECHO_MAXAUDIOPIPES ];
786 
787 
788 #ifdef MIDI_SUPPORT
789 	//
790 	// MIDI input buffer
791 	//
792 	CMidiInQ	m_MidiIn;
793 #endif
794 
795 
796 	//
797 	//	Macintosh compiler likes "class" after friend, PC doesn't care
798 	//
799 	friend class CLineLevel;
800 	friend class CBusOutLineLevel;
801 	friend class CBusInLineLevel;
802 	friend class CPipeOutCtrl;
803 	friend class CMonitorCtrl;
804 	friend class CMidiInQ;
805 	friend class CMtcSync;
806 
807 
808 	//***********************************************************************
809 	//
810 	//	Initialization (protected)
811 	//
812 	//***********************************************************************
813 
814 	//
815 	//	Init the line level classes.
816 	//	This MUST be called from within any derived classes as part of
817 	//	InitHw after the DSP is up and running!
818 	//
819 	virtual ECHOSTATUS InitLineLevels();
820 
821 
822 	//***********************************************************************
823 	//
824 	//	Information (protected)
825 	//
826 	//***********************************************************************
827 
828 	virtual ECHOSTATUS GetBaseCapabilities(PECHOGALS_CAPS pCapabilities);
829 
830 	WORD GetNumPipesOut();
831 	WORD GetNumPipesIn();
832 	WORD GetNumBussesOut();
833 	WORD GetNumBussesIn();
834 	WORD GetNumBusses();
835  	WORD GetNumPipes();
836 	WORD GetFirstDigitalBusOut();
837 	WORD GetFirstDigitalBusIn();
838 
839 	BOOL HasVmixer();
840 
841 	PCDspCommObject GetDspCommObject();
842 
843 
844 	//***********************************************************************
845 	//
846 	//	Audio transport (protected)
847 	//
848 	// Daffy ducks are objects that manage scatter-gather lists.
849 	//
850 	//***********************************************************************
851 
852 
853 
854 	//***********************************************************************
855 	//
856 	//	Mixer interface (protected)
857 	//
858 	//***********************************************************************
859 
860 	//
861 	// Match a mixer cookie to a mixer client
862 	//
863 	ECHO_MIXER_CLIENT *GetMixerClient(NUINT Cookie);
864 
865 	//
866 	// Adjust all the monitor levels for a particular output bus; this is
867 	// used to implement the master output level.
868 	//
869 	virtual ECHOSTATUS AdjustMonitorsForBusOut(WORD wBusOut);
870 
871 	//
872 	// Adjust all the output pipe levels for a particular output bus; this is
873 	// also used to implement the master output level.
874 	//
875 	virtual ECHOSTATUS AdjustPipesOutForBusOut(WORD wBusOut,INT32 iBusOutGain);
876 
877 	//
878 	// A mixer control has changed; store the notify
879 	//
880 	ECHOSTATUS MixerControlChanged
881 	(
882 		WORD	wType,								// One of the ECHO_CHANNEL_TYPES
883 		WORD  wParameter, 						// One of the MXN_* values
884 		WORD 	wCh1 = ECHO_CHANNEL_UNUSED,	// Depends on the wType value
885 		WORD  wCh2 = ECHO_CHANNEL_UNUSED		// Also depends on wType value
886 	);
887 
888 #ifdef DIGITAL_INPUT_AUTO_MUTE_SUPPORT
889 	//
890 	// Digital input auto-mute - Gina24, Layla24, and Mona only
891 	//
892 	virtual ECHOSTATUS GetDigitalInAutoMute(PMIXER_FUNCTION pMixerFunction);
893 	virtual ECHOSTATUS SetDigitalInAutoMute(PMIXER_FUNCTION pMixerFunction);
894 #endif
895 
896 	//
897 	// Get the audio latency for a single pipe
898 	//
899 	virtual void GetAudioLatency(ECHO_AUDIO_LATENCY *pLatency);
900 
901 };		// class CEchoGals
902 
903 typedef CEchoGals * PCEchoGals;
904 
905 #endif
906 
907 // *** CEchoGals.h ***
908