xref: /haiku/src/add-ons/kernel/drivers/audio/echo/generic/CLineLevel.h (revision 5e96d7d537fbec23bad4ae9b4c8e7b02e769f0c6)
1 // ****************************************************************************
2 //
3 //		CLineLevel.h
4 //
5 //		Include file for EchoGals generic driver line level state machine.
6 //
7 //		Class for setting and getting mixer values for input and output busses.
8 //
9 //		Implemented as a base class with 3 derived classes, one for
10 //		each type of line.
11 //
12 // ----------------------------------------------------------------------------
13 //
14 // ----------------------------------------------------------------------------
15 //
16 // This file is part of Echo Digital Audio's generic driver library.
17 // Copyright Echo Digital Audio Corporation (c) 1998 - 2005
18 // All rights reserved
19 // www.echoaudio.com
20 //
21 // This library is free software; you can redistribute it and/or
22 // modify it under the terms of the GNU Lesser General Public
23 // License as published by the Free Software Foundation; either
24 // version 2.1 of the License, or (at your option) any later version.
25 //
26 // This library is distributed in the hope that it will be useful,
27 // but WITHOUT ANY WARRANTY; without even the implied warranty of
28 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
29 // Lesser General Public License for more details.
30 //
31 // You should have received a copy of the GNU Lesser General Public
32 // License along with this library; if not, write to the Free Software
33 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
34 //
35 // ****************************************************************************
36 
37 #ifndef _CLineLevel_
38 #define _CLineLevel_
39 
40 
41 class CEchoGals;
42 
43 
44 /****************************************************************************
45 
46 	CLineLevel - Base class
47 
48  ****************************************************************************/
49 
50 class CLineLevel
51 {
52 protected :
53 
54 	INT32				m_iGain;				// Current gain in dB X 256
55 	BOOL				m_fMuted;
56 	CEchoGals *		m_pEchoGals;		// Ptr to our creator object
57 	WORD				m_wChannelIndex;	// pipe index for this line
58 
59 public:
60 
61 	//
62 	//	Construction/destruction
63 	//
64 	CLineLevel();
65 	virtual ~CLineLevel();
66 
67 	//
68 	//	Initialization function for initializing arrays of this class
69 	//
70 	void Init
71 	(
72 		WORD				wChannelIndex,	// Which channel we represent
73 		CEchoGals *		pEchoGals,		// For setting line levels
74 		INT32				iGain = 0		// Initial gain setting
75 	);
76 
77 	//
78 	//	Mute
79 	//
80 	virtual ECHOSTATUS SetMute( BOOL bOn );
81 	BOOL IsMuteOn() { return m_fMuted; }
82 
83 
84 	//
85 	//	Gain functions
86 	//
87 	INT32 GetGain() { return( m_iGain ); }
88 	virtual ECHOSTATUS SetGain(
89 		INT32 	iGain,
90 		BOOL 	fImmediate = TRUE
91 	) = NULL;
92 
93 };		// class CLineLevel
94 
95 typedef CLineLevel * PCLineLevel;
96 
97 
98 
99 /****************************************************************************
100 
101 	CBusInLineLevel - Derived class for managing input bus gains
102 
103  ****************************************************************************/
104 
105 class CBusInLineLevel : public CLineLevel
106 {
107 protected :
108 
109 public:
110 
111 	//
112 	//	Construction/destruction
113 	//
114 	CBusInLineLevel();
115 	virtual ~CBusInLineLevel();
116 
117 	//
118 	//	Mute
119 	//
120 	virtual ECHOSTATUS SetMute( BOOL bOn );
121 
122 	//
123 	//	Gain functions
124 	//
125 	virtual ECHOSTATUS SetGain
126 	(
127 		INT32 	iGain,
128 		BOOL 	fImmediate = TRUE
129 	);
130 
131 
132 };		// class CBusInLineLevel
133 
134 typedef CBusInLineLevel * PCBusInLineLevel;
135 
136 
137 
138 
139 /****************************************************************************
140 
141 	CBusOutLineLevel - Derived class for managing output bus gains
142 
143  ****************************************************************************/
144 
145 class CBusOutLineLevel : public CLineLevel
146 {
147 protected :
148 
149 public:
150 
151 	//
152 	//	Construction/destruction
153 	//
154 	CBusOutLineLevel();
155 	virtual ~CBusOutLineLevel();
156 
157 	//
158 	//	Mute
159 	//
160 	virtual ECHOSTATUS SetMute( BOOL bOn );
161 
162 	//
163 	//	Gain functions
164 	//
165 	virtual ECHOSTATUS SetGain
166 	(
167 		INT32 	iGain,
168 		BOOL 	fImmediate = TRUE
169 	);
170 
171 
172 };		// class CBusOutLineLevel
173 
174 typedef CBusOutLineLevel * PCBusOutLineLevel;
175 
176 #endif
177 
178 // **** CLineLevel.h ****
179