xref: /haiku/src/add-ons/kernel/drivers/audio/echo/generic/CEchoGals.h (revision fef6144999c2fa611f59ee6ffe6dd7999501385c)
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 						? 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 	// Make a Daffy Duck object (scatter-gather list)
414 	//
415 	CDaffyDuck * MakeDaffyDuck();
416 
417 	//
418 	// Set the scatter-gather list for a pipe
419 	//
420 	ECHOSTATUS SetDaffyDuck( WORD wPipeIndex, CDaffyDuck *pDuck);
421 
422 	//
423 	//	Reserve a pipe.  Please refer to the definition of
424 	// ECHOGALS_OPENAUDIOPARAMETERS.
425 	//
426 	// If the fCheckHardware flag is true, then the open will fail
427 	// if the DSP and ASIC firmware have not been loaded (usually means
428 	// your external box is turned off).
429 	//
430 	// If you want to manage your own CDaffyDuck object for this pipe,
431 	// then pass a pointer to a CDaffyDuck object.  If you pass NULL,
432 	// one will be created for you.
433 	//
434 	virtual ECHOSTATUS OpenAudio
435 	(
436 		PECHOGALS_OPENAUDIOPARAMETERS	pOpenParameters,	// Info on channel
437 		PWORD									pwPipeIndex,		// Ptr to pipe index
438 		BOOL									fCheckHardware = TRUE,
439 		CDaffyDuck							*pDuck = NULL
440 	);
441 
442 	//
443 	//	Close a pipe
444 	//
445 	virtual ECHOSTATUS CloseAudio
446 	(
447 		PECHOGALS_CLOSEAUDIOPARAMETERS	pCloseParameters,
448 		BOOL										fFreeDuck = TRUE
449 	);
450 
451 	//
452 	//	Find out if the audio format is supported.
453 	//
454 	virtual ECHOSTATUS QueryAudioFormat
455 	(
456 		WORD							wPipeIndex,
457 		PECHOGALS_AUDIOFORMAT	pAudioFormat
458 	);
459 
460 	//
461 	// Set the audio format for a single pipe
462 	virtual ECHOSTATUS SetAudioFormat
463 	(
464 		WORD							wPipeIndex,
465 		PECHOGALS_AUDIOFORMAT	pAudioFormat
466 	);
467 
468 	//
469 	// Set the audio format for a bunch of pipes at once
470 	//
471 	virtual ECHOSTATUS SetAudioFormat
472 	(
473 		PCChannelMask				pChannelMask,
474 		PECHOGALS_AUDIOFORMAT	pAudioFormat
475 	);
476 
477 	//
478 	//	Get the current audio format for a pipe
479 	//
480 	virtual ECHOSTATUS GetAudioFormat
481 	(
482 		WORD							wPipeIndex,
483 		PECHOGALS_AUDIOFORMAT	pAudioFormat
484 	);
485 
486 	//
487 	// Call this to find out if this card can handle a given sample rate
488 	//
489 	virtual ECHOSTATUS QueryAudioSampleRate
490 	(
491 		DWORD		dwSampleRate
492 	)
493 	{ return( ECHOSTATUS_NOT_SUPPORTED ); }
494 
495 
496 	//
497 	// I'm not going to tell you what the next two functions do; you'll just
498 	// have to guess.
499 	//
500 	virtual ECHOSTATUS SetAudioSampleRate
501 	(
502 		DWORD		dwSampleRate
503 	);
504 
505 	virtual ECHOSTATUS GetAudioSampleRate
506 	(
507 		PDWORD	pdwSampleRate
508 	);
509 
510 
511 	//
512 	//	Start transport for several pipes at once
513 	//
514 	virtual ECHOSTATUS Start
515 	(
516 		PCChannelMask	pChannelMask
517 	);
518 
519 	//
520 	//	Start transport for a single audio pipe
521 	//
522 	virtual ECHOSTATUS Start
523 	(
524 		WORD		wPipeIndex
525 	);
526 
527 	//
528 	//	Stop transport for several pipes at once
529 	//
530 	virtual ECHOSTATUS Stop
531 	(
532 		PCChannelMask	pChannelMask
533 	);
534 
535 	//
536 	//	Stop transport for a single pipe
537 	//
538 	virtual ECHOSTATUS Stop
539 	(
540 		WORD		wPipeIndex
541 	);
542 
543 	//
544 	//	Stop and reset selected output and/or input audio pipes
545 	//
546 	virtual ECHOSTATUS Reset
547 	(
548 		PCChannelMask	pChannelMask
549 	);
550 
551 	//
552 	//	Stop and reset single audio pipe
553 	//
554 	virtual ECHOSTATUS Reset
555 	(
556 		WORD		wPipeIndex
557 	);
558 
559 	//
560 	// Get mask with active pipes - that is, those pipes that
561 	// are currently moving data.
562 	//
563 	virtual ECHOSTATUS GetActivePipes
564 	(
565 		PCChannelMask	pChannelMask
566 	);
567 
568 	//
569 	// Get mask with open pipes
570 	//
571 	virtual ECHOSTATUS GetOpenPipes
572 	(
573 		PCChannelMask	pChannelMask
574 	);
575 
576 	//
577 	//	Get a pointer that can be dereferenced to read
578 	// the DSP's DMA counter for this pipe; see CEchoGals_transport.cpp
579 	// for more info.
580 	//
581 	virtual ECHOSTATUS GetAudioPositionPtr
582 	(
583 		WORD		wPipeIndex,
584 		PDWORD 	(&pdwPosition)
585 	);
586 
587 	//
588 	// Get the daffy duck pointer for a pipe
589 	//
590 	CDaffyDuck *GetDaffyDuck(WORD wPipeIndex);
591 
592 	//
593 	// Reset the 64 bit DMA position for this pipe
594 	//
595 	void ResetDmaPos( WORD wPipe );
596 
597 	//
598 	// Update the 64 bit DMA position for this pipe
599 	//
600 	void UpdateDmaPos( WORD wPipeIndex );
601 
602 	//
603 	//	Get the 64 bit DMA position for this pipe
604 	//
605 	void GetDmaPos( WORD wPipeIndex, PULONGLONG pPos )
606 	{
607 		UpdateDmaPos( wPipeIndex );
608 		*pPos = m_ullDmaPos[ wPipeIndex ];
609 	}
610 
611 	//
612 	// Get the state of a given pipe
613 	//
614 	DWORD GetPipeState( WORD wPipeIndex )
615 	{
616 		return (DWORD) m_byPipeState[ wPipeIndex ];
617 	}
618 
619 	//
620 	//	Verify a pipe is open and ready for business!
621 	//
622 	ECHOSTATUS VerifyAudioOpen
623 	(
624 		WORD		wPipeIndex
625 	);
626 
627 
628 	//***********************************************************************
629 	//
630 	//	MIDI (public)
631 	//
632 	//***********************************************************************
633 
634 #ifdef MIDI_SUPPORT
635 
636 	// The context struct should be set to zero before calling OpenMidiInput
637 	virtual ECHOSTATUS OpenMidiInput(ECHOGALS_MIDI_IN_CONTEXT *pContext);
638 	virtual ECHOSTATUS CloseMidiInput(ECHOGALS_MIDI_IN_CONTEXT *pContext);
639 
640 	//
641 	// Reset the MIDI input buffer; MIDI input remains enabled and open
642 	//
643 	virtual ECHOSTATUS ResetMidiInput(ECHOGALS_MIDI_IN_CONTEXT *pContext);
644 
645 	virtual ECHOSTATUS WriteMidi
646 	(
647 		DWORD		dwExpectedCt,
648 		PBYTE		pBuffer,
649 		PDWORD	pdwActualCt
650 	);
651 
652 	virtual ECHOSTATUS ReadMidiByte(	ECHOGALS_MIDI_IN_CONTEXT	*pContext,
653 												DWORD								&dwMidiData,
654 												LONGLONG							&llTimestamp);
655 
656 	virtual void ServiceMtcSync()
657 	{
658 	}
659 
660 #endif // MIDI_SUPPORT
661 
662 
663 
664 	//***********************************************************************
665 	//
666 	//	Interrupt handler methods (public)
667 	//
668 	//***********************************************************************
669 
670 	//
671 	//	This is called from within an interrupt handler.  It starts interrupt
672 	//	handling.  Returns error status if this interrupt is not ours.
673 	// Returns ECHOSTATUS_OK if it is.
674 	//
675 	//	OS dependent code handles routing to this point.
676 	//
677 	virtual ECHOSTATUS ServiceIrq(BOOL &fMidiReceived);
678 
679 
680 	//***********************************************************************
681 	//
682 	//	Power management (public)
683 	//
684 	// Please do not do silly things like try and set a volume level or
685 	// play audio after calling GoComatose; be sure and call WakeUp first!
686 	//
687 	//***********************************************************************
688 
689 	//
690 	// Tell the hardware to go to sleep
691 	//
692 	virtual ECHOSTATUS GoComatose();
693 
694 	//
695 	// Tell the hardware to wake up
696 	//
697 	virtual ECHOSTATUS WakeUp();
698 
699 
700 
701 protected:
702 
703 	//***********************************************************************
704 	//
705 	//	Member variables (protected)
706 	//
707 	//***********************************************************************
708 
709 	PCOsSupport		m_pOsSupport;		// Ptr to OS Support methods & data
710 	WORD				m_wFlags;			// See ECHOGALS_FLAG_??? flags defined
711 												// in EchoGalsXface.h
712 	PVOID				m_pvSharedMemory;	// Shared memory addr assigned by PNP
713 	CHAR				m_szCardInstallName[ ECHO_MAXNAMELEN ];
714 												// Same as card except when multiple
715 												// boards of the same type installed.
716 												// Then becomes "Layla1", "Layla2" etc.
717 	CChannelMask	m_cmAudioOpen;		// Audio channels open mask
718 	CChannelMask	m_cmAudioCyclic;	// Audio use cyclic buffers mask
719 
720 	DWORD				m_dwSampleRate;	// Card sample rate in Hz
721 	DWORD				m_dwLockedSampleRate;
722 												// Card sample rate when locked
723 	ECHOGALS_AUDIO_PIPE
724 						m_Pipes[ ECHO_MAXAUDIOPIPES ];
725 												// Keep mapping info on open pipes
726 	WORD				m_wBytesPerSample[ ECHO_MAXAUDIOPIPES ];
727 												// Keep conversion 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