Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenminwave.hpp
Go to the documentation of this file.
00001 /* 00002 Copyright (c) 2006-2007 dogbert <dogber1@gmail.com> 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without 00006 modification, are permitted provided that the following conditions 00007 are met: 00008 1. Redistributions of source code must retain the above copyright 00009 notice, this list of conditions and the following disclaimer. 00010 2. Redistributions in binary form must reproduce the above copyright 00011 notice, this list of conditions and the following disclaimer in the 00012 documentation and/or other materials provided with the distribution. 00013 3. The name of the author may not be used to endorse or promote products 00014 derived from this software without specific prior written permission. 00015 00016 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 00017 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00018 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 00019 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 00020 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00021 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00022 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00023 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00024 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 00025 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 */ 00027 00028 #ifndef _MINWAVE_HPP_ 00029 #define _MINWAVE_HPP_ 00030 00031 #define PC_IMPLEMENTATION // for the implementation of IDMAChannel 00032 00033 #include "common.hpp" 00034 #include "property.h" 00035 00036 class CMiniportWaveStreamCMI; 00037 00038 class CMiniportWaveCMI: 00039 #ifdef WAVERT 00040 public IMiniportWaveRT, 00041 #else 00042 public IMiniportWaveCyclic, 00043 #endif 00044 public IMiniportWaveCMI 00045 { 00046 private: 00047 PCMIADAPTER CMIAdapter; // Adapter common object. 00048 #ifdef WAVERT 00049 PPORTWAVERT Port; 00050 #else 00051 PPORTWAVECYCLIC Port; 00052 PDMACHANNEL DMAChannel[3]; 00053 UInt32 notificationInterval; 00054 #endif 00055 CMI8738Info *cm; 00056 UInt32 requestedChannelCount; 00057 UInt32 requestedChannelMask; 00058 LONG m_Ref; 00059 00060 CMiniportWaveStreamCMI *stream[3]; 00061 bool isStreamRunning[3]; 00062 KMUTEX mutex; 00063 00064 NTSTATUS processResources(PRESOURCELIST resourceList); 00065 00066 NTSTATUS isFormatAllowed(UInt32 sampleRate, BOOLEAN multiChan, BOOLEAN AC3); 00067 NTSTATUS validateFormat(PKSDATAFORMAT format, ULONG PinID, BOOLEAN capture); 00068 #ifndef WAVERT 00069 NTSTATUS newDMAChannel(PDMACHANNEL *dmaChannel, UInt32 bufferLength); 00070 #endif 00071 NTSTATUS loadChannelConfigFromRegistry(); 00072 NTSTATUS storeChannelConfigToRegistry(); 00073 public: 00074 STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface); 00075 STDMETHODIMP_(ULONG) AddRef() 00076 { 00077 InterlockedIncrement(&m_Ref); 00078 return m_Ref; 00079 } 00080 STDMETHODIMP_(ULONG) Release() 00081 { 00082 InterlockedDecrement(&m_Ref); 00083 00084 if (!m_Ref) 00085 { 00086 delete this; 00087 return 0; 00088 } 00089 return m_Ref; 00090 } 00091 CMiniportWaveCMI(IUnknown * OuterUnknown){} 00092 ~CMiniportWaveCMI(); 00093 #ifdef WAVERT 00094 IMP_IMiniportWaveRT; 00095 #else 00096 IMP_IMiniportWaveCyclic; 00097 #endif 00098 00099 STDMETHODIMP_(void) ServiceWaveISR(UInt32 streamIndex); 00100 STDMETHODIMP_(void) powerUp(); 00101 STDMETHODIMP_(void) powerDown(); 00102 00103 friend NTSTATUS NTAPI PropertyHandler_ChannelConfig(PPCPROPERTY_REQUEST PropertyRequest); 00104 friend class CMiniportWaveStreamCMI; 00105 }; 00106 00107 00108 class CMiniportWaveStreamCMI: 00109 #ifdef WAVERT 00110 public IMiniportWaveRTStream, 00111 #else 00112 public IMiniportWaveCyclicStream, 00113 #endif 00114 public IDrmAudioStream 00115 { 00116 private: 00117 CMiniportWaveCMI *Miniport; 00118 #ifdef WAVERT 00119 PPORTWAVERTSTREAM Port; 00120 PMDL audioBufferMDL; 00121 UInt32 dmaAddress; 00122 UInt32 dmaMemorySize; 00123 #else 00124 PDMACHANNEL DMAChannel; 00125 PSERVICEGROUP ServiceGroup; // For notification. 00126 #endif 00127 00128 bool isCaptureStream;// Capture or render. 00129 UInt32 streamIndex; 00130 UInt32 channelNumber; // hardware channel number: 0/A or 1/B 00131 KSSTATE state; // Stop, pause, run. 00132 UInt32 periodSize; // process n frames until the interrupt is fired in frames, NOT in bytes 00133 UInt32 dmaSize; // size of the DMA buffer in frames, NOT in bytes 00134 UInt32 currentChannelCount, currentSampleRate, currentResolution; 00135 bool enableAC3Passthru, enableSPDIF; 00136 LONG m_Ref; 00137 00138 NTSTATUS prepareStream(); 00139 NTSTATUS setDACChannels(); 00140 NTSTATUS setupSPDIFPlayback(bool enableSPDIF); 00141 NTSTATUS setupAC3Passthru(); 00142 00143 public: 00144 STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface); 00145 STDMETHODIMP_(ULONG) AddRef() 00146 { 00147 InterlockedIncrement(&m_Ref); 00148 return m_Ref; 00149 } 00150 STDMETHODIMP_(ULONG) Release() 00151 { 00152 InterlockedDecrement(&m_Ref); 00153 00154 if (!m_Ref) 00155 { 00156 delete this; 00157 return 0; 00158 } 00159 return m_Ref; 00160 } 00161 CMiniportWaveStreamCMI(IUnknown * OuterUnknown){} 00162 ~CMiniportWaveStreamCMI(); 00163 #ifdef WAVERT 00164 IMP_IMiniportWaveRTStream; 00165 #else 00166 IMP_IMiniportWaveCyclicStream; 00167 #endif 00168 00169 IMP_IDrmAudioStream; 00170 00171 #ifdef WAVERT 00172 NTSTATUS Init(CMiniportWaveCMI* Miniport_, UInt32 streamIndex_, bool isCaptureStream_, PKSDATAFORMAT DataFormat, PPORTWAVERTSTREAM PortStream_); 00173 #else 00174 NTSTATUS Init(CMiniportWaveCMI* Miniport_, UInt32 streamIndex_, bool isCaptureStream_, PKSDATAFORMAT DataFormat, PDMACHANNEL DMAChannel_, PSERVICEGROUP* OutServiceGroup); 00175 #endif 00176 friend class CMiniportWaveCMI; 00177 }; 00178 00179 NTSTATUS CreateMiniportWaveStreamCMI(CMiniportWaveStreamCMI **MiniportWaveStreamCMI, PUNKNOWN pUnknownOuter, POOL_TYPE PoolType); 00180 00181 #endif //_MINWAVE_HPP_ Generated on Sun May 27 2012 04:28:39 for ReactOS by
1.7.6.1
|