xref: /haiku/src/add-ons/kernel/drivers/audio/echo/generic/CIndigoIODspCommObject.cpp (revision c90684742e7361651849be4116d0e5de3a817194)
1 // ****************************************************************************
2 //
3 //  	CIndigoIODspCommObject.cpp
4 //
5 //		Implementation file for EchoGals generic driver Indigo io DSP
6 //		interface class.
7 //
8 // ----------------------------------------------------------------------------
9 //
10 // This file is part of Echo Digital Audio's generic driver library.
11 // Copyright Echo Digital Audio Corporation (c) 1998 - 2005
12 // All rights reserved
13 // www.echoaudio.com
14 //
15 // This library is free software; you can redistribute it and/or
16 // modify it under the terms of the GNU Lesser General Public
17 // License as published by the Free Software Foundation; either
18 // version 2.1 of the License, or (at your option) any later version.
19 //
20 // This library is distributed in the hope that it will be useful,
21 // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23 // Lesser General Public License for more details.
24 //
25 // You should have received a copy of the GNU Lesser General Public
26 // License along with this library; if not, write to the Free Software
27 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28 //
29 // ****************************************************************************
30 
31 #include "CEchoGals.h"
32 #include "CIndigoIODspCommObject.h"
33 
34 #ifdef ECHO_WDM
35 #pragma optimize("",off)
36 #endif
37 #include "IndigoIODSP.c"
38 
39 
40 //
41 //	Construction/destruction
42 //
43 CIndigoIODspCommObject::CIndigoIODspCommObject
44 (
45 	PDWORD		pdwRegBase,				// Virtual ptr to DSP registers
46 	PCOsSupport	pOsSupport
47 ) : CDspCommObjectVmixer( pdwRegBase, pOsSupport )
48 {
49 	strcpy( m_szCardName, "Indigo io" );
50 	m_pdwDspRegBase = pdwRegBase;		// Virtual addr DSP's register base
51 
52 	m_wNumPipesOut = 8;
53 	m_wNumPipesIn = 2;
54 	m_wNumBussesOut = 2;
55 	m_wNumBussesIn = 2;
56 	m_wFirstDigitalBusOut = m_wNumBussesOut;
57 	m_wFirstDigitalBusIn = m_wNumBussesIn;
58 
59 	m_fHasVmixer = TRUE;
60 
61 	m_wNumMidiOut = 0;					// # MIDI out channels
62 	m_wNumMidiIn = 0;						// # MIDI in  channels
63 
64 	m_pDspCommPage->dwSampleRate = SWAP( (DWORD) 44100 );
65 
66 	m_bHasASIC = FALSE;
67 
68 	m_pwDspCodeToLoad = pwIndigoioDSP;
69 
70 	m_byDigitalMode = DIGITAL_MODE_NONE;
71 
72 	//
73 	// Since this card has no ASIC, mark it as loaded so everything works OK
74 	//
75 	m_bASICLoaded = TRUE;
76 
77 }	// CIndigoIODspCommObject::CIndigoIODspCommObject( DWORD dwPhysRegBase )
78 
79 
80 CIndigoIODspCommObject::~CIndigoIODspCommObject()
81 {
82 }	// CIndigoIODspCommObject::~CIndigoIODspCommObject()
83 
84 
85 //
86 //	Save new clock settings and send to DSP.
87 //
88 ECHOSTATUS CIndigoIODspCommObject::SetInputClock(WORD wClock)
89 {
90 
91 	ECHO_DEBUGPRINTF( ("CIndigoIODspCommObject::SetInputClock:\n") );
92 	return ECHOSTATUS_CLOCK_NOT_SUPPORTED;
93 
94 }	// ECHOSTATUS CIndigoIODspCommObject::SetInputClock
95 
96 
97 //===========================================================================
98 //
99 // SetSampleRate
100 //
101 // Set the audio sample rate for IndigoIO
102 //
103 //===========================================================================
104 
105 DWORD CIndigoIODspCommObject::SetSampleRate( DWORD dwNewSampleRate )
106 {
107 	if ( !WaitForHandshake() )
108 		return 0xffffffff;
109 
110 	//
111 	// Set the value in the comm page
112 	//
113 	m_pDspCommPage->dwSampleRate = SWAP( dwNewSampleRate );
114 
115 	//
116 	//	Poke the DSP
117 	//
118 	ClearHandshake();
119 	SendVector( DSP_VC_UPDATE_CLOCKS );
120 
121 	return GetSampleRate();
122 
123 } // DWORD CIndigoIODspCommObject::SetSampleRate( DWORD dwNewSampleRate )
124 
125 // **** CIndigoIODspCommObject.cpp ****
126