ReactOS 0.4.16-dev-297-gc569aee
minwave.cpp File Reference
#include "minwave.hpp"
#include "minwavetables.hpp"
#include "ntddk.h"
Include dependency graph for minwave.cpp:

Go to the source code of this file.

Functions

NTSTATUS NTAPI CreateMiniportWaveCMI (PUNKNOWN *Unknown, REFCLSID, PUNKNOWN UnknownOuter, POOL_TYPE PoolType)
 
 STDMETHODIMP_ (void) CMiniportWaveCMI
 
NTSTATUS NTAPI PropertyHandler_ChannelConfig (PPCPROPERTY_REQUEST PropertyRequest)
 
NTSTATUS CreateMiniportWaveStreamCMI (CMiniportWaveStreamCMI **MiniportWaveStreamCMI, PUNKNOWN pUnknownOuter, POOL_TYPE PoolType)
 
 STDMETHODIMP_ (NTSTATUS) CMiniportWaveStreamCMI
 
 STDMETHODIMP_ (ULONG) CMiniportWaveStreamCMI
 

Function Documentation

◆ CreateMiniportWaveCMI()

NTSTATUS NTAPI CreateMiniportWaveCMI ( PUNKNOWN Unknown,
REFCLSID  ,
PUNKNOWN  UnknownOuter,
POOL_TYPE  PoolType 
)

Definition at line 36 of file minwave.cpp.

37{
38 PAGED_CODE();
40#ifdef WAVERT
41 STD_CREATE_BODY_(CMiniportWaveCMI,Unknown,UnknownOuter,PoolType,PMINIPORTWAVERT);
42#else
43 STD_CREATE_BODY_(CMiniportWaveCMI,Unknown,UnknownOuter,PoolType,PMINIPORTWAVECYCLIC);
44#endif
45}
#define PAGED_CODE()
@ Unknown
Definition: i8042prt.h:114
#define ASSERT(a)
Definition: mode.c:44
IMiniportWaveCyclic * PMINIPORTWAVECYCLIC
Definition: portcls.h:1543
IMiniportWaveRT * PMINIPORTWAVERT
Definition: portcls.h:1983
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3815

◆ CreateMiniportWaveStreamCMI()

NTSTATUS CreateMiniportWaveStreamCMI ( CMiniportWaveStreamCMI **  MiniportWaveStreamCMI,
PUNKNOWN  pUnknownOuter,
POOL_TYPE  PoolType 
)

Definition at line 906 of file minwave.cpp.

907{
908 PAGED_CODE();
909 DBGPRINT(("CreateMiniportWaveStreamCMI"));
910
911#ifdef WAVERT
912 *MiniportWaveStreamCMI = new (PoolType, 'gnaa') CMiniportWaveStreamCMI(NULL);
913#else
914 *MiniportWaveStreamCMI = new (PoolType, 'gnaa') CMiniportWaveStreamCMI(pUnknownOuter);
915#endif
916 if (*MiniportWaveStreamCMI) {
917 (*MiniportWaveStreamCMI)->AddRef();
918 return STATUS_SUCCESS;
919 }
920
922}
#define DBGPRINT(...)
Definition: pdo.c:21
#define NULL
Definition: types.h:112
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158

◆ PropertyHandler_ChannelConfig()

NTSTATUS NTAPI PropertyHandler_ChannelConfig ( PPCPROPERTY_REQUEST  PropertyRequest)

Definition at line 847 of file minwave.cpp.

848{
849 PAGED_CODE();
850 ASSERT(PropertyRequest);
851 DBGPRINT(("[PropertyHandler_ChannelConfig]"));
852
853#ifdef WAVERT
854 CMiniportWaveCMI *that = (CMiniportWaveCMI *) ((PMINIPORTWAVERT)PropertyRequest->MajorTarget);
855#else
857#endif
858
859 if (PropertyRequest->Node == KSNODE_WAVE_DAC) {
860
861 if (PropertyRequest->ValueSize == 0) {
862 PropertyRequest->ValueSize = sizeof(LONG);
864 } else if (PropertyRequest->ValueSize < sizeof (LONG)) {
865 PropertyRequest->ValueSize = 0;
867 }
868
869 if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
870 *(PLONG)PropertyRequest->Value = that->requestedChannelMask;
871 PropertyRequest->ValueSize = sizeof(ULONG);
872 return STATUS_SUCCESS;
873 } else if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
874 if (*(PLONG)PropertyRequest->Value == KSAUDIO_SPEAKER_7POINT1) {
875 that->requestedChannelMask = *(PLONG)PropertyRequest->Value;
876 that->requestedChannelCount = 8;
877 return STATUS_SUCCESS;
878 }
879 if (*(PLONG)PropertyRequest->Value == KSAUDIO_SPEAKER_5POINT1) {
880 that->requestedChannelMask = *(PLONG)PropertyRequest->Value;
881 that->requestedChannelCount = 6;
882 return STATUS_SUCCESS;
883 }
884 if ((*(PLONG)PropertyRequest->Value == KSAUDIO_SPEAKER_QUAD) || (*(PLONG)PropertyRequest->Value == KSAUDIO_SPEAKER_SURROUND)) {
885 that->requestedChannelMask = *(PLONG)PropertyRequest->Value;
886 that->requestedChannelCount = 4;
887 return STATUS_SUCCESS;
888 }
889 if (*(PLONG)PropertyRequest->Value == KSAUDIO_SPEAKER_STEREO) {
890 that->requestedChannelMask = *(PLONG)PropertyRequest->Value;
891 that->requestedChannelCount = 2;
892 return STATUS_SUCCESS;
893 }
894 } else if (PropertyRequest->Verb & KSPROPERTY_TYPE_BASICSUPPORT) {
895 PULONG AccessFlags = PULONG(PropertyRequest->Value);
897 PropertyRequest->ValueSize = sizeof(ULONG);
898 return STATUS_SUCCESS;
899 }
900 }
902}
UInt32 requestedChannelMask
Definition: minwave.hpp:58
UInt32 requestedChannelCount
Definition: minwave.hpp:57
@ KSNODE_WAVE_DAC
Definition: interfaces.hpp:464
#define KSPROPERTY_TYPE_SET
Definition: dmksctrl.h:43
#define KSPROPERTY_TYPE_BASICSUPPORT
Definition: dmksctrl.h:45
#define KSPROPERTY_TYPE_GET
Definition: dmksctrl.h:42
#define KSAUDIO_SPEAKER_SURROUND
Definition: ksmedia.h:1457
#define KSAUDIO_SPEAKER_5POINT1
Definition: ksmedia.h:1459
#define KSAUDIO_SPEAKER_QUAD
Definition: ksmedia.h:1455
#define KSAUDIO_SPEAKER_STEREO
Definition: ksmedia.h:1454
#define KSAUDIO_SPEAKER_7POINT1
Definition: ksmedia.h:1462
long LONG
Definition: pedump.c:60
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
PUNKNOWN MajorTarget
Definition: portcls.h:258
uint32_t * PULONG
Definition: typedefs.h:59
int32_t * PLONG
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

◆ STDMETHODIMP_() [1/3]

STDMETHODIMP_ ( NTSTATUS  )

Definition at line 1371 of file minwave.cpp.

1372{
1373 PAGED_CODE();
1374 DBGPRINT(("CMiniportWaveStreamCMI[%p]::SetContentId(%d, %p)", this, contentId, drmRights));
1375
1376 return STATUS_SUCCESS;
1377}

◆ STDMETHODIMP_() [2/3]

STDMETHODIMP_ ( ULONG  )

Definition at line 1666 of file minwave.cpp.

1667{
1668 Miniport->notificationInterval = Interval;
1669
1670 if (state == KSSTATE_RUN) {
1671 return 0;
1672 }
1673 // periodSize [sample] = interval [ms] * sample rate [Hz] * 1e-3 [milli]
1674 periodSize = Interval * currentSampleRate / 1000;
1675 // FramingSize [byte] = periodSize [sample] * #Channels * resolution [byte];
1676 *FramingSize = periodSize * currentChannelCount * (currentResolution >> 3);
1677
1678 KeWaitForSingleObject(&Miniport->mutex, Executive, KernelMode, FALSE, NULL);
1679 Miniport->CMIAdapter->writeUInt16((channelNumber ? REG_CH1_FRAME2 : REG_CH0_FRAME2) + 2, periodSize-1);
1680 KeReleaseMutex(&Miniport->mutex, FALSE);
1681
1682 DBGPRINT(("periodSize: %x, FramingSize: %x", periodSize, *FramingSize));
1683 return Interval;
1684}
static int state
Definition: maze.c:121
#define REG_CH1_FRAME2
Definition: cmireg.hpp:155
#define REG_CH0_FRAME2
Definition: cmireg.hpp:153
#define FALSE
Definition: types.h:117
int currentChannelCount
Definition: main.h:80
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
@ KSSTATE_RUN
Definition: ks.h:1218
#define KernelMode
Definition: asm.h:34
DWORD Interval
Definition: netstat.c:30
LONG NTAPI KeReleaseMutex(IN PKMUTEX Mutex, IN BOOLEAN Wait)
Definition: mutex.c:189
@ Executive
Definition: ketypes.h:415

◆ STDMETHODIMP_() [3/3]

STDMETHODIMP_ ( void  )

Definition at line 342 of file minwave.cpp.

343{
344 PAGED_CODE();
345 DBGPRINT(("CMiniportWaveCMI[%p]::powerUp()", this));
346 KSSTATE oldState[3];
347
348 for (int i=0;i<3;i++) {
349 if (isStreamRunning[i]) {
350 oldState[i] = stream[i]->state;
351 stream[i]->SetState(KSSTATE_STOP);
352 }
353 }
354
355 if (cm->TopoMiniport) {
356 cm->TopoMiniport->loadMixerSettingsFromMemory();
357 }
358
359 for (int i=0;i<3;i++) {
360 if (isStreamRunning[i]) {
361 stream[i]->prepareStream();
362 stream[i]->SetState(KSSTATE_ACQUIRE);
363 stream[i]->SetState(oldState[i]);
364 }
365 }
366}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
KSSTATE
Definition: ks.h:1214
@ KSSTATE_ACQUIRE
Definition: ks.h:1216
@ KSSTATE_STOP
Definition: ks.h:1215
Definition: parse.h:23