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