Leaked source code of windows server 2003
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.

639 lines
18 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Module: mixer.h
  4. //
  5. // Description:
  6. //
  7. // Contains the declarations for the mixer line user api handlers.
  8. //
  9. //
  10. //@@BEGIN_MSINTERNAL
  11. // Development Team:
  12. // D. Baumberger
  13. //
  14. // History: Date Author Comment
  15. //
  16. //@@END_MSINTERNAL
  17. //
  18. //---------------------------------------------------------------------------
  19. //
  20. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  21. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  22. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  23. // PURPOSE.
  24. //
  25. // Copyright (C) Microsoft Corporation, 1997 - 1998 All Rights Reserved.
  26. //
  27. //---------------------------------------------------------------------------
  28. #ifndef _KMXLUSER_H_INCLUDED_
  29. #define _KMXLUSER_H_INCLUDED_
  30. typedef struct tag_MIXERDEVICE* PMIXERDEVICE;
  31. #ifdef DEBUG
  32. #define NOTIFICATION_SIGNATURE 'ETON' // NOTE
  33. #define CONTROLLINK_SIGNATURE 'KLTC' // CTLK
  34. #endif
  35. #define UNUSED_DEVICE ((ULONG) -1)
  36. #define MIXER_FLAG_SCALE 0x1
  37. #define MIXER_FLAG_PERSIST 0x2
  38. #define MIXER_FLAG_NONCACHED 0x4
  39. #define MIXER_FLAG_NOCALLBACK 0x8
  40. #define MIXER_CONTROL_CALLBACK 0x01
  41. #define MIXER_LINE_CALLBACK 0x02
  42. #define MIXER_KEY_NAME L"Mixer"
  43. #define VALID_MULTICHANNEL_MIXER_VALUE_NAME L"Valid Multichannel Mixer Settings"
  44. #define LINE_COUNT_VALUE_NAME L"Line Count"
  45. #define LINE_ID_VALUE_NAME L"LineId"
  46. #define CONTROL_COUNT_VALUE_NAME L"Control Count"
  47. #define SOURCE_ID_VALUE_NAME L"SourceId"
  48. #define DEST_ID_VALUE_NAME L"DestId"
  49. #define CONTROLS_KEY_NAME L"Controls"
  50. #define CONTROL_TYPE_VALUE_NAME L"Control Type"
  51. #define CHANNEL_COUNT_VALUE_NAME L"Channel Count"
  52. #define CONTROL_MINVAL_VALUE_NAME L"Minimum Value"
  53. #define CONTROL_MAXVAL_VALUE_NAME L"Maximum Value"
  54. #define CONTROL_STEPS_VALUE_NAME L"Steps"
  55. #define CONTROL_MULTIPLEITEMS_VALUE_NAME L"Multiple Items"
  56. #define LINE_KEY_NAME_FORMAT L"%8X"
  57. #define CONTROL_KEY_NAME_FORMAT L"%8X"
  58. #define CHANNEL_VALUE_NAME_FORMAT L"Channel%8d"
  59. #define MULTIPLEITEM_VALUE_NAME_FORMAT L"Item%8d"
  60. #define KMXL_TRACELEVEL_FATAL_ERROR 0x10
  61. #define KMXL_TRACELEVEL_ERROR 0x20
  62. #define KMXL_TRACELEVEL_WARNING 0x30
  63. #define KMXL_TRACELEVEL_TRACE 0x40
  64. #define DEFAULT_RANGE_MIN ( -96 * 65536 ) // -96 dB
  65. #define DEFAULT_RANGE_MAX ( 0 ) // 0 dB
  66. #define DEFAULT_RANGE_STEPS ( 48 ) // 2 dB steps
  67. #define DEFAULT_STATICBOUNDS_MIN ( 0 )
  68. #define DEFAULT_STATICBOUNDS_MAX ( 65535 )
  69. #define DEFAULT_STATICMETRICS_CSTEPS ( 192 )
  70. ///////////////////////////////////////////////////////////////////////
  71. ///////////////////////////////////////////////////////////////////////
  72. // //
  73. // M I X E R A P I H A N D L E R S //
  74. // //
  75. ///////////////////////////////////////////////////////////////////////
  76. ///////////////////////////////////////////////////////////////////////
  77. ///////////////////////////////////////////////////////////////////////
  78. //
  79. // kmxlInitializeMixer
  80. //
  81. // Initializes or re-initializes the mixer driver.
  82. //
  83. //
  84. NTSTATUS
  85. kmxlInitializeMixer(
  86. PWDMACONTEXT pWdmaContext,
  87. PCWSTR DeviceInterface,
  88. ULONG cDevices
  89. );
  90. ///////////////////////////////////////////////////////////////////////
  91. //
  92. // kmxlInitHandler
  93. //
  94. // Handles the MXDM_INIT message.
  95. //
  96. //
  97. NTSTATUS
  98. kmxlInitHandler(
  99. IN LPDEVICEINFO DeviceInfo // Device Input Parameters
  100. );
  101. ///////////////////////////////////////////////////////////////////////
  102. //
  103. // kmxlOpenHandler
  104. //
  105. // Handles the MXDM_OPEN message.
  106. //
  107. //
  108. NTSTATUS
  109. kmxlOpenHandler(
  110. IN PWDMACONTEXT pWdmaContext,
  111. IN LPDEVICEINFO DeviceInfo, // Device Input Parameters
  112. IN LPVOID DataBuffer // Flat pointer to open desc
  113. );
  114. ///////////////////////////////////////////////////////////////////////
  115. //
  116. // kmxlCloseHandler
  117. //
  118. // Handles the MXDM_CLOSE message.
  119. //
  120. //
  121. NTSTATUS
  122. kmxlCloseHandler(
  123. IN LPDEVICEINFO DeviceInfo, // Device Input Parameters
  124. IN LPVOID DataBuffer // UNUSED
  125. );
  126. ///////////////////////////////////////////////////////////////////////
  127. //
  128. // kmxlGetLineInfoHandler
  129. //
  130. // Handles the MXDM_GETLINEINFO message.
  131. //
  132. //
  133. NTSTATUS
  134. kmxlGetLineInfoHandler(
  135. IN PWDMACONTEXT pWdmaContext,
  136. IN LPDEVICEINFO DeviceInfo, // Device Input Parameters
  137. IN LPVOID DataBuffer // Mapped MIXERLINE structure
  138. );
  139. ///////////////////////////////////////////////////////////////////////
  140. //
  141. // kmxlGetLineControlsHandler
  142. //
  143. // Handles the MXDM_GETLINECONTROLS message.
  144. //
  145. //
  146. NTSTATUS
  147. kmxlGetLineControlsHandler(
  148. IN PWDMACONTEXT pWdmaContext,
  149. IN LPDEVICEINFO DeviceInfo, // Device Input Parameters
  150. IN LPVOID DataBuffer, // Mapped MIXERLINECONTROLS structure
  151. IN LPVOID pamxctrl // Mapped MIXERCONTROL array
  152. );
  153. ///////////////////////////////////////////////////////////////////////
  154. //
  155. // kmxlGetControlDetailsHandler
  156. //
  157. // Handles the MXDM_GETLINECONTROLS message.
  158. //
  159. //
  160. NTSTATUS
  161. kmxlGetControlDetailsHandler(
  162. IN PWDMACONTEXT pWdmaContext,
  163. IN LPDEVICEINFO DeviceInfo, // Device Info Structure
  164. IN LPVOID DataBuffer, // MIXERCONTROLDETAILS structure
  165. IN LPVOID paDetails // Flat pointer to details struct(s)
  166. );
  167. ///////////////////////////////////////////////////////////////////////
  168. //
  169. // kmxlSetControlDetailsHandler
  170. //
  171. // Handles the MXDM_SetControlDetailsHandler
  172. //
  173. //
  174. NTSTATUS
  175. kmxlSetControlDetailsHandler(
  176. IN PWDMACONTEXT pWdmaContext,
  177. IN LPDEVICEINFO DeviceInfo, // Device Input Parameters
  178. IN LPVOID DataBuffer, // Mapped MIXERCONTROLDETAILS struct.
  179. IN LPVOID paDetails, // Mapped array of DETAILS structures.
  180. IN ULONG Flags
  181. );
  182. ///////////////////////////////////////////////////////////////////////
  183. ///////////////////////////////////////////////////////////////////////
  184. // //
  185. // H E L P E R F U N C T I O N S //
  186. // //
  187. ///////////////////////////////////////////////////////////////////////
  188. ///////////////////////////////////////////////////////////////////////
  189. ///////////////////////////////////////////////////////////////////////
  190. //
  191. // kmxlFindControl
  192. //
  193. // For the given control ID, kmxlFindControl will find the matching
  194. // MXLCONTROL structure.
  195. //
  196. //
  197. PMXLCONTROL
  198. kmxlFindControl(
  199. IN PMIXERDEVICE pmxd, // The mixer instance to search
  200. IN DWORD dwControlID // The control ID to find
  201. );
  202. ///////////////////////////////////////////////////////////////////////
  203. //
  204. // kmxlFindLine
  205. //
  206. // For the given line ID, kmxlFindLine will find the matching
  207. // MXLLINE structure for it.
  208. //
  209. //
  210. PMXLLINE
  211. kmxlFindLine(
  212. IN PMIXERDEVICE pmxd, // The mixer to search
  213. IN DWORD dwLineID // The line ID to find
  214. );
  215. ///////////////////////////////////////////////////////////////////////
  216. //
  217. // kmxlGetLineInfoByID
  218. //
  219. // Finds a line that matches the given source and destination line
  220. // ids.
  221. //
  222. //
  223. NTSTATUS
  224. kmxlGetLineInfoByID(
  225. IN PWDMACONTEXT pWdmaContext,
  226. IN LPDEVICEINFO DeviceInfo, // Device Input Parameters
  227. IN LPVOID DataBuffer, // Mapped MIXERLINE structure
  228. IN WORD Source, // Source line Id
  229. IN WORD Destination // Destination line Id
  230. );
  231. ///////////////////////////////////////////////////////////////////////
  232. //
  233. // kmxlGetLineInfoByType
  234. //
  235. // Finds a line that matches the given target type.
  236. //
  237. //
  238. NTSTATUS
  239. kmxlGetLineInfoByType(
  240. IN PWDMACONTEXT pWdmaContext,
  241. IN LPDEVICEINFO DeviceInfo, // Device Input Parameters
  242. IN LPVOID DataBuffer, // Mapped MIXERLINE structure
  243. IN DWORD dwType // The line target type to find
  244. );
  245. ///////////////////////////////////////////////////////////////////////
  246. //
  247. // kmxlGetLineInfoByComponent
  248. //
  249. // Finds a line that matches the given component type.
  250. //
  251. //
  252. NTSTATUS
  253. kmxlGetLineInfoByComponent(
  254. IN PWDMACONTEXT pWdmaContext,
  255. IN LPDEVICEINFO DeviceInfo, // Device Input Parameters
  256. IN LPVOID DataBuffer, // Mapped MIXERLINE structure
  257. IN DWORD dwComponentType // The compontent type to match
  258. );
  259. ///////////////////////////////////////////////////////////////////////
  260. //
  261. // kmxlGetNumDestinations
  262. //
  263. // Returns the number of destinations on the given device number.
  264. //
  265. //
  266. DWORD
  267. kmxlGetNumDestinations(
  268. IN PMIXERDEVICE pMixerDevice // The device to query
  269. );
  270. ///////////////////////////////////////////////////////////////////////
  271. //
  272. // kmxlConvertMixerLineWto16
  273. //
  274. // Converts a UNICODE MIXERLINE structure to ANSI, optionally copying
  275. // the Target structure.
  276. //
  277. //
  278. VOID
  279. kmxlConvertMixerLineWto16(
  280. IN LPMIXERLINE pMixerLineW,
  281. IN OUT LPMIXERLINE16 pMixerLine16,
  282. IN BOOL bCopyTarget
  283. );
  284. ///////////////////////////////////////////////////////////////////////
  285. //
  286. // kmxlConvertMixerControlWto16
  287. //
  288. // Converts a UNICODE MIXERCONTROL structure to ANSI.
  289. //
  290. //
  291. VOID
  292. kmxlConvertMixerControlWto16(
  293. IN LPMIXERCONTROL pMixerControlW,
  294. IN OUT LPMIXERCONTROL16 pMixerControl16
  295. );
  296. ///////////////////////////////////////////////////////////////////////
  297. //
  298. // kmxlConvertMixerControlDetails_ListTextWto16
  299. //
  300. // Converts an UNICODE MIXERCONTROLDETAILS_LISTTEXT structure to ANSI.
  301. //
  302. //
  303. VOID
  304. kmxlConvertMixerControlDetails_ListTextWto16(
  305. IN LPMIXERCONTROLDETAILS_LISTTEXT pListTextW,
  306. IN OUT LPMIXERCONTROLDETAILS_LISTTEXT16 pListText16
  307. );
  308. ///////////////////////////////////////////////////////////////////////
  309. //
  310. // Instance list handling routines
  311. //
  312. DWORD
  313. kmxlUniqueInstanceId(
  314. VOID
  315. );
  316. PMIXERDEVICE
  317. kmxlReferenceMixerDevice(
  318. IN PWDMACONTEXT pWdmaContext,
  319. IN OUT LPDEVICEINFO DeviceInfo // Device Information
  320. );
  321. ///////////////////////////////////////////////////////////////////////
  322. //
  323. // kmxlNotifyLineChange
  324. //
  325. // Notifies all mixer line clients on a line status change.
  326. //
  327. //
  328. VOID
  329. kmxlNotifyLineChange(
  330. OUT LPDEVICEINFO DeviceInfo,
  331. IN PMIXERDEVICE pmxd,
  332. IN PMXLLINE pLine,
  333. IN LPMIXERCONTROLDETAILS_UNSIGNED paDetails
  334. );
  335. ///////////////////////////////////////////////////////////////////////
  336. //
  337. // kmxlNotifyControlChange
  338. //
  339. // Notifies all mixer line clients on a control change.
  340. //
  341. //
  342. VOID
  343. kmxlNotifyControlChange(
  344. OUT LPDEVICEINFO DeviceInfo,
  345. IN PMIXERDEVICE pmxd,
  346. IN PMXLCONTROL pControl
  347. );
  348. ///////////////////////////////////////////////////////////////////////
  349. ///////////////////////////////////////////////////////////////////////
  350. // //
  351. // G E T / S E T D E T A I L H A N D L E R S //
  352. // //
  353. ///////////////////////////////////////////////////////////////////////
  354. ///////////////////////////////////////////////////////////////////////
  355. ///////////////////////////////////////////////////////////////////////
  356. //
  357. // kmxlHandleGetUnsigned
  358. //
  359. // Handles the get property for all 32-bit sized values: UNSIGNED,
  360. // SIGNED, and BOOLEAN.
  361. //
  362. //
  363. NTSTATUS
  364. kmxlHandleGetUnsigned(
  365. IN LPDEVICEINFO DeviceInfo,
  366. IN PMIXERDEVICE pmxd,
  367. IN PMXLCONTROL pControl,
  368. IN ULONG ulProperty,
  369. IN LPMIXERCONTROLDETAILS pmcd,
  370. IN OUT LPMIXERCONTROLDETAILS_UNSIGNED paDetails,
  371. IN ULONG Flags
  372. );
  373. ///////////////////////////////////////////////////////////////////////
  374. //
  375. // kmxlHandleSetUnsigned
  376. //
  377. // Handles the gSt property for all 32-bit sized values: UNSIGNED,
  378. // SIGNED, and BOOLEAN.
  379. //
  380. //
  381. NTSTATUS
  382. kmxlHandleSetUnsigned(
  383. IN LPDEVICEINFO DeviceInfo,
  384. IN PMIXERDEVICE pmxd,
  385. IN PMXLCONTROL pControl,
  386. IN ULONG ulProperty,
  387. IN LPMIXERCONTROLDETAILS pmcd,
  388. IN OUT LPMIXERCONTROLDETAILS_UNSIGNED paDetails,
  389. IN ULONG Flags
  390. );
  391. ///////////////////////////////////////////////////////////////////////
  392. //
  393. // kmxlHandleGetMuteFromSuperMix
  394. //
  395. //
  396. NTSTATUS
  397. kmxlHandleGetMuteFromSuperMix(
  398. IN LPDEVICEINFO DeviceInfo,
  399. IN PMIXERDEVICE pmxd,
  400. IN PMXLCONTROL pControl,
  401. IN LPMIXERCONTROLDETAILS pmcd,
  402. IN OUT LPMIXERCONTROLDETAILS_UNSIGNED paDetails,
  403. IN ULONG Flags
  404. );
  405. ///////////////////////////////////////////////////////////////////////
  406. //
  407. // kmxlHandleSetMuteFromSuperMix
  408. //
  409. //
  410. NTSTATUS
  411. kmxlHandleSetMuteFromSuperMix(
  412. IN LPDEVICEINFO DeviceInfo,
  413. IN PMIXERDEVICE pmxd,
  414. IN PMXLCONTROL pControl,
  415. IN LPMIXERCONTROLDETAILS pmcd,
  416. IN OUT LPMIXERCONTROLDETAILS_UNSIGNED paDetails,
  417. IN ULONG Flags
  418. );
  419. ///////////////////////////////////////////////////////////////////////
  420. //
  421. // kmxlHandleGetVolumeFromSuperMix
  422. //
  423. //
  424. NTSTATUS
  425. kmxlHandleGetVolumeFromSuperMix(
  426. IN LPDEVICEINFO DeviceInfo,
  427. IN PMIXERDEVICE pmxd,
  428. IN PMXLCONTROL pControl,
  429. IN LPMIXERCONTROLDETAILS pmcd,
  430. IN OUT LPMIXERCONTROLDETAILS_UNSIGNED paDetails,
  431. IN ULONG Flags
  432. );
  433. ///////////////////////////////////////////////////////////////////////
  434. //
  435. // kmxlHandleSetVolumeFromSuperMix
  436. //
  437. //
  438. NTSTATUS
  439. kmxlHandleSetVolumeFromSuperMix(
  440. IN LPDEVICEINFO DeviceInfo,
  441. IN PMIXERDEVICE pmxd,
  442. IN PMXLCONTROL pControl,
  443. IN LPMIXERCONTROLDETAILS pmcd,
  444. IN OUT LPMIXERCONTROLDETAILS_UNSIGNED paDetails,
  445. IN ULONG Flags
  446. );
  447. ///////////////////////////////////////////////////////////////////////
  448. ///////////////////////////////////////////////////////////////////////
  449. // //
  450. // P E R S I S T A N C E F U N C T I O N S //
  451. // //
  452. ///////////////////////////////////////////////////////////////////////
  453. ///////////////////////////////////////////////////////////////////////
  454. ///////////////////////////////////////////////////////////////////////
  455. //
  456. // kmxlPersistAll
  457. //
  458. //
  459. NTSTATUS
  460. kmxlPersistAll(
  461. IN PFILE_OBJECT pfo, // The instance to persist
  462. IN PMIXERDEVICE pmxd // The mixer device data
  463. );
  464. ///////////////////////////////////////////////////////////////////////
  465. //
  466. // kmxlRetrieveAll
  467. //
  468. //
  469. NTSTATUS
  470. kmxlRetrieveAll(
  471. IN PFILE_OBJECT pfo, // The instance to retrieve
  472. IN PMIXERDEVICE pmxd // The mixer device data
  473. );
  474. ///////////////////////////////////////////////////////////////////////
  475. //
  476. // kmxlPersistControl
  477. //
  478. //
  479. NTSTATUS
  480. kmxlPersistControl(
  481. IN PFILE_OBJECT pfo, // The instance to retrieve
  482. IN PMIXERDEVICE pmxd, // Mixer device info
  483. IN PMXLCONTROL pControl, // The control to persist
  484. IN PVOID paDetails // The channel values to persist
  485. );
  486. ///////////////////////////////////////////////////////////////////////
  487. //
  488. // kmxlFindLineForControl
  489. //
  490. //
  491. PMXLLINE
  492. kmxlFindLineForControl(
  493. IN PMXLCONTROL pControl,
  494. IN LINELIST listLines
  495. );
  496. ///////////////////////////////////////////////////////////////////////
  497. //
  498. // mixerGetControlDetails
  499. //
  500. //
  501. MMRESULT
  502. WINAPI
  503. kmxlGetControlDetails(
  504. PWDMACONTEXT pWdmaContext,
  505. PCWSTR DeviceInterface,
  506. LPMIXERCONTROLDETAILS pmxcd,
  507. DWORD fdwDetails
  508. );
  509. ///////////////////////////////////////////////////////////////////////
  510. //
  511. // mixerGetLineControls
  512. //
  513. //
  514. MMRESULT
  515. WINAPI
  516. kmxlGetLineControls(
  517. PWDMACONTEXT pWdmaContext,
  518. PCWSTR DeviceInterface,
  519. LPMIXERLINECONTROLS pmxlc,
  520. DWORD fdwControls
  521. );
  522. ///////////////////////////////////////////////////////////////////////
  523. //
  524. // mixerGetLineInfo
  525. //
  526. //
  527. MMRESULT
  528. WINAPI
  529. kmxlGetLineInfo(
  530. PWDMACONTEXT pWdmaContext,
  531. PCWSTR DeviceInterface,
  532. LPMIXERLINE pmxl,
  533. DWORD fdwInfo
  534. );
  535. ///////////////////////////////////////////////////////////////////////
  536. //
  537. // mixerSetControlDetails
  538. //
  539. //
  540. MMRESULT
  541. WINAPI
  542. kmxlSetControlDetails(
  543. PWDMACONTEXT pWdmaContext,
  544. PCWSTR DeviceInterface,
  545. LPMIXERCONTROLDETAILS pmxcd,
  546. DWORD fdwDetails
  547. );
  548. #endif // _KMXLUSER_H_INCLUDED