xref: /haiku/src/add-ons/kernel/drivers/audio/echo/generic/CEchoGals.h (revision 3e216965baa8d58a67bf7372e2bfa13d999f5a9d)
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 		PCHAR		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 	ECHOSTATUS GetControlChanges
205 	(
206 		PMIXER_MULTI_NOTIFY	pNotifies
207 	);
208 
209 	//
210 	// Get a bunch of useful polled stuff- audio meters,
211 	// clock detect bits, and pending notifies
212 	//
213 	ECHOSTATUS GetPolledStuff(ECHO_POLLED_STUFF *pPolledStuff);
214 
215 	//
216 	// Get the digital mode
217 	//
218 	virtual BYTE GetDigitalMode()
219 		{ return( ( NULL == GetDspCommObject() )
220 						? (BYTE) DIGITAL_MODE_SPDIF_RCA
221 						: GetDspCommObject()->GetDigitalMode() ); }
222 
223 	//
224 	//	Get, set and clear CEchoGals flags.
225 	//	See ECHOGALS_FLAG_??? definitions in EchoGalsXface.h
226 	//
227 	virtual WORD GetFlags()
228 	{
229 		return m_wFlags;
230 	}
231 	virtual ECHOSTATUS SetFlags(WORD wFlags);
232 	virtual ECHOSTATUS ClearFlags(WORD	wFlags);
233 
234 	//
235 	// Get/set the locked sample rate - if the sample rate is locked,
236 	// the card will be fixed at the locked rate.  Only applies if
237 	// the card is set to internal clock.
238 	//
239 	virtual ECHOSTATUS GetAudioLockedSampleRate
240 	(
241 		DWORD		&dwSampleRate
242 	);
243 
244 	virtual ECHOSTATUS SetAudioLockedSampleRate
245 	(
246 		DWORD		dwSampleRate
247 	);
248 
249 	//
250 	//	Enable/disable audio metering.
251 	//
252 	ECHOSTATUS GetMetersOn( BOOL & bOn )
253 		{ return( ( NULL == GetDspCommObject() )
254 						? ECHOSTATUS_DSP_DEAD
255 						: GetDspCommObject()->GetMetersOn( bOn ) ); }
256 
257 	ECHOSTATUS SetMetersOn( BOOL bOn )
258 		{ return( ( NULL == GetDspCommObject() )
259 						? ECHOSTATUS_DSP_DEAD
260 						: GetDspCommObject()->SetMetersOn( bOn ) ); }
261 	//
262 	//	Get/Set Professional or consumer S/PDIF status
263 	//
264 	virtual BOOL IsProfessionalSpdif()
265 		{ return( ( NULL == GetDspCommObject() )
266 						? FALSE
267 						: GetDspCommObject()->IsProfessionalSpdif() ); }
268 	virtual void SetProfessionalSpdif( BOOL bNewStatus );
269 
270 	//
271 	// Get/Set S/PDIF out non-audio status bit
272 	//
273 	virtual BOOL IsSpdifOutNonAudio()
274 		{ return( ( NULL == GetDspCommObject() )
275 						? FALSE
276 						: GetDspCommObject()->IsSpdifOutNonAudio() ); }
277 	virtual void SetSpdifOutNonAudio(BOOL bNonAudio )
278 	{
279 		if (GetDspCommObject())
280 			GetDspCommObject()->SetSpdifOutNonAudio(bNonAudio);
281 	}
282 
283 
284 
285 	//
286 	//	Set digital mode
287 	//
288 	virtual ECHOSTATUS SetDigitalMode( BYTE byDigitalMode );
289 
290 	//
291 	// Get and set input and output clocks
292 	//
293 	virtual ECHOSTATUS SetInputClock(WORD	wClock);
294 	virtual ECHOSTATUS GetInputClock(WORD	&wClock);
295 	virtual ECHOSTATUS SetOutputClock(WORD wClock);
296 	virtual ECHOSTATUS GetOutputClock(WORD &wClock);
297 
298 	//
299 	//	Audio Line Levels Functions:
300 	//	Nominal level is either -10dBV or +4dBu.
301 	//	Output level data is scaled by 256 and ranges from -128dB to
302 	//	+6dB (0xffff8000 to 0x600).
303 	//	Input level data is scaled by 256 and ranges from -25dB to +25dB
304 	//	( 0xffffe700 to 0x1900 ).
305 	//
306 	virtual ECHOSTATUS GetAudioLineLevel
307 	(
308 		PMIXER_FUNCTION	pMF
309 	);
310 
311 	virtual ECHOSTATUS SetAudioLineLevel
312 	(
313 		PMIXER_FUNCTION	pMF
314 	);
315 
316 	virtual ECHOSTATUS GetAudioNominal
317 	(
318 		PMIXER_FUNCTION	pMF
319 	);
320 
321 	virtual ECHOSTATUS SetAudioNominal
322 	(
323 		PMIXER_FUNCTION	pMF
324 	);
325 
326 	//
327 	//	Audio mute controls
328 	//
329 	virtual ECHOSTATUS SetAudioMute
330 	(
331 		PMIXER_FUNCTION	pMF
332 	);
333 
334 	virtual ECHOSTATUS GetAudioMute
335 	(
336 		PMIXER_FUNCTION	pMF
337 	);
338 
339 	//
340 	//	Audio Monitors Functions:
341 	//
342 	virtual ECHOSTATUS SetAudioMonitor
343 	(
344 		WORD	wBusIn,
345 		WORD	wBusOut,
346 		INT32	iGain						// New gain
347 	);
348 
349 	virtual ECHOSTATUS GetAudioMonitor
350 	(
351 		WORD	wBusIn,
352 		WORD	wBusOut,
353 		INT32 &	iGain						// Returns current gain
354 	);
355 
356 	virtual ECHOSTATUS SetAudioMonitorPan
357 	(
358 		WORD	wBusIn,
359 		WORD	wBusOut,
360 		INT32	iPan						// New pan (0 - MAX_MIXER_PAN)
361 	);
362 
363 	virtual ECHOSTATUS GetAudioMonitorPan
364 	(
365 		WORD	wBusIn,
366 		WORD	wBusOut,
367 		INT32 &	iPan						// Returns current pan (0 - MAX_MIXER_PAN)
368 	);
369 
370 	virtual ECHOSTATUS SetAudioMonitorMute
371 	(
372 		WORD	wBusIn,
373 		WORD	wBusOut,
374 		BOOL	bMute						// New state
375 	);
376 
377 	virtual ECHOSTATUS GetAudioMonitorMute
378 	(
379 		WORD	wBusIn,
380 		WORD	wBusOut,
381 		BOOL &bMute						// Returns current state
382 	);
383 
384 
385 	//
386 	// Get and set audio pan
387 	//
388 	virtual ECHOSTATUS GetAudioPan(PMIXER_FUNCTION pMixerFunction);
389 	virtual ECHOSTATUS SetAudioPan(PMIXER_FUNCTION pMixerFunction);
390 
391 	//
392 	// Get a bitmask of all the clocks the hardware is currently detecting
393 	//
394 	virtual ECHOSTATUS GetInputClockDetect(DWORD &dwClockDetectBits);
395 
396 
397 #ifdef PHANTOM_POWER_CONTROL
398 	//
399 	// Phantom power on/off for Gina3G
400 	//
401 	virtual void GetPhantomPower(BOOL *pfPhantom) { *pfPhantom = 0; }
402 	virtual void SetPhantomPower(BOOL fPhantom) {}
403 #endif
404 
405 
406 	//***********************************************************************
407 	//
408 	//	Audio transport (public) - playing and recording audio
409 	//
410 	//***********************************************************************
411 
412 	//
413 	// Set the scatter-gather list for a pipe
414 	//
415 	ECHOSTATUS SetDaffyDuck( WORD wPipeIndex, CDaffyDuck *pDuck);
416 
417 	//
418 	//	Reserve a pipe.  Please refer to the definition of
419 	// ECHOGALS_OPENAUDIOPARAMETERS.
420 	//
421 	// If the fCheckHardware flag is true, then the open will fail
422 	// if the DSP and ASIC firmware have not been loaded (usually means
423 	// your external box is turned off).
424 	//
425 	// If you want to manage your own CDaffyDuck object for this pipe,
426 	// then pass a pointer to a CDaffyDuck object.  If you pass NULL,
427 	// one will be created for you.
428 	//
429 	virtual ECHOSTATUS OpenAudio
430 	(
431 		PECHOGALS_OPENAUDIOPARAMETERS	pOpenParameters,	// Info on channel
432 		PWORD									pwPipeIndex,		// Ptr to pipe index
433 		BOOL									fCheckHardware = TRUE,
434 		CDaffyDuck							*pDuck = NULL
435 	);
436 
437 	//
438 	//	Close a pipe
439 	//
440 	virtual ECHOSTATUS CloseAudio
441 	(
442 		PECHOGALS_CLOSEAUDIOPARAMETERS	pCloseParameters,
443 		BOOL										fFreeDuck = TRUE
444 	);
445 
446 	//
447 	//	Find out if the audio format is supported.
448 	//
449 	virtual ECHOSTATUS QueryAudioFormat
450 	(
451 		WORD							wPipeIndex,
452 		PECHOGALS_AUDIOFORMAT	pAudioFormat
453 	);
454 
455 	//
456 	// Set the audio format for a single pipe
457 	virtual ECHOSTATUS SetAudioFormat
458 	(
459 		WORD							wPipeIndex,
460 		PECHOGALS_AUDIOFORMAT	pAudioFormat
461 	);
462 
463 	//
464 	// Set the audio format for a bunch of pipes at once
465 	//
466 	virtual ECHOSTATUS SetAudioFormat
467 	(
468 		PCChannelMask				pChannelMask,
469 		PECHOGALS_AUDIOFORMAT	pAudioFormat
470 	);
471 
472 	//
473 	//	Get the current audio format for a pipe
474 	//
475 	virtual ECHOSTATUS GetAudioFormat
476 	(
477 		WORD							wPipeIndex,
478 		PECHOGALS_AUDIOFORMAT	pAudioFormat
479 	);
480 
481 	//
482 	// Call this to find out if this card can handle a given sample rate
483 	//
484 	virtual ECHOSTATUS QueryAudioSampleRate
485 	(
486 		DWORD		dwSampleRate
487 	)
488 	{ return( ECHOSTATUS_NOT_SUPPORTED ); }
489 
490 
491 	//
492 	// I'm not going to tell you what the next two functions do; you'll just
493 	// have to guess.
494 	//
495 	virtual ECHOSTATUS SetAudioSampleRate
496 	(
497 		DWORD		dwSampleRate
498 	);
499 
500 	virtual ECHOSTATUS GetAudioSampleRate
501 	(
502 		PDWORD	pdwSampleRate
503 	);
504 
505 
506 	//
507 	//	Start transport for several pipes at once
508 	//
509 	virtual ECHOSTATUS Start
510 	(
511 		PCChannelMask	pChannelMask
512 	);
513 
514 	//
515 	//	Start transport for a single audio pipe
516 	//
517 	virtual ECHOSTATUS Start
518 	(
519 		WORD		wPipeIndex
520 	);
521 
522 	//
523 	//	Stop transport for several pipes at once
524 	//
525 	virtual ECHOSTATUS Stop
526 	(
527 		PCChannelMask	pChannelMask
528 	);
529 
530 	//
531 	//	Stop transport for a single pipe
532 	//
533 	virtual ECHOSTATUS Stop
534 	(
535 		WORD		wPipeIndex
536 	);
537 
538 	//
539 	//	Stop and reset selected output and/or input audio pipes
540 	//
541 	virtual ECHOSTATUS Reset
542 	(
543 		PCChannelMask	pChannelMask
544 	);
545 
546 	//
547 	//	Stop and reset single audio pipe
548 	//
549 	virtual ECHOSTATUS Reset
550 	(
551 		WORD		wPipeIndex
552 	);
553 
554 	//
555 	// Get mask with active pipes - that is, those pipes that
556 	// are currently moving data.
557 	//
558 	virtual ECHOSTATUS GetActivePipes
559 	(
560 		PCChannelMask	pChannelMask
561 	);
562 
563 	//
564 	// Get mask with open pipes
565 	//
566 	virtual ECHOSTATUS GetOpenPipes
567 	(
568 		PCChannelMask	pChannelMask
569 	);
570 
571 	//
572 	//	Get a pointer that can be dereferenced to read
573 	// the DSP's DMA counter for this pipe; see CEchoGals_transport.cpp
574 	// for more info.
575 	//
576 	virtual ECHOSTATUS GetAudioPositionPtr
577 	(
578 		WORD		wPipeIndex,
579 		PDWORD 	(&pdwPosition)
580 	);
581 
582 	//
583 	// Get the daffy duck pointer for a pipe
584 	//
585 	CDaffyDuck *GetDaffyDuck(WORD wPipeIndex);
586 
587 	//
588 	// Reset the 64 bit DMA position for this pipe
589 	//
590 	void ResetDmaPos( WORD wPipe );
591 
592 	//
593 	// Update the 64 bit DMA position for this pipe
594 	//
595 	void UpdateDmaPos( WORD wPipeIndex );
596 
597 	//
598 	//	Get the 64 bit DMA position for this pipe
599 	//
600 	void GetDmaPos( WORD wPipeIndex, PULONGLONG pPos )
601 	{
602 		UpdateDmaPos( wPipeIndex );
603 		*pPos = m_ullDmaPos[ wPipeIndex ];
604 	}
605 
606 	//
607 	// Get the state of a given pipe
608 	//
609 	DWORD GetPipeState( WORD wPipeIndex )
610 	{
611 		return (DWORD) m_byPipeState[ wPipeIndex ];
612 	}
613 
614 	//
615 	//	Verify a pipe is open and ready for business!
616 	//
617 	ECHOSTATUS VerifyAudioOpen
618 	(
619 		WORD		wPipeIndex
620 	);
621 
622 	//***********************************************************************
623 	//
624 	//	MIDI (public)
625 	//
626 	//***********************************************************************
627 
628 #ifdef MIDI_SUPPORT
629 
630 	// The context struct should be set to zero before calling OpenMidiInput
631 	virtual ECHOSTATUS OpenMidiInput(ECHOGALS_MIDI_IN_CONTEXT *pContext);
632 	virtual ECHOSTATUS CloseMidiInput(ECHOGALS_MIDI_IN_CONTEXT *pContext);
633 
634 	//
635 	// Reset the MIDI input buffer; MIDI input remains enabled and open
636 	//
637 	virtual ECHOSTATUS ResetMidiInput(ECHOGALS_MIDI_IN_CONTEXT *pContext);
638 
639 	virtual ECHOSTATUS WriteMidi
640 	(
641 		DWORD		dwExpectedCt,
642 		PBYTE		pBuffer,
643 		PDWORD	pdwActualCt
644 	);
645 
646 	virtual ECHOSTATUS ReadMidiByte(	ECHOGALS_MIDI_IN_CONTEXT	*pContext,
647 												DWORD								&dwMidiData,
648 												LONGLONG							&llTimestamp);
649 
650 	virtual void ServiceMtcSync()
651 	{
652 	}
653 
654 #endif // MIDI_SUPPORT
655 
656 
657 
658 	//***********************************************************************
659 	//
660 	//	Interrupt handler methods (public)
661 	//
662 	//***********************************************************************
663 
664 	//
665 	//	This is called from within an interrupt handler.  It starts interrupt
666 	//	handling.  Returns error status if this interrupt is not ours.
667 	// Returns ECHOSTATUS_OK if it is.
668 	//
669 	//	OS dependent code handles routing to this point.
670 	//
671 	virtual ECHOSTATUS ServiceIrq(BOOL &fMidiReceived);
672 
673 
674 	//***********************************************************************
675 	//
676 	//	Power management (public)
677 	//
678 	// Please do not do silly things like try and set a volume level or
679 	// play audio after calling GoComatose; be sure and call WakeUp first!
680 	//
681 	//***********************************************************************
682 
683 	//
684 	// Tell the hardware to go to sleep
685 	//
686 	virtual ECHOSTATUS GoComatose();
687 
688 	//
689 	// Tell the hardware to wake up
690 	//
691 	virtual ECHOSTATUS WakeUp();
692 
693 
694 
695 protected:
696 
697 	//***********************************************************************
698 	//
699 	//	Member variables (protected)
700 	//
701 	//***********************************************************************
702 
703 	PCOsSupport		m_pOsSupport;		// Ptr to OS Support methods & data
704 	WORD				m_wFlags;			// See ECHOGALS_FLAG_??? flags defined
705 												// in EchoGalsXface.h
706 	PVOID				m_pvSharedMemory;	// Shared memory addr assigned by PNP
707 	CHAR				m_szCardInstallName[ ECHO_MAXNAMELEN ];
708 												// Same as card except when multiple
709 												// boards of the same type installed.
710 												// Then becomes "Layla1", "Layla2" etc.
711 	CChannelMask	m_cmAudioOpen;		// Audio channels open mask
712 	CChannelMask	m_cmAudioCyclic;	// Audio use cyclic buffers mask
713 
714 	DWORD				m_dwSampleRate;	// Card sample rate in Hz
715 	DWORD				m_dwLockedSampleRate;
716 												// Card sample rate when locked
717 	ECHOGALS_AUDIO_PIPE
718 						m_Pipes[ ECHO_MAXAUDIOPIPES ];
719 												// Keep mapping info on open pipes
720 	WORD				m_wBytesPerSample[ ECHO_MAXAUDIOPIPES ];
721 												// Keep conversion info on open pipes
722 	BYTE				m_byPipeState[ ECHO_MAXAUDIOPIPES ];
723 												// Track state of all pipes
724 	PVOID				m_ProcessId[ ECHO_MAXAUDIOPIPES ];
725 												// Caller process ID for implementing
726 												// synchronous wave start
727 	DWORD				m_dwMeterOnCount;	// Track need for meter updates by DSP
728 	PCDspCommObject
729 						m_pDspCommObject;	// Ptr to DSP communication object
730 
731 	DWORD				m_dwMidiInOpen;	// Midi in channels open mask
732 	DWORD				m_dwMidiOutOpen; 	// Midi out channels open mask
733 
734 	BOOL				m_fMixerDisabled;
735 
736 	WORD				m_wAnalogOutputLatency;	// Latency in samples
737 	WORD				m_wAnalogInputLatency;
738 	WORD				m_wDigitalOutputLatency;
739 	WORD				m_wDigitalInputLatency;
740 
741 
742 
743 	//
744 	//	Monitor state info
745 	//
746 	CMonitorCtrl		m_MonitorCtrl;
747 
748 	//
749 	// Output pipe control
750 	//
751 	CPipeOutCtrl		m_PipeOutCtrl;
752 
753 	//
754 	// Input bus mute and gain settings
755 	//
756 	CBusInLineLevel	m_BusInLineLevels[ ECHO_MAXAUDIOINPUTS ];
757 
758 	//
759 	// Output bus mute and gain settings
760 	//
761 	CBusOutLineLevel	m_BusOutLineLevels[ ECHO_MAXAUDIOOUTPUTS ];
762 
763 	//
764 	//
765 	// Linked list of mixer clients
766 	//
767 	ECHO_MIXER_CLIENT	*m_pMixerClients;
768 
769 
770 	//
771 	// DMA position, in bytes, for each pipe
772 	//
773 	ULONGLONG		m_ullDmaPos[ ECHO_MAXAUDIOPIPES ];
774 	DWORD				m_dwLastDspPos[ ECHO_MAXAUDIOPIPES ];
775 
776 	//
777 	//	Pointers to daffy ducks for each pipe
778 	//
779 	PCDaffyDuck		m_DaffyDucks[ ECHO_MAXAUDIOPIPES ];
780 
781 
782 #ifdef MIDI_SUPPORT
783 	//
784 	// MIDI input buffer
785 	//
786 	CMidiInQ	m_MidiIn;
787 #endif
788 
789 
790 	//
791 	//	Macintosh compiler likes "class" after friend, PC doesn't care
792 	//
793 	friend class CLineLevel;
794 	friend class CBusOutLineLevel;
795 	friend class CBusInLineLevel;
796 	friend class CPipeOutCtrl;
797 	friend class CMonitorCtrl;
798 	friend class CMidiInQ;
799 	friend class CMtcSync;
800 
801 
802 	//***********************************************************************
803 	//
804 	//	Initialization (protected)
805 	//
806 	//***********************************************************************
807 
808 	//
809 	//	Init the line level classes.
810 	//	This MUST be called from within any derived classes as part of
811 	//	InitHw after the DSP is up and running!
812 	//
813 	virtual ECHOSTATUS InitLineLevels();
814 
815 
816 	//***********************************************************************
817 	//
818 	//	Information (protected)
819 	//
820 	//***********************************************************************
821 
822 	virtual ECHOSTATUS GetBaseCapabilities(PECHOGALS_CAPS pCapabilities);
823 
824 	WORD GetNumPipesOut();
825 	WORD GetNumPipesIn();
826 	WORD GetNumBussesOut();
827 	WORD GetNumBussesIn();
828 	WORD GetNumBusses();
829  	WORD GetNumPipes();
830 	WORD GetFirstDigitalBusOut();
831 	WORD GetFirstDigitalBusIn();
832 
833 	BOOL HasVmixer();
834 
835 	PCDspCommObject GetDspCommObject();
836 
837 
838 	//***********************************************************************
839 	//
840 	//	Audio transport (protected)
841 	//
842 	// Daffy ducks are objects that manage scatter-gather lists.
843 	//
844 	//***********************************************************************
845 
846 
847 
848 	//***********************************************************************
849 	//
850 	//	Mixer interface (protected)
851 	//
852 	//***********************************************************************
853 
854 	//
855 	// Match a mixer cookie to a mixer client
856 	//
857 	ECHO_MIXER_CLIENT *GetMixerClient(NUINT Cookie);
858 
859 	//
860 	// Adjust all the monitor levels for a particular output bus; this is
861 	// used to implement the master output level.
862 	//
863 	virtual ECHOSTATUS AdjustMonitorsForBusOut(WORD wBusOut);
864 
865 	//
866 	// Adjust all the output pipe levels for a particular output bus; this is
867 	// also used to implement the master output level.
868 	//
869 	virtual ECHOSTATUS AdjustPipesOutForBusOut(WORD wBusOut,INT32 iBusOutGain);
870 
871 	//
872 	// A mixer control has changed; store the notify
873 	//
874 	ECHOSTATUS MixerControlChanged
875 	(
876 		WORD	wType,								// One of the ECHO_CHANNEL_TYPES
877 		WORD  wParameter, 						// One of the MXN_* values
878 		WORD 	wCh1 = ECHO_CHANNEL_UNUSED,	// Depends on the wType value
879 		WORD  wCh2 = ECHO_CHANNEL_UNUSED		// Also depends on wType value
880 	);
881 
882 #ifdef DIGITAL_INPUT_AUTO_MUTE_SUPPORT
883 	//
884 	// Digital input auto-mute - Gina24, Layla24, and Mona only
885 	//
886 	virtual ECHOSTATUS GetDigitalInAutoMute(PMIXER_FUNCTION pMixerFunction);
887 	virtual ECHOSTATUS SetDigitalInAutoMute(PMIXER_FUNCTION pMixerFunction);
888 #endif
889 
890 	//
891 	// Get the audio latency for a single pipe
892 	//
893 	virtual void GetAudioLatency(ECHO_AUDIO_LATENCY *pLatency);
894 
895 };		// class CEchoGals
896 
897 typedef CEchoGals * PCEchoGals;
898 
899 #endif
900 
901 // *** CEchoGals.h ***
902