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
7.2 KiB

  1. #include <windows.h>
  2. #define MMNOMCI
  3. #include "mmsystem.h"
  4. #define NOMCIDEV
  5. #include "mmddk.h"
  6. #include "mmsysi.h"
  7. /* -------------------------------------------------------------------------
  8. ** External globals
  9. ** -------------------------------------------------------------------------
  10. */
  11. extern DWORD mmwow32Lib;
  12. extern LPSOUNDDEVMSGPROC aux32Message;
  13. /*****************************************************************************
  14. * @doc EXTERNAL AUX
  15. *
  16. * @api UINT | auxGetNumDevs | This function retrieves the number of auxiliary
  17. * output devices present in the system.
  18. *
  19. * @rdesc Returns the number of auxiliary output devices present in the system.
  20. *
  21. * @xref auxGetDevCaps
  22. ****************************************************************************/
  23. UINT WINAPI auxGetNumDevs(void)
  24. {
  25. return (UINT)auxOutMessage( 0, AUXDM_GETNUMDEVS, 0L, 0L );
  26. }
  27. /*****************************************************************************
  28. * @doc EXTERNAL AUX
  29. *
  30. * @api UINT | auxGetDevCaps | This function queries a specified
  31. * auxiliary output device to determine its capabilities.
  32. *
  33. * @parm UINT | wDeviceID | Identifies the auxiliary output device to be
  34. * queried. Specify a valid device ID (see the following comments
  35. * section), or use the following constant:
  36. * @flag AUX_MAPPER | Auxiliary audio mapper. The function will
  37. * return an error if no auxiliary audio mapper is installed.
  38. *
  39. * @parm LPAUXCAPS | lpCaps | Specifies a far pointer to an AUXCAPS
  40. * structure. This structure is filled with information about the
  41. * capabilities of the device.
  42. *
  43. * @parm UINT | wSize | Specifies the size of the AUXCAPS structure.
  44. *
  45. * @rdesc Returns zero if the function was successful. Otherwise, it returns
  46. * an error number. Possible error returns are:
  47. * @flag MMSYSERR_BADDEVICEID | Specified device ID is out of range.
  48. * @flag MMSYSERR_NODRIVER | The driver failed to install.
  49. *
  50. * @comm The device ID specified by <p wDeviceID> varies from zero
  51. * to one less than the number of devices present. AUX_MAPPER may
  52. * also be used. Use <f auxGetNumDevs> to determine the number of
  53. * auxiliary devices present in the system.
  54. *
  55. * @xref auxGetNumDevs
  56. ****************************************************************************/
  57. UINT WINAPI auxGetDevCaps(UINT wDeviceID, LPAUXCAPS lpCaps, UINT wSize)
  58. {
  59. if (!wSize)
  60. return MMSYSERR_NOERROR;
  61. V_WPOINTER(lpCaps, wSize, MMSYSERR_INVALPARAM);
  62. return (UINT)auxOutMessage(wDeviceID, AUXDM_GETDEVCAPS, (DWORD)lpCaps, (DWORD)wSize);
  63. }
  64. /*****************************************************************************
  65. * @doc EXTERNAL AUX
  66. *
  67. * @api UINT | auxGetVolume | This function returns the current volume
  68. * setting of an auxiliary output device.
  69. *
  70. * @parm UINT | wDeviceID | Identifies the auxiliary output device to be
  71. * queried.
  72. *
  73. * @parm LPDWORD | lpdwVolume | Specifies a far pointer to a location
  74. * to be filled with the current volume setting. The low-order word of
  75. * this location contains the left channel volume setting, and the high-order
  76. * word contains the right channel setting. A value of 0xFFFF represents
  77. * full volume, and a value of 0x0000 is silence.
  78. *
  79. * If a device does not support both left and right volume
  80. * control, the low-order word of the specified location contains
  81. * the volume level.
  82. *
  83. * The full 16-bit setting(s)
  84. * set with <f auxSetVolume> are returned, regardless of whether
  85. * the device supports the full 16 bits of volume level control.
  86. *
  87. * @comm Not all devices support volume control.
  88. * To determine whether the device supports volume control, use the
  89. * AUXCAPS_VOLUME flag to test the <e AUXCAPS.dwSupport> field of the
  90. * <t AUXCAPS> structure (filled by <f auxGetDevCaps>).
  91. *
  92. * To determine whether the device supports volume control on both the
  93. * left and right channels, use the AUXCAPS_LRVOLUME flag to test the
  94. * <e AUXCAPS.dwSupport> field of the <t AUXCAPS> structure (filled
  95. * by <f auxGetDevCaps>).
  96. *
  97. * @rdesc Returns zero if the function was successful. Otherwise, it returns
  98. * an error number. Possible error returns are:
  99. * @flag MMSYSERR_BADDEVICEID | Specified device ID is out of range.
  100. * @flag MMSYSERR_NODRIVER | The driver failed to install.
  101. *
  102. * @xref auxSetVolume
  103. ****************************************************************************/
  104. UINT WINAPI auxGetVolume(UINT wDeviceID, LPDWORD lpdwVolume)
  105. {
  106. V_WPOINTER(lpdwVolume, sizeof(DWORD), MMSYSERR_INVALPARAM);
  107. return (UINT)auxOutMessage(wDeviceID, AUXDM_GETVOLUME, (DWORD)lpdwVolume, 0);
  108. }
  109. /*****************************************************************************
  110. * @doc EXTERNAL AUX
  111. *
  112. * @api UINT | auxSetVolume | This function sets the volume in an
  113. * auxiliary output device.
  114. *
  115. * @parm UINT | wDeviceID | Identifies the auxiliary output device to be
  116. * queried. Device IDs are determined implicitly from the number of
  117. * devices present in the system. Device ID values range from zero
  118. * to one less than the number of devices present. Use <f auxGetNumDevs>
  119. * to determine the number of auxiliary devices in the system.
  120. *
  121. * @parm DWORD | dwVolume | Specifies the new volume setting. The
  122. * low-order word specifies the left channel volume setting, and the
  123. * high-order word specifies the right channel setting.
  124. * A value of 0xFFFF represents full volume, and a value of 0x0000
  125. * is silence.
  126. *
  127. * If a device does not support both left and right volume
  128. * control, the low-order word of <p dwVolume> specifies the volume
  129. * level, and the high-order word is ignored.
  130. *
  131. * @rdesc Returns zero if the function was successful. Otherwise, it returns
  132. * an error number. Possible error returns are:
  133. * @flag MMSYSERR_BADDEVICEID | Specified device ID is out of range.
  134. * @flag MMSYSERR_NODRIVER | The driver failed to install.
  135. *
  136. * @comm Not all devices support volume control.
  137. * To determine whether the device supports volume control, use the
  138. * AUXCAPS_VOLUME flag to test the <e AUXCAPS.dwSupport> field of the
  139. * <t AUXCAPS> structure (filled by <f auxGetDevCaps>).
  140. *
  141. * To determine whether the device supports volume control on both the
  142. * left and right channels, use the AUXCAPS_LRVOLUME flag to test the
  143. * <e AUXCAPS.dwSupport> field of the <t AUXCAPS> structure (filled
  144. * by <f auxGetDevCaps>).
  145. *
  146. * Most devices do not support the full 16 bits of volume level control
  147. * and will use only the high-order bits of the requested volume setting.
  148. * For example, for a device that supports 4 bits of volume control,
  149. * requested volume level values of 0x4000, 0x4fff, and 0x43be will
  150. * all produce the same physical volume setting, 0x4000. The
  151. * <f auxGetVolume> function will return the full 16-bit setting set
  152. * with <f auxSetVolume>.
  153. *
  154. * Volume settings are interpreted logarithmically. This means the
  155. * perceived volume increase is the same when increasing the
  156. * volume level from 0x5000 to 0x6000 as it is from 0x4000 to 0x5000.
  157. *
  158. * @xref auxGetVolume
  159. ****************************************************************************/
  160. UINT WINAPI auxSetVolume(UINT wDeviceID, DWORD dwVolume)
  161. {
  162. return (UINT)auxOutMessage(wDeviceID, AUXDM_SETVOLUME, dwVolume, 0);
  163. }