xref: /haiku/src/add-ons/kernel/drivers/audio/echo/generic/CMonitorCtrl.h (revision 51978af14a173e7fae0563b562be5603bc652aeb)
1 // ****************************************************************************
2 //
3 //		CMonitorCtrl.h
4 //
5 //		Class to control input monitors on cards with or without vmixers.
6 //		Input monitors are used to route audio data from input busses to
7 //		output busses through the DSP with very low latency.
8 //
9 //		Any input bus may be routed to any output bus.
10 //
11 // ----------------------------------------------------------------------------
12 //
13 //		Copyright Echo Digital Audio Corporation (c) 1998 - 2002
14 //		All rights reserved
15 //		www.echoaudio.com
16 //
17 //		Permission is hereby granted, free of charge, to any person obtaining a
18 //		copy of this software and associated documentation files (the
19 //		"Software"), to deal with the Software without restriction, including
20 //		without limitation the rights to use, copy, modify, merge, publish,
21 //		distribute, sublicense, and/or sell copies of the Software, and to
22 //		permit persons to whom the Software is furnished to do so, subject to
23 //		the following conditions:
24 //
25 //		- Redistributions of source code must retain the above copyright
26 //		notice, this list of conditions and the following disclaimers.
27 //
28 //		- Redistributions in binary form must reproduce the above copyright
29 //		notice, this list of conditions and the following disclaimers in the
30 //		documentation and/or other materials provided with the distribution.
31 //
32 //		- Neither the name of Echo Digital Audio, nor the names of its
33 //		contributors may be used to endorse or promote products derived from
34 //		this Software without specific prior written permission.
35 //
36 //		THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
37 //		EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
38 //		MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
39 //		IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR
40 //		ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
41 //		TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
42 //		SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
43 //
44 // ****************************************************************************
45 
46 #ifndef _CMonitorCtrl_H_
47 #define _CMonitorCtrl_H_
48 
49 class CEchoGals;
50 
51 class CMonitorCtrl
52 {
53 
54 protected:
55 
56 	typedef struct
57 	{
58 		INT8	iLeft;
59 		INT8	iRight;
60 	} PAN_DB;
61 
62 	CEchoGals	*m_pEG;
63 
64 	WORD			m_wNumBussesIn;
65 	WORD			m_wNumBussesOut;
66 
67 	INT8			*m_Gains;
68 	BYTE			*m_Mutes;
69 	WORD			*m_Pans;
70 	PAN_DB		*m_PanDbs;
71 
72 	WORD GetIndex(WORD wBusIn,WORD wBusOut)
73 	{
74 		return (wBusOut >> 1) * m_wNumBussesIn + wBusIn;
75 	}
76 
77 public:
78 
79 	ECHOSTATUS Init(CEchoGals *m_pEG);
80 	void Cleanup();
81 
82 	ECHOSTATUS SetGain
83 	(
84 		WORD 	wBusIn,
85 		WORD 	wBusOut,
86 		INT32 	iGain,
87 		BOOL 	fImmediate = TRUE
88 	);
89 	ECHOSTATUS GetGain(WORD wBusIn, WORD wBusOut, INT32 &iGain);
90 
91 	ECHOSTATUS SetMute
92 	(
93 		WORD 	wBusIn,
94 		WORD 	wBusOut,
95 		BOOL 	bMute,
96 		BOOL 	fImmediate = TRUE
97 	);
98 	ECHOSTATUS GetMute(WORD wBusIn, WORD wBusOut, BOOL &bMute);
99 
100 	ECHOSTATUS SetPan(WORD wBusIn, WORD wBusOut, INT32 iPan);
101 	ECHOSTATUS GetPan(WORD wBusIn, WORD wBusOut, INT32 &iPan);
102 
103 };
104 
105 #endif // _CMonitorCtrl_H_
106