1 // ****************************************************************************
5 // Implementation file for the CIndigoDJ driver class.
6 // Set editor tabs to 3 for your viewing pleasure.
8 // ----------------------------------------------------------------------------
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
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.
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.
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
29 // ****************************************************************************
31 #include "CIndigoDJ.h"
33 #define INDIGO_DJ_OUTPUT_LATENCY_SINGLE_SPEED 44
34 #define INDIGO_DJ_OUTPUT_LATENCY_DOUBLE_SPEED 37
37 /****************************************************************************
39 Construction and destruction
41 ****************************************************************************/
43 //===========================================================================
45 // Overload new & delete so memory for this object is allocated
46 // from non-paged memory.
48 //===========================================================================
50 PVOID
CIndigoDJ::operator new( size_t Size
)
55 Status
= OsAllocateNonPaged(Size
,&pMemory
);
57 if ( (ECHOSTATUS_OK
!= Status
) || (NULL
== pMemory
))
59 ECHO_DEBUGPRINTF(("CIndigoDJ::operator new - memory allocation failed\n"));
65 memset( pMemory
, 0, Size
);
70 } // PVOID CIndigoDJ::operator new( size_t Size )
73 VOID
CIndigoDJ::operator delete( PVOID pVoid
)
75 if ( ECHOSTATUS_OK
!= OsFreeNonPaged( pVoid
) )
77 ECHO_DEBUGPRINTF(("CIndigoDJ::operator delete memory free failed\n"));
79 } // VOID CIndigoDJ::operator delete( PVOID pVoid )
83 //===========================================================================
85 // Constructor and destructor
87 //===========================================================================
89 CIndigoDJ::CIndigoDJ( PCOsSupport pOsSupport
)
90 : CIndigo( pOsSupport
)
92 ECHO_DEBUGPRINTF( ( "CIndigoDJ::CIndigoDJ() is born!\n" ) );
95 CIndigoDJ::~CIndigoDJ()
97 ECHO_DEBUGPRINTF( ( "CIndigoDJ::~CIndigoDJ() is toast!\n" ) );
102 //===========================================================================
104 // Every card has an InitHw method
106 //===========================================================================
108 ECHOSTATUS
CIndigoDJ::InitHw()
113 // Call the base method
115 if ( ECHOSTATUS_OK
!= ( Status
= CEchoGals::InitHw() ) )
119 // Create the DSP comm object
121 m_pDspCommObject
= new CIndigoDJDspCommObject( (PDWORD
) m_pvSharedMemory
,
123 if (NULL
== m_pDspCommObject
)
125 ECHO_DEBUGPRINTF(("CIndigoDJ::InitHw - could not create DSP comm object\n"));
126 return ECHOSTATUS_NO_MEM
;
132 GetDspCommObject()->LoadFirmware();
133 if ( GetDspCommObject()->IsBoardBad() )
134 return ECHOSTATUS_DSP_DEAD
;
139 m_wFlags
&= ~ECHOGALS_FLAG_BADBOARD
;
140 m_wFlags
|= ECHOGALS_ROFLAG_SUPER_INTERLEAVE_OK
;
143 // Must call this here after DSP is init to
144 // init gains and mutes
146 Status
= InitLineLevels();
147 if ( ECHOSTATUS_OK
!= Status
)
151 // Get default sample rate from DSP
153 m_dwSampleRate
= GetDspCommObject()->GetSampleRate();
155 ECHO_DEBUGPRINTF( ( "CIndigo::InitHw()\n" ) );
158 } // ECHOSTATUS CIndigo::InitHw()
161 //===========================================================================
163 // GetAudioLatency - returns the latency for a single pipe
165 //===========================================================================
167 void CIndigoDJ::GetAudioLatency(ECHO_AUDIO_LATENCY
*pLatency
)
172 dwSampleRate
= GetDspCommObject()->GetSampleRate();
173 if (FALSE
== pLatency
->wIsInput
)
176 // The latency depends on the current sample rate
178 if (dwSampleRate
< 50000)
179 dwLatency
= INDIGO_DJ_OUTPUT_LATENCY_SINGLE_SPEED
;
181 dwLatency
= INDIGO_DJ_OUTPUT_LATENCY_DOUBLE_SPEED
;
186 // Inputs? What inputs?
191 pLatency
->dwLatency
= dwLatency
;
196 // *** CIndigoDJ.cpp ***