ReactOS 0.4.15-dev-7942-gd23573b
CMiniportWaveCyclicStream Class Reference

#include <wavecyclicstream.h>

Inheritance diagram for CMiniportWaveCyclicStream:
Collaboration diagram for CMiniportWaveCyclicStream:

Public Member Functions

 DECLARE_STD_UNKNOWN ()
 
 DEFINE_STD_CONSTRUCTOR (CMiniportWaveCyclicStream)
 
 ~CMiniportWaveCyclicStream ()
 
NTSTATUS Init_ ()
 
void InterruptServiceRoutine ()
 
- Public Member Functions inherited from CMiniportStream
 ~CMiniportStream ()
 
void ResetDMA (void)
 
void PauseDMA (void)
 
void ResumeDMA (ULONG state=DMA_ENGINE_ON)
 
int GetBuffPos (DWORD *buffPos)
 
void WriteReg8 (ULONG addr, UCHAR data)
 
void WriteReg16 (ULONG addr, USHORT data)
 
void WriteReg32 (ULONG addr, ULONG data)
 
UCHAR ReadReg8 (ULONG addr)
 
USHORT ReadReg16 (ULONG addr)
 
ULONG ReadReg32 (ULONG addr)
 
 STDMETHODIMP_ (NTSTATUS) SetFormat(_In_ PKSDATAFORMAT Format)
 
void PowerChangeNotify (IN POWER_STATE NewState)
 
virtual void PowerChangeNotify_ (IN POWER_STATE NewState)
 
ULONG GetCurrentSampleRate (void)
 
NTSTATUS Init (IN CMiniport *Miniport_, IN PUNKNOWN PortStream, IN WavePins Pin_, IN BOOLEAN Capture_, IN PKSDATAFORMAT DataFormat_, OUT PSERVICEGROUP *ServiceGroup_)
 
virtual void InterruptServiceRoutine () PURE
 
virtual NTSTATUS Init_ () PURE
 
NTSTATUS NonDelegatingQueryInterface (_In_ REFIID Interface, _COM_Outptr_ PVOID *Object, _In_ REFIID iStream, _In_ PUNKNOWN stream)
 
NTSTATUS SetState (_In_ KSSTATE State)
 
NTSTATUS NormalizePhysicalPosition (_Inout_ PLONGLONG PhysicalPosition)
 
PVOID BDList_Alloc ()
 
void BDList_Free ()
 
void UpdateLviCyclic ()
 

Public Attributes

 IMP_IMiniportWaveCyclicStream
 
- Public Attributes inherited from CUnknown
union {
   IUnknown   IUnknown
 
   INonDelegatingUnknown   INonDelegatingUnknown
 
}; 
 
LONG m_ref_count
 
PUNKNOWN m_outer_unknown
 
- Public Attributes inherited from CMiniportStream
CMiniportMiniport
 
WavePins Pin
 
BOOL Capture
 
WORD NumberOfChannels
 
DEVICE_POWER_STATE m_PowerState
 
PPORTSTREAM_ PortStream
 
PKSDATAFORMAT_WAVEFORMATEX DataFormat
 
PSERVICEGROUP ServiceGroup
 
ULONG CurrentRate
 
ULONG DMAEngineState
 
ULONG m_ulBDAddr
 
PHYSICAL_ADDRESS BDList_PhysAddr
 
tBDEntryBDList
 
 IMP_IDrmAudioStream
 

Private Member Functions

CMiniportWaveCyclicWave ()
 
NTSTATUS ResizeBuffer (void)
 

Private Attributes

DWORD m_bufferSize
 

Detailed Description

Definition at line 61 of file wavecyclicstream.h.

Constructor & Destructor Documentation

◆ ~CMiniportWaveCyclicStream()

CMiniportWaveCyclicStream::~CMiniportWaveCyclicStream ( )

Definition at line 74 of file wavecyclicstream.cpp.

75{
76 PAGED_CODE ();
77
78
79 DOUT (DBG_PRINT, ("[CMiniportWaveCyclicStream::~CMiniportWaveCyclicStream]"));
80
81 // Release the scatter/gather table.
83}
#define PAGED_CODE()
void BDList_Free()
Definition: stream2.cpp:25
#define DOUT(lvl, strings)
Definition: debug.h:82
#define DBG_PRINT(ppi, ch, level)
Definition: win32kdebug.h:168

Member Function Documentation

◆ DECLARE_STD_UNKNOWN()

CMiniportWaveCyclicStream::DECLARE_STD_UNKNOWN ( )

◆ DEFINE_STD_CONSTRUCTOR()

CMiniportWaveCyclicStream::DEFINE_STD_CONSTRUCTOR ( CMiniportWaveCyclicStream  )

◆ Init_()

NTSTATUS CMiniportWaveCyclicStream::Init_ ( )
virtual

Reimplemented from CMiniportStream.

Definition at line 92 of file wavecyclicstream.cpp.

93{
94 PAGED_CODE ();
95
96 DOUT (DBG_PRINT, ("[CMiniportWaveCyclicStream::Init]"));
97
98 //
99 // Setup the Buffer Descriptor List (BDL)
100 // Allocate 32 entries of 8 bytes (one BDL entry).
101 // The pointer is aligned on a 8 byte boundary (that's what we need).
102 //
103
104 if (!BDList_Alloc())
105 {
106 DOUT (DBG_ERROR, ("Failed AllocateCommonBuffer!"));
108 }
109
110 return ResizeBuffer();
111}
PVOID BDList_Alloc()
Definition: stream2.cpp:11
#define DBG_ERROR
Definition: nfs41_debug.h:78
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158

◆ InterruptServiceRoutine()

void CMiniportWaveCyclicStream::InterruptServiceRoutine ( )
virtual

Reimplemented from CMiniportStream.

Definition at line 219 of file wavecyclicstream.cpp.

220{
221 //
222 // Update the LVI so that we cycle around in the scatter gather list.
223 //
225
226 //
227 // Request DPC service for PCM out.
228 //
229 Miniport->Port->Notify (ServiceGroup);
230}
CMiniport * Miniport
Definition: stream.h:42
void UpdateLviCyclic()
Definition: stream.h:172
PSERVICEGROUP ServiceGroup
Definition: stream.h:55
PPORT_ Port
Definition: miniport.h:30

◆ ResizeBuffer()

NTSTATUS CMiniportWaveCyclicStream::ResizeBuffer ( void  )
private

Definition at line 124 of file wavecyclicstream.cpp.

125{
126 // calculate buffer size
127 DWORD nSamples = DataFormat->WaveFormatEx.nSamplesPerSec * BUFFERTIME / 1000;
128 DWORD bufferSize = DataFormat->WaveFormatEx.nBlockAlign * nSamples;
129 DWORD totalSize = bufferSize * NBUFFERS;
130
131 // allocate buffer
132 PDMACHANNEL DmaChannel = Miniport->DmaChannel;
133 DWORD allocSize = DmaChannel->AllocatedBufferSize();
134 if(totalSize > allocSize)
135 {
136 DmaChannel->FreeBuffer();
137 NTSTATUS ntStatus = DmaChannel->AllocateBuffer(totalSize, 0);
138 if (!NT_SUCCESS (ntStatus)) {
139 m_bufferSize = 0;
140 return ntStatus;
141 }
142 }
143
144 DmaChannel->SetBufferSize(totalSize);
145
146 // initialize bdList
147 DWORD addr = DmaChannel->PhysicalAddress().LowPart;
148 for (UINT loop = 0; loop < MAX_BDL_ENTRIES; loop++)
149 {
150 BDList[loop].dwPtrToPhyAddress = addr + bufferSize * (loop % NBUFFERS);
151 BDList[loop].wLength = (WORD)bufferSize/2;
153 }
154
155 // update buffer size
157 return STATUS_SUCCESS;
158}
LONG NTSTATUS
Definition: precomp.h:26
tBDEntry * BDList
Definition: stream.h:61
PDMACHANNEL DmaChannel
Definition: miniport.h:33
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
size_t bufferSize
GLenum const GLvoid * addr
Definition: glext.h:9621
const USHORT IOC_ENABLE
Definition: ichreg.h:103
const USHORT BUP_SET
Definition: ichreg.h:104
unsigned int UINT
Definition: ndis.h:50
IDmaChannel * PDMACHANNEL
Definition: portcls.h:784
const int MAX_BDL_ENTRIES
Definition: rtstream.h:24
#define STATUS_SUCCESS
Definition: shellext.h:65
WORD wPolicyBits
Definition: stream.h:33
WORD wLength
Definition: stream.h:32
DWORD dwPtrToPhyAddress
Definition: stream.h:31
#define BUFFERTIME
#define NBUFFERS

Referenced by Init_(), and STDMETHODIMP_().

◆ Wave()

CMiniportWaveCyclic * CMiniportWaveCyclicStream::Wave ( )
inlineprivate

Definition at line 76 of file wavecyclicstream.h.

Member Data Documentation

◆ IMP_IMiniportWaveCyclicStream

CMiniportWaveCyclicStream::IMP_IMiniportWaveCyclicStream

Definition at line 100 of file wavecyclicstream.h.

◆ m_bufferSize

DWORD CMiniportWaveCyclicStream::m_bufferSize
private

Definition at line 66 of file wavecyclicstream.h.

Referenced by ResizeBuffer(), and STDMETHODIMP_().


The documentation for this class was generated from the following files: