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.

247 lines
3.8 KiB

  1. /*++
  2. Copyright (c) 1997-2000 Microsoft Corporation All Rights Reserved
  3. Module Name:
  4. hw.cpp
  5. Abstract:
  6. Implementation of MSVAD HW class.
  7. MSVAD HW has an array for storing mixer and volume settings
  8. for the topology.
  9. --*/
  10. #include <msvad.h>
  11. #include "hw.h"
  12. //=============================================================================
  13. // CMSVADHW
  14. //=============================================================================
  15. //=============================================================================
  16. #pragma code_seg("PAGE")
  17. CMSVADHW::CMSVADHW()
  18. : m_ulMux(0)
  19. /*++
  20. Routine Description:
  21. Constructor for MSVADHW.
  22. Arguments:
  23. Return Value:
  24. void
  25. --*/
  26. {
  27. PAGED_CODE();
  28. MixerReset();
  29. } // CMSVADHW
  30. #pragma code_seg()
  31. //=============================================================================
  32. BOOL
  33. CMSVADHW::GetMixerMute
  34. (
  35. IN ULONG ulNode
  36. )
  37. /*++
  38. Routine Description:
  39. Gets the HW (!) mute levels for MSVAD
  40. Arguments:
  41. ulNode - topology node id
  42. Return Value:
  43. mute setting
  44. --*/
  45. {
  46. if (ulNode < MAX_TOPOLOGY_NODES)
  47. {
  48. return m_MuteControls[ulNode];
  49. }
  50. return 0;
  51. } // GetMixerMute
  52. //=============================================================================
  53. ULONG
  54. CMSVADHW::GetMixerMux()
  55. /*++
  56. Routine Description:
  57. Return the current mux selection
  58. Arguments:
  59. Return Value:
  60. ULONG
  61. --*/
  62. {
  63. return m_ulMux;
  64. } // GetMixerMux
  65. //=============================================================================
  66. LONG
  67. CMSVADHW::GetMixerVolume
  68. (
  69. IN ULONG ulNode,
  70. IN LONG lChannel
  71. )
  72. /*++
  73. Routine Description:
  74. Gets the HW (!) volume for MSVAD.
  75. Arguments:
  76. ulNode - topology node id
  77. lChannel - which channel are we setting?
  78. Return Value:
  79. LONG - volume level
  80. --*/
  81. {
  82. if (ulNode < MAX_TOPOLOGY_NODES)
  83. {
  84. return m_VolumeControls[ulNode];
  85. }
  86. return 0;
  87. } // GetMixerVolume
  88. //=============================================================================
  89. #pragma code_seg("PAGE")
  90. void
  91. CMSVADHW::MixerReset()
  92. /*++
  93. Routine Description:
  94. Resets the mixer registers.
  95. Arguments:
  96. Return Value:
  97. void
  98. --*/
  99. {
  100. PAGED_CODE();
  101. RtlFillMemory(m_VolumeControls, sizeof(LONG) * MAX_TOPOLOGY_NODES, 0xFF);
  102. RtlFillMemory(m_MuteControls, sizeof(BOOL) * MAX_TOPOLOGY_NODES, TRUE);
  103. // BUGBUG change this depending on the topology
  104. m_ulMux = 2;
  105. } // MixerReset
  106. #pragma code_seg()
  107. //=============================================================================
  108. void
  109. CMSVADHW::SetMixerMute
  110. (
  111. IN ULONG ulNode,
  112. IN BOOL fMute
  113. )
  114. /*++
  115. Routine Description:
  116. Sets the HW (!) mute levels for MSVAD
  117. Arguments:
  118. ulNode - topology node id
  119. fMute - mute flag
  120. Return Value:
  121. void
  122. --*/
  123. {
  124. if (ulNode < MAX_TOPOLOGY_NODES)
  125. {
  126. m_MuteControls[ulNode] = fMute;
  127. }
  128. } // SetMixerMute
  129. //=============================================================================
  130. void
  131. CMSVADHW::SetMixerMux
  132. (
  133. IN ULONG ulNode
  134. )
  135. /*++
  136. Routine Description:
  137. Sets the HW (!) mux selection
  138. Arguments:
  139. ulNode - topology node id
  140. Return Value:
  141. void
  142. --*/
  143. {
  144. m_ulMux = ulNode;
  145. } // SetMixMux
  146. //=============================================================================
  147. void
  148. CMSVADHW::SetMixerVolume
  149. (
  150. IN ULONG ulNode,
  151. IN LONG lChannel,
  152. IN LONG lVolume
  153. )
  154. /*++
  155. Routine Description:
  156. Sets the HW (!) volume for MSVAD.
  157. Arguments:
  158. ulNode - topology node id
  159. lChannel - which channel are we setting?
  160. lVolume - volume level
  161. Return Value:
  162. void
  163. --*/
  164. {
  165. if (ulNode < MAX_TOPOLOGY_NODES)
  166. {
  167. m_VolumeControls[ulNode] = lVolume;
  168. }
  169. } // SetMixerVolume