xref: /haiku/src/add-ons/kernel/drivers/audio/echo/generic/CMonitorCtrl.h (revision 68ea01249e1e2088933cb12f9c28d4e5c5d1c9ef)
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 // This file is part of Echo Digital Audio's generic driver library.
14 // Copyright Echo Digital Audio Corporation (c) 1998 - 2005
15 // All rights reserved
16 // www.echoaudio.com
17 //
18 // This library is free software; you can redistribute it and/or
19 // modify it under the terms of the GNU Lesser General Public
20 // License as published by the Free Software Foundation; either
21 // version 2.1 of the License, or (at your option) any later version.
22 //
23 // This library is distributed in the hope that it will be useful,
24 // but WITHOUT ANY WARRANTY; without even the implied warranty of
25 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
26 // Lesser General Public License for more details.
27 //
28 // You should have received a copy of the GNU Lesser General Public
29 // License along with this library; if not, write to the Free Software
30 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31 //
32 // ****************************************************************************
33 
34 #ifndef _CMonitorCtrl_H_
35 #define _CMonitorCtrl_H_
36 
37 class CEchoGals;
38 
39 class CMonitorCtrl
40 {
41 
42 protected:
43 
44 	typedef struct
45 	{
46 		INT8	iLeft;
47 		INT8	iRight;
48 	} PAN_DB;
49 
50 	CEchoGals	*m_pEG;
51 
52 	WORD			m_wNumBussesIn;
53 	WORD			m_wNumBussesOut;
54 
55 	INT8			*m_Gains;
56 	BYTE			*m_Mutes;
57 	WORD			*m_Pans;
58 	PAN_DB		*m_PanDbs;
59 
60 	WORD GetIndex(WORD wBusIn,WORD wBusOut)
61 	{
62 		return (wBusOut >> 1) * m_wNumBussesIn + wBusIn;
63 	}
64 
65 public:
66 
67 	~CMonitorCtrl();
68 
69 	ECHOSTATUS Init(CEchoGals *m_pEG);
70 	void Cleanup();
71 
72 	ECHOSTATUS SetGain
73 	(
74 		WORD 	wBusIn,
75 		WORD 	wBusOut,
76 		INT32 	iGain,
77 		BOOL 	fImmediate = TRUE
78 	);
79 	ECHOSTATUS GetGain(WORD wBusIn, WORD wBusOut, INT32 &iGain);
80 
81 	ECHOSTATUS SetMute
82 	(
83 		WORD 	wBusIn,
84 		WORD 	wBusOut,
85 		BOOL 	bMute,
86 		BOOL 	fImmediate = TRUE
87 	);
88 	ECHOSTATUS GetMute(WORD wBusIn, WORD wBusOut, BOOL &bMute);
89 
90 	ECHOSTATUS SetPan(WORD wBusIn, WORD wBusOut, INT32 iPan);
91 	ECHOSTATUS GetPan(WORD wBusIn, WORD wBusOut, INT32 &iPan);
92 
93 };
94 
95 #endif // _CMonitorCtrl_H_
96