Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

171 lines
5.5 KiB

  1. /*++
  2. Copyright (c) 1997-2000 Microsoft Corporation All Rights Reserved
  3. Module Name:
  4. basewave.h
  5. Abstract:
  6. Definition of base wavecyclic and wavecyclic stream class.
  7. --*/
  8. #ifndef _MSVAD_BASEWAVE_H_
  9. #define _MSVAD_BASEWAVE_H_
  10. #include "savedata.h"
  11. //=============================================================================
  12. // Referenced Forward
  13. //=============================================================================
  14. void
  15. TimerNotify
  16. (
  17. IN PKDPC Dpc,
  18. IN PVOID DeferredContext,
  19. IN PVOID SA1,
  20. IN PVOID SA2
  21. );
  22. class CMiniportWaveCyclicStreamMSVAD;
  23. typedef CMiniportWaveCyclicStreamMSVAD *PCMiniportWaveCyclicStreamMSVAD;
  24. //=============================================================================
  25. // Classes
  26. //=============================================================================
  27. ///////////////////////////////////////////////////////////////////////////////
  28. // CMiniportWaveCyclicMSVAD
  29. // This is the common base class for all MSVAD samples. It implements basic
  30. // functionality.
  31. class CMiniportWaveCyclicMSVAD
  32. {
  33. protected:
  34. PADAPTERCOMMON m_AdapterCommon; // Adapter common object
  35. PPORTWAVECYCLIC m_Port; // Callback interface
  36. PPCFILTER_DESCRIPTOR m_FilterDescriptor; // Filter descriptor
  37. ULONG m_NotificationInterval; // milliseconds.
  38. ULONG m_SamplingFrequency; // Frames per second.
  39. PSERVICEGROUP m_ServiceGroup; // For notification.
  40. KMUTEX m_SampleRateSync; // Sync for sample rate
  41. ULONG m_MaxDmaBufferSize; // Dma buffer size.
  42. // All the below members should be updated by the child classes
  43. //
  44. ULONG m_MaxOutputStreams; // Max stream caps
  45. ULONG m_MaxInputStreams;
  46. ULONG m_MaxTotalStreams;
  47. ULONG m_MinChannels; // Format caps
  48. ULONG m_MaxChannelsPcm;
  49. ULONG m_MinBitsPerSamplePcm;
  50. ULONG m_MaxBitsPerSamplePcm;
  51. ULONG m_MinSampleRatePcm;
  52. ULONG m_MaxSampleRatePcm;
  53. protected:
  54. NTSTATUS ValidateFormat
  55. (
  56. IN PKSDATAFORMAT pDataFormat
  57. );
  58. NTSTATUS ValidatePcm
  59. (
  60. IN PWAVEFORMATEX pWfx
  61. );
  62. public:
  63. CMiniportWaveCyclicMSVAD();
  64. ~CMiniportWaveCyclicMSVAD();
  65. STDMETHODIMP GetDescription
  66. (
  67. OUT PPCFILTER_DESCRIPTOR *Description
  68. );
  69. STDMETHODIMP Init
  70. ( IN PUNKNOWN UnknownAdapter,
  71. IN PRESOURCELIST ResourceList,
  72. IN PPORTWAVECYCLIC Port
  73. );
  74. NTSTATUS PropertyHandlerCpuResources
  75. (
  76. IN PPCPROPERTY_REQUEST PropertyRequest
  77. );
  78. NTSTATUS PropertyHandlerGeneric
  79. (
  80. IN PPCPROPERTY_REQUEST PropertyRequest
  81. );
  82. // Friends
  83. friend class CMiniportWaveCyclicStreamMSVAD;
  84. friend class CMiniportTopologyMSVAD;
  85. friend void TimerNotify
  86. (
  87. IN PKDPC Dpc,
  88. IN PVOID DeferredContext,
  89. IN PVOID SA1,
  90. IN PVOID SA2
  91. );
  92. };
  93. typedef CMiniportWaveCyclicMSVAD *PCMiniportWaveCyclicMSVAD;
  94. ///////////////////////////////////////////////////////////////////////////////
  95. // CMiniportWaveCyclicStreamMSVAD
  96. // This is the common base class for all MSVAD samples. It implements basic
  97. // functionality for wavecyclic streams.
  98. class CMiniportWaveCyclicStreamMSVAD :
  99. public IMiniportWaveCyclicStream,
  100. public IDmaChannel
  101. {
  102. protected:
  103. PCMiniportWaveCyclicMSVAD m_pMiniport; // Miniport that created us
  104. BOOLEAN m_fCapture; // Capture or render.
  105. BOOLEAN m_fFormat16Bit; // 16- or 8-bit samples.
  106. BOOLEAN m_fFormatStereo; // Two or one channel.
  107. KSSTATE m_ksState; // Stop, pause, run.
  108. ULONG m_ulPin; // Pin Id.
  109. PRKDPC m_pDpc; // Deferred procedure call object
  110. PKTIMER m_pTimer; // Timer object
  111. BOOLEAN m_fDmaActive; // Dma currently active?
  112. ULONG m_ulDmaPosition; // Position in Dma
  113. PVOID m_pvDmaBuffer; // Dma buffer pointer
  114. ULONG m_ulDmaBufferSize; // Size of dma buffer
  115. ULONG m_ulDmaMovementRate;// Rate of transfer specific to system
  116. ULONGLONG m_ullDmaTimeStamp; // Dma time elasped
  117. CSaveData m_SaveData; // Object to save settings.
  118. public:
  119. CMiniportWaveCyclicStreamMSVAD();
  120. ~CMiniportWaveCyclicStreamMSVAD();
  121. IMP_IMiniportWaveCyclicStream;
  122. IMP_IDmaChannel;
  123. NTSTATUS Init
  124. (
  125. IN PCMiniportWaveCyclicMSVAD Miniport,
  126. IN ULONG Pin,
  127. IN BOOLEAN Capture,
  128. IN PKSDATAFORMAT DataFormat
  129. );
  130. // Friends
  131. friend class CMiniportWaveCyclicMSVAD;
  132. };
  133. typedef CMiniportWaveCyclicStreamMSVAD *PCMiniportWaveCyclicStreamMSVAD;
  134. #endif