xref: /haiku/src/add-ons/kernel/drivers/audio/echo/generic/CEchoGalsVmixer.cpp (revision 1d9d47fc72028bb71b5f232a877231e59cfe2438)
1 // ****************************************************************************
2 //
3 //		CEchoGalsVmixer.cpp
4 //
5 //		CEchoGalsVmixer is used to add virtual output mixing to the base
6 //		CEchoGals class.
7 //
8 //		Set editor tabs to 3 for your viewing pleasure.
9 //
10 // ----------------------------------------------------------------------------
11 //
12 // This file is part of Echo Digital Audio's generic driver library.
13 // Copyright Echo Digital Audio Corporation (c) 1998 - 2005
14 // All rights reserved
15 // www.echoaudio.com
16 //
17 // This library is free software; you can redistribute it and/or
18 // modify it under the terms of the GNU Lesser General Public
19 // License as published by the Free Software Foundation; either
20 // version 2.1 of the License, or (at your option) any later version.
21 //
22 // This library is distributed in the hope that it will be useful,
23 // but WITHOUT ANY WARRANTY; without even the implied warranty of
24 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25 // Lesser General Public License for more details.
26 //
27 // You should have received a copy of the GNU Lesser General Public
28 // License along with this library; if not, write to the Free Software
29 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
30 //
31 // ****************************************************************************
32 
33 #include "CEchoGalsVmixer.h"
34 
35 
36 //****************************************************************************
37 //
38 // Constructor and destructor
39 //
40 //****************************************************************************
41 
42 CEchoGalsVmixer::CEchoGalsVmixer( PCOsSupport pOsSupport )
43 		  : CEchoGals( pOsSupport )
44 {
45 	ECHO_DEBUGPRINTF( ( "CEchoGalsVmixer::CEchoGalsVmixer() is born!\n" ) );
46 
47 }	// CEchoGalsVmixer::CEchoGalsVmixer()
48 
49 
50 CEchoGalsVmixer::~CEchoGalsVmixer()
51 {
52 	ECHO_DEBUGPRINTF( ( "CEchoGalsVmixer::~CEchoGalsVmixer() is toast!\n" ) );
53 }	// CEchoGalsVmixer::~CEchoGalsVmixer()
54 
55 
56 
57 
58 //****************************************************************************
59 //
60 // Vmixer
61 //
62 //****************************************************************************
63 
64 //===========================================================================
65 //
66 // Most of the cards don't have an actual output bus gain; they only
67 // have gain controls for output pipes; the output bus gain is implemented
68 // as a logical control.  Vmixer cards work fifferently; it does have
69 // a physical output bus gain control, so just pass the gain down to the
70 // DSP comm object.
71 //
72 //===========================================================================
73 
74 ECHOSTATUS CEchoGalsVmixer::AdjustPipesOutForBusOut(WORD wBusOut,INT32 iBusOutGain)
75 {
76 	WORD wPipe;
77 
78 	ECHO_DEBUGPRINTF(("CEchoGalsVmixer::AdjustPipesOutForBusOut wBusOut %d  iBusOutGain %ld\n",
79 							wBusOut,
80 							iBusOutGain));
81 
82 	wBusOut &= 0xfffe;
83 	for (wPipe = 1; wPipe < GetNumPipesOut(); wPipe++)
84 	{
85 		m_PipeOutCtrl.SetGain( wPipe, wBusOut, ECHOGAIN_UPDATE, FALSE);
86 	}
87 
88 	m_PipeOutCtrl.SetGain( 0, wBusOut, ECHOGAIN_UPDATE, TRUE);
89 
90 	return ECHOSTATUS_OK;
91 
92 }	// AdjustPipesOutForBusOut
93 
94 
95 //===========================================================================
96 //
97 // GetBaseCapabilities is used by the CEchoGals-derived classes to
98 // help fill out the ECHOGALS_CAPS struct.  Override this here to add
99 // the vmixer stuff.
100 //
101 //===========================================================================
102 
103 ECHOSTATUS CEchoGalsVmixer::GetBaseCapabilities
104 (
105 	PECHOGALS_CAPS	pCapabilities
106 )
107 {
108 	DWORD i;
109 	ECHOSTATUS Status;
110 
111 	//
112 	// Base class
113 	//
114 	Status = CEchoGals::GetBaseCapabilities(pCapabilities);
115 
116 	//
117 	// Add meters & pans to output pipes
118 	//
119 	for (i = 0 ; i < GetNumPipesOut(); i++)
120 	{
121 		pCapabilities->dwPipeOutCaps[i] |= ECHOCAPS_PEAK_METER |
122 														ECHOCAPS_PAN;
123 	}
124 
125 	return Status;
126 
127 }	// GetBaseCapabilities
128 
129 
130 //===========================================================================
131 //
132 // Adjust all the monitor levels for a particular output bus
133 //
134 // For vmixer cards, need to force the "update monitors" command
135 // for the DSP 'cos it doesn't get sent otherwise.
136 //
137 //===========================================================================
138 
139 ECHOSTATUS CEchoGalsVmixer::AdjustMonitorsForBusOut(WORD wBusOut)
140 {
141 	ECHOSTATUS Status;
142 
143 	//
144 	// Call the base class
145 	//
146 	Status = CEchoGals::AdjustMonitorsForBusOut( wBusOut );
147 	if (ECHOSTATUS_OK == Status)
148 	{
149 		GetDspCommObject()->UpdateAudioOutLineLevel();
150 	}
151 
152 	return Status;
153 
154 }	// AdjustMonitorsForBusOut
155 
156 
157 // *** CEchoGalsVmixer.cpp ***
158