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.

1653 lines
53 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Module: mixer.h
  4. //
  5. // Description:
  6. //
  7. // Contains the declarations and prototypes for the Kernel Portion
  8. // of the mixer line driver (KMXL).
  9. //
  10. //
  11. //@@BEGIN_MSINTERNAL
  12. // Development Team:
  13. // D. Baumberger
  14. //
  15. // History: Date Author Comment
  16. //
  17. //@@END_MSINTERNAL
  18. //
  19. //---------------------------------------------------------------------------
  20. //
  21. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  22. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  23. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  24. // PURPOSE.
  25. //
  26. // Copyright (C) Microsoft Corporation, 1997 - 1999 All Rights Reserved.
  27. //
  28. //---------------------------------------------------------------------------
  29. #ifndef _MIXER_H_INCLUDED_
  30. #define _MIXER_H_INCLUDED_
  31. //#define API_TRACE
  32. //#define PARSE_TRACE
  33. #define SUPERMIX_AS_VOL
  34. ///////////////////////////////////////////////////////////////////////
  35. ///////////////////////////////////////////////////////////////////////
  36. // //
  37. // M I X E R L I N E 1 6 - b i t S T R U C T U R E S //
  38. // ( A N S I ) //
  39. // //
  40. ///////////////////////////////////////////////////////////////////////
  41. ///////////////////////////////////////////////////////////////////////
  42. #ifdef WIN32
  43. # include <pshpack1.h>
  44. #else
  45. # ifndef RC_INVOKED
  46. # pragma pack(1)
  47. # endif
  48. #endif
  49. typedef struct tagMIXERLINE16 {
  50. DWORD cbStruct; /* size of MIXERLINE structure */
  51. DWORD dwDestination; /* zero based destination index */
  52. DWORD dwSource; /* zero based source index (if source) */
  53. DWORD dwLineID; /* unique line id for mixer device */
  54. DWORD fdwLine; /* state/information about line */
  55. DWORD dwUser; /* driver specific information */
  56. DWORD dwComponentType; /* component type line connects to */
  57. DWORD cChannels; /* number of channels line supports */
  58. DWORD cConnections; /* number of connections [possible] */
  59. DWORD cControls; /* number of controls at this line */
  60. CHAR szShortName[MIXER_SHORT_NAME_CHARS];
  61. CHAR szName[MIXER_LONG_NAME_CHARS];
  62. struct {
  63. DWORD dwType; /* MIXERLINE_TARGETTYPE_xxxx */
  64. DWORD dwDeviceID; /* target device ID of device type */
  65. WORD wMid; /* of target device */
  66. WORD wPid; /* " */
  67. WORD vDriverVersion; /* " */
  68. CHAR szPname[MAXPNAMELEN]; /* " */
  69. } Target;
  70. } MIXERLINE16, *PMIXERLINE16, *LPMIXERLINE16;
  71. typedef struct tagMIXERCONTROL16 {
  72. DWORD cbStruct; /* size in bytes of MIXERCONTROL */
  73. DWORD dwControlID; /* unique control id for mixer device */
  74. DWORD dwControlType; /* MIXERCONTROL_CONTROLTYPE_xxx */
  75. DWORD fdwControl; /* MIXERCONTROL_CONTROLF_xxx */
  76. DWORD cMultipleItems; /* if MIXERCONTROL_CONTROLF_MULTIPLE set */
  77. CHAR szShortName[MIXER_SHORT_NAME_CHARS];
  78. CHAR szName[MIXER_LONG_NAME_CHARS];
  79. union {
  80. struct {
  81. LONG lMinimum; /* signed minimum for this control */
  82. LONG lMaximum; /* signed maximum for this control */
  83. };
  84. struct {
  85. DWORD dwMinimum; /* unsigned minimum for this control */
  86. DWORD dwMaximum; /* unsigned maximum for this control */
  87. };
  88. DWORD dwReserved[6];
  89. } Bounds;
  90. union {
  91. DWORD cSteps; /* # of steps between min & max */
  92. DWORD cbCustomData; /* size in bytes of custom data */
  93. DWORD dwReserved[6]; /* !!! needed? we have cbStruct.... */
  94. } Metrics;
  95. } MIXERCONTROL16, *PMIXERCONTROL16, *LPMIXERCONTROL16;
  96. typedef struct tagMIXERLINECONTROLS16 {
  97. DWORD cbStruct; /* size in bytes of MIXERLINECONTROLS */
  98. DWORD dwLineID; /* line id (from MIXERLINE.dwLineID) */
  99. union {
  100. DWORD dwControlID; /* MIXER_GETLINECONTROLSF_ONEBYID */
  101. DWORD dwControlType; /* MIXER_GETLINECONTROLSF_ONEBYTYPE */
  102. };
  103. DWORD cControls; /* count of controls pmxctrl points to */
  104. DWORD cbmxctrl; /* size in bytes of _one_ MIXERCONTROL */
  105. LPMIXERCONTROL16 pamxctrl; /* pointer to first MIXERCONTROL array */
  106. } MIXERLINECONTROLS16, *PMIXERLINECONTROLS16, *LPMIXERLINECONTROLS16;
  107. typedef struct tagMIXERCONTROLDETAILS_LISTTEXT16 {
  108. DWORD dwParam1;
  109. DWORD dwParam2;
  110. CHAR szName[MIXER_LONG_NAME_CHARS];
  111. } MIXERCONTROLDETAILS_LISTTEXT16, *PMIXERCONTROLDETAILS_LISTTEXT16, *LPMIXERCONTROLDETAILS_LISTTEXT16;
  112. #ifdef WIN32
  113. # include <poppack.h>
  114. #else
  115. # ifndef RC_INVOKED
  116. # pragma pack()
  117. # endif
  118. #endif
  119. ///////////////////////////////////////////////////////////////////////
  120. ///////////////////////////////////////////////////////////////////////
  121. // //
  122. // D E F I N E S //
  123. // //
  124. ///////////////////////////////////////////////////////////////////////
  125. ///////////////////////////////////////////////////////////////////////
  126. #define PINID_WILDCARD ( (ULONG) -2 )
  127. #define DESTINATION_LIST ( 0x01 )
  128. #define SOURCE_LIST ( 0x02 )
  129. #define SLIST SINGLE_LIST_ENTRY
  130. #define PSLIST SLIST*
  131. #define MAX_CHANNELS 0xFFFF
  132. //#define MIXERCONTROL_CONTROLTYPE_BASS_BOOST 0x20012277
  133. #define INVALID_ID ( 0xDEADBEEF )
  134. #define TOPOLOGY_DRIVER_NAME L"\\DosDevices\\sysaudio\\MIXER"
  135. //#define TOPOLOGY_DRIVER_NAME L"\\DosDevices\\PortClass0\\TOPOLOGY"
  136. #define STR_SHORT_AGC "AGC"
  137. #define STR_AGC "Automatic Gain Control"
  138. #define STR_SHORT_LOUDNESS "Loudness"
  139. #define STR_LOUDNESS STR_SHORT_LOUDNESS
  140. #define STR_SHORT_MUTE "Mute"
  141. #define STR_MUTE STR_SHORT_MUTE
  142. #define STR_SHORT_TREBLE "Treble"
  143. #define STR_TREBLE STR_SHORT_TREBLE
  144. #define STR_SHORT_BASS "Bass"
  145. #define STR_BASS STR_SHORT_BASS
  146. #define STR_SHORT_VOLUME "Volume"
  147. #define STR_VOLUME STR_SHORT_VOLUME
  148. #define STR_SHORT_MUX "Mux"
  149. #define STR_MUX "Source Mux"
  150. #define STR_SHORT_BASS_BOOST "Bass Boost"
  151. #define STR_BASS_BOOST STR_SHORT_BASS_BOOST
  152. //
  153. // The SwapEm macro function will swap the contents of any SLIST based
  154. // list. A and B are the elements to swap. T is a temporary variable
  155. // of the same type as A and B to use a temporary storage. size is
  156. // the size of the structure in the list, including the SLIST element.
  157. // The macro does not copy the pointer stored in SLIST.
  158. //
  159. #define SwapEm(A, B, T, size) \
  160. memcpy( ((BYTE*) (T)) + sizeof( SLIST ), \
  161. ((BYTE*) (A)) + sizeof( SLIST ), \
  162. size - sizeof( SLIST ) ); \
  163. memcpy( ((BYTE*) (A)) + sizeof( SLIST ), \
  164. ((BYTE*) (B)) + sizeof( SLIST ), \
  165. size - sizeof( SLIST ) ); \
  166. memcpy( ((BYTE*) (B)) + sizeof( SLIST ), \
  167. ((BYTE*) (T)) + sizeof( SLIST ), \
  168. size - sizeof( SLIST ) )
  169. //
  170. // IsValidLine determines if the line pointed to by pLine is valid. A valid
  171. // line is determined by having valid Source and Dest Ids.
  172. //
  173. #define Is_Valid_Line( pLine ) ( ( pLine->SourceId != INVALID_ID ) && \
  174. ( pLine->DestId != INVALID_ID ) )
  175. ///////////////////////////////////////////////////////////////////////
  176. ///////////////////////////////////////////////////////////////////////
  177. //
  178. // F O R W A R D R E F E R E N C E S
  179. //
  180. ///////////////////////////////////////////////////////////////////////
  181. ///////////////////////////////////////////////////////////////////////
  182. typedef struct tag_MIXERDEVICE *PMIXERDEVICE;
  183. ///////////////////////////////////////////////////////////////////////
  184. ///////////////////////////////////////////////////////////////////////
  185. // //
  186. // S T R U C T U R E S //
  187. // //
  188. ///////////////////////////////////////////////////////////////////////
  189. ///////////////////////////////////////////////////////////////////////
  190. typedef struct tag_CHANNEL_STEPPING {
  191. LONG MinValue;
  192. LONG MaxValue;
  193. LONG Steps;
  194. } CHANNEL_STEPPING, *PCHANNEL_STEPPING;
  195. typedef enum tagMXLNODE_TYPE { SOURCE, DESTINATION, NODE } MXLNODE_TYPE;
  196. typedef struct tagMXLCONTROL {
  197. SLIST List; // MUST BE THE FIRST MEMBER!
  198. MIXERCONTROL Control; // The MixerControl structure for the control
  199. CONST GUID* NodeType; // The type of node this control represents
  200. ULONG Id; // The Node Id this control represents
  201. ULONG PropertyId; // The KS property used for GET/SET
  202. BOOL bScaled; // Linear->Log scaling
  203. ULONG NumChannels;
  204. PCHANNEL_STEPPING pChannelStepping;
  205. union {
  206. //
  207. // Supermixer parameters
  208. //
  209. struct {
  210. PLONG pReferenceCount;
  211. ULONG Size;
  212. PKSAUDIO_MIXCAP_TABLE pMixCaps;
  213. PKSAUDIO_MIXLEVEL pMixLevels; // Stored mix levels
  214. };
  215. //
  216. // Parameters for muxes
  217. //
  218. struct {
  219. BOOL bPlaceholder;
  220. BOOL bHasCopy; // bHasCopy must be
  221. // set to TRUE unless
  222. // this control owns
  223. // the original mem.
  224. ULONG Count;
  225. LPMIXERCONTROLDETAILS_LISTTEXT lpmcd_lt;
  226. ULONG* pPins;
  227. };
  228. } Parameters;
  229. #ifdef DEBUG
  230. DWORD Tag; // 'CTRL' if valid control
  231. #endif
  232. } MXLCONTROL, *PMXLCONTROL, *CONTROLLIST;
  233. typedef struct tagMXLLINE {
  234. SLIST List; // MUST BE THE FIRST MEMBER!
  235. MIXERLINE Line; // The MixerLine structure for the line
  236. CONTROLLIST Controls; // The list of controls associated with line
  237. ULONG SourceId; // Source Pin Id this line corresponds to
  238. ULONG DestId; // Dest Pin Id this line corresponds to
  239. GUID Type; // The type of line this is
  240. KSPIN_COMMUNICATION Communication; // KSPIN_COMMUNICATION of the line
  241. BOOL bMute;
  242. } MXLLINE, *PMXLLINE, *LINELIST;
  243. typedef struct tagPEERNODE* PEERLIST;
  244. typedef struct tagMXLNODE {
  245. SLIST List; // MUST BE THE FIRST MEMBER!
  246. MXLNODE_TYPE Type; // Type of node: SOURCE, DEST, or NODE
  247. GUID NodeType; // KSNODETYPE of the node
  248. KSPIN_COMMUNICATION Communication; // KSPIN_COMMUNICATION of the node
  249. ULONG Id; // Pin or node ID
  250. PEERLIST Children; // List of Children
  251. PEERLIST Parents; // List of Parents
  252. } MXLNODE, *PMXLNODE, *NODELIST;
  253. typedef struct tagPEERNODE {
  254. SLIST List; // MUST BE THE FIRST MEMBER!
  255. PMXLNODE pNode; // Pointer to the mixer node
  256. } PEERNODE, *PPEERNODE;
  257. typedef struct tagMIXEROBJECT {
  258. PFILE_OBJECT pfo;
  259. PMXLNODE pNodeTable;
  260. PKSTOPOLOGY pTopology;
  261. CONTROLLIST listMuxControls;
  262. DWORD dwControlId;
  263. PMIXERDEVICE pMixerDevice;
  264. #ifdef DEBUG
  265. DWORD dwSig;
  266. #endif
  267. PWSTR DeviceInterface;
  268. } MIXEROBJECT, *PMIXEROBJECT;
  269. typedef enum {
  270. MIXER_MAPPING_LOGRITHMIC,
  271. MIXER_MAPPING_LINEAR,
  272. MIXER_MAPPING_EXPONENTIAL
  273. } MIXERMAPPING;
  274. ///////////////////////////////////////////////////////////////////////
  275. ///////////////////////////////////////////////////////////////////////
  276. // //
  277. // M A C R O C I T Y : //
  278. // L I S T M A N A G E M E N T M A C R O F U N C T I O N S //
  279. // //
  280. ///////////////////////////////////////////////////////////////////////
  281. ///////////////////////////////////////////////////////////////////////
  282. //
  283. // Next in list retrieval macros
  284. //
  285. #define NextInList( pList, Type ) (( Type* ) ( pList->List.Next ) )
  286. #define kmxlNextNode( pNode ) NextInList( pNode, MXLNODE )
  287. #define kmxlNextPeerNode( pNode ) NextInList( pNode, PEERNODE )
  288. #define kmxlNextControl( pControl ) NextInList( pControl, MXLCONTROL )
  289. #define kmxlNextLine( pLine ) NextInList( pLine, MXLLINE )
  290. //
  291. // First in list retrieval macros
  292. //
  293. #define kmxlFirstInList( NodeList ) ( NodeList )
  294. #define kmxlFirstChildNode( pNode ) (( PEERNODE* ) (pNode)->Children )
  295. #define kmxlFirstParentNode( pNode ) (( PEERNODE* ) (pNode)->Parents )
  296. //
  297. // List count macros
  298. //
  299. #define kmxlParentListLength( pNode ) kmxlListCount( (PSLIST) pNode->Parents )
  300. #define kmxlChildListLength( pNode ) kmxlListCount( (PSLIST) pNode->Children )
  301. #define kmxlListLength( List ) kmxlListCount( (PSLIST) List )
  302. //
  303. // Added to a list macros
  304. //
  305. #define kmxlAddToList( pNodeList, pNode ) \
  306. if( pNodeList ) { \
  307. (pNode)->List.Next = (PSLIST) (pNodeList); \
  308. (pNodeList) = (pNode); \
  309. } else { \
  310. (pNode)->List.Next = NULL; \
  311. (pNodeList) = (pNode); \
  312. }
  313. #define kmxlAddToEndOfList( list, node ) \
  314. kmxlAddElemToEndOfList( ((PSLIST*) &(list)), (PSLIST) (node) )
  315. #define kxmlAddLineToEndOfList( list, node )
  316. #define kmxlAddToChildList( NodeList, Node ) \
  317. ASSERT( (Node)->pNode ); \
  318. kmxlAddToList( (NodeList)->Children, (Node) );
  319. #define kmxlAddToParentList( NodeList, Node ) \
  320. ASSERT( (Node)->pNode ); \
  321. kmxlAddToList( (NodeList)->Parents, (Node) );
  322. //
  323. // Remove from a list macros
  324. //
  325. #define RemoveFirstEntry( list, Type ) \
  326. (Type*) (list); \
  327. { \
  328. PSLIST pRFETemp; \
  329. pRFETemp = (PSLIST) (list); \
  330. if( (list) ) { \
  331. (list) = (Type*) (list)->List.Next; \
  332. if( pRFETemp ) { \
  333. ((Type*) pRFETemp)->List.Next = NULL; \
  334. } \
  335. } \
  336. }
  337. #define kmxlRemoveFirstNode( pNodeList ) \
  338. RemoveFirstEntry( (pNodeList), MXLNODE )
  339. #define kmxlRemoveFirstControl( pControlList ) \
  340. RemoveFirstEntry( (pControlList), MXLCONTROL )
  341. #define kmxlRemoveFirstLine( pLineList ) \
  342. RemoveFirstEntry( (pLineList), MXLLINE )
  343. #define kmxlRemoveFirstPeerNode( pPeerList ) \
  344. RemoveFirstEntry( (pPeerList), PEERNODE )
  345. #define kmxlRemoveFirstChildNode( pNode ) \
  346. RemoveFirstEntry( (pNode)->Children, PEERNODE )
  347. #define kmxlRemoveFirstParentNode( pNode ) \
  348. RemoveFirstEntry( (pNode)->Parents, PEERNODE )
  349. #ifdef DEBUG
  350. #define CONTROL_TAG 'LRTC' //CTRL as seen in memory.
  351. #else
  352. #define CONTROL_TAG
  353. #endif // DEBUG
  354. ///////////////////////////////////////////////////////////////////////
  355. ///////////////////////////////////////////////////////////////////////
  356. // //
  357. // P R O T O T Y P E S //
  358. // //
  359. ///////////////////////////////////////////////////////////////////////
  360. ///////////////////////////////////////////////////////////////////////
  361. ///////////////////////////////////////////////////////////////////////
  362. ///////////////////////////////////////////////////////////////////////
  363. // //
  364. // I N I T I A L I Z A T I O N / D E I N I T I A L I Z A T I O N //
  365. // //
  366. ///////////////////////////////////////////////////////////////////////
  367. ///////////////////////////////////////////////////////////////////////
  368. ///////////////////////////////////////////////////////////////////////
  369. //
  370. // kmxlInit
  371. //
  372. // Retrieves and parses the topology for a given mixer device number.
  373. // The pfo is an open file object to an instance of a filter that
  374. // will provide the topology.
  375. //
  376. //
  377. NTSTATUS
  378. kmxlInit(
  379. IN PFILE_OBJECT pfo, // Handle of the topology driver instance
  380. IN PMIXERDEVICE pMixerDevice // The device to initialize for
  381. );
  382. ///////////////////////////////////////////////////////////////////////
  383. //
  384. // kmxlDeInit
  385. //
  386. // Cleans up all memory for all devices.
  387. //
  388. //
  389. NTSTATUS
  390. kmxlDeInit(
  391. IN PMIXERDEVICE pMixerDevice
  392. );
  393. ///////////////////////////////////////////////////////////////////////
  394. //
  395. // BuildMixerLines
  396. //
  397. // Build the list of mixer lines and stores them into plistLines.
  398. // pcDestinations contains the count of total destinations for the
  399. // given topology, pTopology.
  400. //
  401. //
  402. NTSTATUS
  403. kmxlBuildLines(
  404. IN PMIXERDEVICE pMixer, // The mixer device
  405. IN PFILE_OBJECT pfoInstance, // The FILE_OBJECT of a filter instance
  406. IN OUT LINELIST* plistLines, // Pointer to the list of all lines
  407. IN OUT PULONG pcDestinations, // Pointer to the number of dests
  408. IN OUT PKSTOPOLOGY pTopology // Pointer to a topology structure
  409. );
  410. ///////////////////////////////////////////////////////////////////////
  411. ///////////////////////////////////////////////////////////////////////
  412. // //
  413. // T O P O L O G Y F U N C T I O N S //
  414. // //
  415. ///////////////////////////////////////////////////////////////////////
  416. ///////////////////////////////////////////////////////////////////////
  417. ///////////////////////////////////////////////////////////////////////
  418. //
  419. // QueryTopology
  420. //
  421. // Queries the topology property on the given instance and stores
  422. // it into pTopology. Note that memory is allocated to store the
  423. // topology.
  424. //
  425. //
  426. NTSTATUS
  427. kmxlQueryTopology(
  428. IN PFILE_OBJECT pfoInstance, // The instance to query
  429. OUT PKSTOPOLOGY pTopology // The topology structure to fill in
  430. );
  431. ///////////////////////////////////////////////////////////////////////
  432. //
  433. // ParseTopology
  434. //
  435. // Parses the topology in pTopology and builds a graph of sources and
  436. // destinations. ppSources will contain a list of all sources nodes
  437. // and ppDests will contain a list of dests. The elements in pNodeTable
  438. // will be updated.
  439. //
  440. //
  441. NTSTATUS
  442. kmxlParseTopology(
  443. IN PMIXEROBJECT pmxobj,
  444. OUT NODELIST* ppSources, // Pointer to the sources list to build
  445. OUT NODELIST* ppDests // Pointer to the dests list to build
  446. );
  447. ///////////////////////////////////////////////////////////////////////
  448. //
  449. // BuildChildGraph
  450. //
  451. // For a given node, BuildChildGraph() will build the graph of each
  452. // of the node's children. pNodeTable is updated.
  453. //
  454. //
  455. NTSTATUS
  456. kmxlBuildChildGraph(
  457. IN PMIXEROBJECT pmxobj,
  458. IN NODELIST listDests, // The list of destinations
  459. IN PMXLNODE pNode, // The node to build the graph for
  460. IN ULONG FromNode, // The node's ID
  461. IN ULONG FromNodePin // The Pin connection to look for
  462. );
  463. ///////////////////////////////////////////////////////////////////////
  464. //
  465. // BuildNodeTable
  466. //
  467. // Allocates and fills in the table of nodes for the topology.
  468. //
  469. //
  470. PMXLNODE
  471. kmxlBuildNodeTable(
  472. IN PKSTOPOLOGY pTopology // The topology structure to build from
  473. );
  474. ///////////////////////////////////////////////////////////////////////
  475. //
  476. // FindTopologyConnection
  477. //
  478. // Finds the specified connection, if it exists, starting at the
  479. // StartIndex index into the connections table. It will return the
  480. // index into the connection table of a connection starting from
  481. // the given FromNode and FromNodePin. FromNodePin may be PINID_WILDCARD
  482. // if a connection on a node is present rather than a specific connection.
  483. //
  484. //
  485. ULONG
  486. kmxlFindTopologyConnection(
  487. IN PMIXEROBJECT pmxobj,
  488. //IN CONST KSTOPOLOGY_CONNECTION* pConnections, // The connection table
  489. //IN ULONG cConnections, // The # of connections
  490. IN ULONG StartIndex, // Index to start search
  491. IN ULONG FromNode, // The Node ID to look for
  492. IN ULONG FromNodePin // The Pin ID to look for
  493. );
  494. ///////////////////////////////////////////////////////////////////////
  495. //
  496. // GetProperty
  497. //
  498. // Retrieves the specified property from an open filter. Flags may
  499. // contain values such as KSPROPERTY_TYPE_TOPOLOGY. The output
  500. // buffer is allocated to the correct size and returned by this
  501. // function.
  502. //
  503. //
  504. NTSTATUS
  505. kmxlGetProperty(
  506. PFILE_OBJECT pFileObject, // The instance of the filter
  507. CONST GUID *pguidPropertySet, // The requested property set
  508. ULONG ulPropertyId, // The ID of the specific property
  509. ULONG cbInput, // The number of extra input bytes
  510. PVOID pInputData, // Pointer to the extra input bytes
  511. ULONG Flags, // Additional flags
  512. PVOID *ppPropertyOutput // Pointer to a pointer of the output
  513. );
  514. ///////////////////////////////////////////////////////////////////////
  515. //
  516. // kmxlNodeProperty
  517. //
  518. // NodeProperty() gets or sets the property on an individual node.
  519. // The output is not allocated and must be passed in by the caller.
  520. // Flags can be KSPROPERTY_TYPE_GET or KSPROPERTY_TYPE_SET.
  521. //
  522. //
  523. NTSTATUS
  524. kmxlNodeProperty(
  525. IN PFILE_OBJECT pFileObject, // Instance of the filter owning node
  526. IN CONST GUID* pguidPropertySet, // The GUID of the property set
  527. IN ULONG ulPropertyId, // The specific property in the set
  528. IN ULONG ulNodeId, // The virtual node id
  529. IN ULONG cbInput, // # of extra input bytes
  530. IN PVOID pInputData, // Pointer to the extra input bytes
  531. OUT PVOID pPropertyOutput, // Pointer to the output data
  532. IN ULONG cbPropertyOutput, // Size of the output data buffer
  533. IN ULONG Flags // KSPROPERTY_TYPE_GET or SET
  534. );
  535. ///////////////////////////////////////////////////////////////////////
  536. //
  537. // kmxlGetNodeProperty
  538. //
  539. // Get the specified property for a node. See kmxlNodeProperty for
  540. // details on parameters and returns.
  541. //
  542. //
  543. #define kmxlGetNodeProperty( pfo,pguid,Id,Node,cbIn,pIn,pOut,cbOut ) \
  544. kmxlNodeProperty( pfo,pguid,Id,Node,cbIn,pIn,pOut,cbOut,KSPROPERTY_TYPE_GET )
  545. ///////////////////////////////////////////////////////////////////////
  546. //
  547. // kmxlSetNodeProperty
  548. //
  549. // Sets the specified property for a node. See kmxlNodeProperty for
  550. // details on parameters and returns.
  551. //
  552. //
  553. #define kmxlSetNodeProperty( pfo,pguid,Id,Node,cbIn,pIn,pOut,cbOut ) \
  554. kmxlNodeProperty( pfo,pguid,Id,Node,cbIn,pIn,pOut,cbOut,KSPROPERTY_TYPE_SET )
  555. ///////////////////////////////////////////////////////////////////////
  556. //
  557. // kmxlAudioNodeProperty
  558. //
  559. // Sets or get the audio specific node property. The property set
  560. // is always KSPROPSETID_Audio. lChannel specifies which channel to
  561. // apply the property to. 0 is left, 1 is right, -1 is master (all).
  562. // Flags can be either KSPROPERTY_TYPE_GET or KSPROPERTY_TYPE_SET.
  563. //
  564. //
  565. NTSTATUS
  566. kmxlAudioNodeProperty(
  567. IN PFILE_OBJECT pfo, // Instance of the filter owning node
  568. IN ULONG ulPropertyId, // The audio property to get
  569. IN ULONG ulNodeId, // The virtual node id
  570. IN LONG lChannel, // The channel number
  571. IN PVOID pInData, // Pointer to extra input bytes
  572. IN ULONG cbInData, // Number of extra input bytes
  573. OUT PVOID pOutData, // Pointer to output buffer
  574. IN LONG cbOutData, // Size of the output buffer
  575. IN ULONG Flags // KSPROPERTY_TYPE_GET or SET
  576. );
  577. ///////////////////////////////////////////////////////////////////////
  578. //
  579. // kxmlGetAudioNodeProperty
  580. //
  581. // Gets the specified audio property on a node. See kmxlAudioNodeProperty
  582. // for details on parameters and return values.
  583. //
  584. //
  585. #define kmxlGetAudioNodeProperty(pfo,Id,Node,Chan,pIn,cbIn,pOut,cbOut) \
  586. kmxlAudioNodeProperty( pfo,Id,Node,Chan,pIn,cbIn,pOut,cbOut,KSPROPERTY_TYPE_GET )
  587. ///////////////////////////////////////////////////////////////////////
  588. //
  589. // kxmlSetAudioNodeProperty
  590. //
  591. // Sets the specified audio property on a node. See kmxlAudioNodeProperty
  592. // for details on parameters and return values.
  593. //
  594. //
  595. #define kmxlSetAudioNodeProperty(pfo,Id,Node,Chan,pIn,cbIn,pOut,cbOut) \
  596. kmxlAudioNodeProperty( pfo,Id,Node,Chan,pIn,cbIn,pOut,cbOut,KSPROPERTY_TYPE_SET )
  597. ///////////////////////////////////////////////////////////////////////
  598. //
  599. // kmxlGetPinName
  600. //
  601. // Retrieves the name of the pin given by NodeId.
  602. //
  603. //
  604. VOID
  605. kmxlGetPinName(
  606. IN PFILE_OBJECT pfo, // Instance of the owning filter
  607. IN ULONG PinId, // Id of the pin
  608. IN PMXLLINE pLine // The line to store the name into
  609. );
  610. ///////////////////////////////////////////////////////////////////////
  611. //
  612. // kmxlGetNodeName
  613. //
  614. // Retrieves the name of a node (control).
  615. //
  616. //
  617. VOID
  618. kmxlGetNodeName(
  619. IN PFILE_OBJECT pfo, // Instance of the owning filter
  620. IN ULONG NodeId, // The node id
  621. IN PMXLCONTROL pControl // The control to store the name
  622. );
  623. ///////////////////////////////////////////////////////////////////////
  624. //
  625. // kmxlGetSuperMixCaps
  626. //
  627. //
  628. NTSTATUS
  629. kmxlGetSuperMixCaps(
  630. IN PFILE_OBJECT pfo,
  631. IN ULONG ulNodeId,
  632. OUT PKSAUDIO_MIXCAP_TABLE* paMixCaps
  633. );
  634. ///////////////////////////////////////////////////////////////////////
  635. //
  636. // kmxlQueryPropertyRange
  637. //
  638. //
  639. NTSTATUS
  640. kmxlQueryPropertyRange(
  641. IN PFILE_OBJECT pfo,
  642. IN CONST GUID* pguidPropSet,
  643. IN ULONG ulPropertyId,
  644. IN ULONG ulNodeId,
  645. OUT PKSPROPERTY_DESCRIPTION* ppPropDesc
  646. );
  647. ///////////////////////////////////////////////////////////////////////
  648. //
  649. // kmxlGetControlChannels
  650. //
  651. //
  652. NTSTATUS
  653. kmxlGetControlChannels(
  654. IN PFILE_OBJECT pfo,
  655. IN PMXLCONTROL pControl
  656. );
  657. ///////////////////////////////////////////////////////////////////////
  658. //
  659. // kmxlGetControlRange
  660. //
  661. //
  662. NTSTATUS
  663. kmxlGetControlRange(
  664. IN PFILE_OBJECT pfo,
  665. IN PMXLCONTROL pControl
  666. );
  667. ///////////////////////////////////////////////////////////////////////
  668. //
  669. // kmxlGetNumMuxLines
  670. //
  671. //
  672. DWORD
  673. kmxlGetNumMuxLines(
  674. IN PKSTOPOLOGY pTopology,
  675. IN ULONG NodeId
  676. );
  677. ///////////////////////////////////////////////////////////////////////
  678. //
  679. // kmxlGetMuxLineNames
  680. //
  681. //
  682. VOID
  683. kmxlGetMuxLineNames(
  684. IN PMIXEROBJECT pmxobj,
  685. IN PMXLCONTROL pControl
  686. );
  687. ///////////////////////////////////////////////////////////////////////
  688. ///////////////////////////////////////////////////////////////////////
  689. // //
  690. // M I X E R L I N E F U N C T I O N S //
  691. // //
  692. ///////////////////////////////////////////////////////////////////////
  693. ///////////////////////////////////////////////////////////////////////
  694. ///////////////////////////////////////////////////////////////////////
  695. //
  696. // kmxlBuildDestinationLines
  697. //
  698. // Builds up a list of destination lines given a list of the destination
  699. // nodes.
  700. //
  701. // Returns NULL on error.
  702. //
  703. //
  704. LINELIST
  705. kmxlBuildDestinationLines(
  706. IN PMIXEROBJECT pmxobj,
  707. IN NODELIST listDests // The list of destination nodes
  708. );
  709. ///////////////////////////////////////////////////////////////////////
  710. //
  711. // kmxlBuildDestinationControls
  712. //
  713. // Builds a list of mixer line controls for a given destination line.
  714. //
  715. //
  716. NTSTATUS
  717. kmxlBuildDestinationControls(
  718. IN PMIXEROBJECT pmxobj,
  719. IN PMXLNODE pDest, // The destination to built controls for
  720. IN PMXLLINE pLine // The line to add the controls to
  721. );
  722. ///////////////////////////////////////////////////////////////////////
  723. //
  724. // kmxlBuildSourceLines
  725. //
  726. // Builds a list of mixer source lines for the given topology.
  727. //
  728. //
  729. LINELIST
  730. kmxlBuildSourceLines(
  731. IN PMIXEROBJECT pmxobj,
  732. IN NODELIST listSources, // The list of source nodes
  733. IN NODELIST listDests // The list of dest. nodes
  734. );
  735. ///////////////////////////////////////////////////////////////////////
  736. //
  737. // kmxlBuildPath
  738. //
  739. // Builds the controls for each of the source lines, building new
  740. // source lines of splits are detected in the topology. plistLines
  741. // may have new lines added if splits are encountered. Destinations
  742. // for each of the sources is also determined.
  743. //
  744. //
  745. NTSTATUS
  746. kmxlBuildPath(
  747. IN PMIXEROBJECT pmxobj,
  748. IN PMXLNODE pSource, // The source node for this path
  749. IN PMXLNODE pNode, // The current node in the path
  750. IN PMXLLINE pLine, // The current line
  751. IN OUT LINELIST* plistLines, // The list of lines build so far
  752. IN NODELIST listDests // The list of the destinations
  753. );
  754. ///////////////////////////////////////////////////////////////////////
  755. //
  756. // kmxlIsDestinationNode
  757. //
  758. // Return TRUE if the given node appears in the node list of any
  759. // of the destinations in listDests.
  760. //
  761. //
  762. BOOL
  763. kmxlIsDestinationNode(
  764. IN NODELIST listDests, // The list of destinations
  765. IN PMXLNODE pNode // The node to check
  766. );
  767. ///////////////////////////////////////////////////////////////////////
  768. //
  769. // kmxlDuplicateLine
  770. //
  771. // Duplicates the given line, including all controls on that line.
  772. //
  773. //
  774. NTSTATUS
  775. kmxlDuplicateLine(
  776. IN PMXLLINE* ppTargetLine, // Pointer to the new line
  777. IN PMXLLINE pSourceLine // The line to duplicate
  778. );
  779. ///////////////////////////////////////////////////////////////////////
  780. //
  781. // kmxlDuplicateLineControls
  782. //
  783. // Duplicate up to nCount controls on the source line and stores them
  784. // into the target line.
  785. //
  786. //
  787. NTSTATUS
  788. kmxlDuplicateLineControls(
  789. IN PMXLLINE pTargetLine, // The line to put the controls into
  790. IN PMXLLINE pSourceLine, // The line with the controls to dup
  791. IN ULONG nCount // The number of controls to dup
  792. );
  793. ///////////////////////////////////////////////////////////////////////
  794. //
  795. // kmxlFindDestinationForNode
  796. //
  797. // For a given node, this function finds the destination it is assoicated
  798. // with. plistLines needs to be included since new lines will need to
  799. // be created if a split is encountered in the topology.
  800. //
  801. //
  802. ULONG
  803. kmxlFindDestinationForNode(
  804. IN PMIXEROBJECT pmxobj,
  805. IN PMXLNODE pNode, // The node to find dest for
  806. IN PMXLNODE pParent, // The original parent
  807. IN PMXLLINE pLine, // The current line it's on
  808. IN OUT LINELIST* plistLines // The list of all lines
  809. );
  810. ///////////////////////////////////////////////////////////////////////
  811. //
  812. // kmxlBuildVirtualMuxLine
  813. //
  814. //
  815. NTSTATUS
  816. kmxlBuildVirtualMuxLine(
  817. IN PMIXEROBJECT pmxobj,
  818. IN PMXLNODE pParent,
  819. IN PMXLNODE pMux,
  820. IN OUT LINELIST* plistLines
  821. );
  822. ///////////////////////////////////////////////////////////////////////
  823. //
  824. // kmxlAssignLineAndControlIds
  825. //
  826. // For a specific set of lines, this function assigns the mixer line
  827. // line Ids and controls Ids. Only sources or only destinations can
  828. // be assigned per call.
  829. //
  830. //
  831. NTSTATUS
  832. kmxlAssignLineAndControlIds(
  833. IN PMIXEROBJECT pmxobj,
  834. IN LINELIST listLines, // The list to assign ids for
  835. IN ULONG ListType // LIST_SOURCE or LIST_DESTINATION
  836. );
  837. ///////////////////////////////////////////////////////////////////////
  838. //
  839. // kmxlAssignDestinationsToSources
  840. //
  841. // For each line, the destination field of the MIXERLINE structure
  842. // is filled in and a unique LineId is assigned.
  843. //
  844. //
  845. NTSTATUS
  846. kmxlAssignDestinationsToSources(
  847. IN LINELIST listSourceLines, // The list of all source lines
  848. IN LINELIST listDestLines // The list of all dest lines
  849. );
  850. ///////////////////////////////////////////////////////////////////////
  851. //
  852. // kmxlAssignMuxIds
  853. //
  854. //
  855. NTSTATUS
  856. kmxlAssignMuxIds(
  857. IN PMIXEROBJECT pmxobj,
  858. IN LINELIST listSourceLines
  859. );
  860. ///////////////////////////////////////////////////////////////////////
  861. //
  862. // TranslateNodeToControl
  863. //
  864. // Translates the node specified by its GUID into 0 or more mixer
  865. // line controls. The return value indicates how many controls
  866. // the node was really translated into.
  867. //
  868. //
  869. ULONG
  870. kmxlTranslateNodeToControl(
  871. IN PMIXEROBJECT pmxobj,
  872. IN PMXLNODE pNode, // The node to translate into a control
  873. OUT PMXLCONTROL* ppControl // The control to fill in
  874. );
  875. ///////////////////////////////////////////////////////////////////////
  876. //
  877. // kmxlSupportsControl
  878. //
  879. // Queries for property on control to see if it is actually supported
  880. //
  881. //
  882. NTSTATUS
  883. kmxlSupportsControl(
  884. IN PFILE_OBJECT pfoInstance, // The instance to check for
  885. IN ULONG Node, // The node ID on the instance
  886. IN ULONG Property // The property to query support
  887. );
  888. ///////////////////////////////////////////////////////////////////////
  889. //
  890. // kmxlSupportsMultiChannelControl
  891. //
  892. // Queries for property on the second channel of the control to see
  893. // independent levels can be set. It is assumed that the first channel
  894. // already succeeded in kmxlSupportsControl
  895. //
  896. //
  897. NTSTATUS
  898. kmxlSupportsMultiChannelControl(
  899. IN PFILE_OBJECT pfoInstance, // The instance to check for
  900. IN ULONG Node, // The node id to query
  901. IN ULONG Property // The property to check for
  902. );
  903. ///////////////////////////////////////////////////////////////////////
  904. //
  905. // kmxlSupportsTrebleControl
  906. //
  907. // Querys the node to see if it supports KSPROPERTY_AUDIO_TREBLE.
  908. // See kmxlSupportsControl for return value details.
  909. //
  910. //
  911. #define kmxlSupportsTrebleControl( pfo, Node ) \
  912. kmxlSupportsControl( pfo, Node, KSPROPERTY_AUDIO_TREBLE )
  913. ///////////////////////////////////////////////////////////////////////
  914. //
  915. // kmxlSupportsBassControl
  916. //
  917. // Querys the node to see if it supports KSPROPERTY_AUDIO_BASS.
  918. // See kmxlSupportsControl for return value details.
  919. //
  920. //
  921. #define kmxlSupportsBassControl( pfo, Node ) \
  922. kmxlSupportsControl( pfo, Node, KSPROPERTY_AUDIO_BASS )
  923. ///////////////////////////////////////////////////////////////////////
  924. //
  925. // kmxlUpdateDestinationConnectionCount
  926. //
  927. // Counts the number of sources mapping to a single destination and
  928. // stores that value in the MIXERLINE.cConnections field for that
  929. // destination.
  930. //
  931. //
  932. NTSTATUS
  933. kmxlUpdateDestintationConnectionCount(
  934. IN LINELIST listSourceLines, // The list of sources
  935. IN LINELIST listDestLines // The list of destinations
  936. );
  937. ///////////////////////////////////////////////////////////////////////
  938. //
  939. // kmxlElminiateInvalidLines
  940. //
  941. // Loops through all the lines and eliminates the ones that are
  942. // invalid by the IsValidLine() macro function test.
  943. //
  944. //
  945. NTSTATUS
  946. kmxlEliminateInvalidLines(
  947. IN LINELIST* listLines // The list of sources
  948. );
  949. ///////////////////////////////////////////////////////////////////////
  950. //
  951. // kmxlAssignComponentIds
  952. //
  953. // For each source and destination line, it assignes the
  954. // MIXERLINE.dwComonentType field for that line.
  955. //
  956. //
  957. VOID
  958. kmxlAssignComponentIds(
  959. IN PMIXEROBJECT pmxobj, // Instance data
  960. IN LINELIST listSourceLines, // The list of source lines
  961. IN LINELIST listDestLines // The list of destination lines
  962. );
  963. ///////////////////////////////////////////////////////////////////////
  964. //
  965. // kmxlDetermineDestinationType
  966. //
  967. // Determines the dwComponentId and Target.dwType fields for the
  968. // given line. Determination is made by the MXLLINE.Type field.
  969. //
  970. //
  971. ULONG
  972. kmxlDetermineDestinationType(
  973. IN PMIXEROBJECT pmxobj, // Instance data
  974. IN PMXLLINE pLine // The line to update
  975. );
  976. ///////////////////////////////////////////////////////////////////////
  977. //
  978. // kmxlDetermineSourceType
  979. //
  980. // Determines the dwComponentId and Target.dwType fields for the
  981. // given line. Determination is made by the MXLLINE.Type field.
  982. //
  983. //
  984. ULONG
  985. kmxlDetermineSourceType(
  986. IN PMIXEROBJECT pmxobj, // Instance data
  987. IN PMXLLINE pLine // The line to update
  988. );
  989. ///////////////////////////////////////////////////////////////////////
  990. ///////////////////////////////////////////////////////////////////////
  991. // //
  992. // U T I L I T Y F U N C T I O N S //
  993. // //
  994. ///////////////////////////////////////////////////////////////////////
  995. ///////////////////////////////////////////////////////////////////////
  996. ///////////////////////////////////////////////////////////////////////
  997. //
  998. // kmxlOpenSysAudio
  999. //
  1000. // Opens the SysAudio device and returns the file object.
  1001. //
  1002. //
  1003. PFILE_OBJECT
  1004. kmxlOpenSysAudio(
  1005. );
  1006. ///////////////////////////////////////////////////////////////////////
  1007. //
  1008. // kmxlCloseSysAudio
  1009. //
  1010. // Closes the SysAudio device opened by kmxlOpenSysAudio.
  1011. //
  1012. //
  1013. VOID
  1014. kmxlCloseSysAudio(
  1015. IN PFILE_OBJECT pfo // The instance to close
  1016. );
  1017. ///////////////////////////////////////////////////////////////////////
  1018. //
  1019. // kmxlFindDestination
  1020. //
  1021. // Finds a destination id in the list of all the destinations and returns
  1022. // a pointer to that node. Returns NULL on failure.
  1023. //
  1024. //
  1025. PMXLNODE
  1026. kmxlFindDestination(
  1027. IN NODELIST listDests, // The list of destinations to search
  1028. IN ULONG Id // The node Id to look for in the list
  1029. );
  1030. ///////////////////////////////////////////////////////////////////////
  1031. //
  1032. // kmxlAppendListToList
  1033. //
  1034. // Appends listSource onto the front of plistTarget.
  1035. //
  1036. //
  1037. VOID
  1038. kmxlAppendListToList(
  1039. IN OUT PSLIST* plistTarget, // The list to append to
  1040. IN PSLIST listSource // the list to append
  1041. );
  1042. ///////////////////////////////////////////////////////////////////////
  1043. //
  1044. // kmxlAppendListToList
  1045. //
  1046. // Appends listSource onto the end of plistTarget
  1047. //
  1048. //
  1049. VOID
  1050. kmxlAppendListToEndOfList(
  1051. IN OUT PSLIST* plistTarget, // The list to append to
  1052. IN PSLIST listSource // the list to append
  1053. );
  1054. ///////////////////////////////////////////////////////////////////////
  1055. //
  1056. // kmxlListCount
  1057. //
  1058. // Returns the number of elements in the list.
  1059. //
  1060. //
  1061. ULONG
  1062. kmxlListCount(
  1063. IN PSLIST pList // The list to count the elements of
  1064. );
  1065. ///////////////////////////////////////////////////////////////////////
  1066. //
  1067. // kmxlInList
  1068. //
  1069. // Return TRUE if pNewNode is in the list.
  1070. //
  1071. //
  1072. BOOL
  1073. kmxlInList(
  1074. IN PEERLIST list, // The list to search
  1075. IN PMXLNODE pNewNode // The new to search for
  1076. );
  1077. ///////////////////////////////////////////////////////////////////////
  1078. //
  1079. // kmxlAddElemToEndOfList
  1080. //
  1081. // Adds an element to the end of the given list.
  1082. //
  1083. //
  1084. VOID
  1085. kmxlAddElemToEndOfList(
  1086. IN OUT PSLIST* list, // The list to add to the end of
  1087. IN PSLIST elem // The element or list to add
  1088. );
  1089. ///////////////////////////////////////////////////////////////////////
  1090. //
  1091. // kmxlInChildList
  1092. //
  1093. // Return TRUE if pNewNode is contained in the child list of the list.
  1094. //
  1095. //
  1096. BOOL
  1097. kmxlInChildList(
  1098. IN NODELIST list, // The list to search the parent list
  1099. IN PMXLNODE pNewNode // The node to search for
  1100. );
  1101. ///////////////////////////////////////////////////////////////////////
  1102. //
  1103. // kmxlInParentList
  1104. //
  1105. // Returns TRUE if pNewNode is contained in the parent list of the list.
  1106. //
  1107. //
  1108. BOOL
  1109. kmxlInParentList(
  1110. IN NODELIST list, // The list to search the parent list
  1111. IN PMXLNODE pNewNode // The node to search for
  1112. );
  1113. ///////////////////////////////////////////////////////////////////////
  1114. //
  1115. // kmxlSortByDestination
  1116. //
  1117. // Sorts the given list by destination id in increasing order.
  1118. //
  1119. //
  1120. NTSTATUS
  1121. kmxlSortByDestination(
  1122. IN LINELIST* list // The pointer to the list to sort
  1123. );
  1124. ///////////////////////////////////////////////////////////////////////
  1125. //
  1126. // kmxlVolLinearToLog
  1127. //
  1128. //
  1129. LONG
  1130. kmxlVolLinearToLog(
  1131. IN PMXLCONTROL pControl,
  1132. IN DWORD dwLin,
  1133. IN MIXERMAPPING Mapping,
  1134. IN ULONG Channel
  1135. );
  1136. ///////////////////////////////////////////////////////////////////////
  1137. //
  1138. // kmxlVolLogToLinear
  1139. //
  1140. //
  1141. DWORD
  1142. kmxlVolLogToLinear(
  1143. IN PMXLCONTROL pControl,
  1144. IN LONG lLog,
  1145. IN MIXERMAPPING Mapping,
  1146. IN ULONG Channel
  1147. );
  1148. ///////////////////////////////////////////////////////////////////////
  1149. ///////////////////////////////////////////////////////////////////////
  1150. // //
  1151. // M E M O R Y A L L O C A T I O N / D E A L L O C A T I O N //
  1152. // //
  1153. ///////////////////////////////////////////////////////////////////////
  1154. ///////////////////////////////////////////////////////////////////////
  1155. ///////////////////////////////////////////////////////////////////////
  1156. //
  1157. // kmxlAllocMem
  1158. //
  1159. // Allocates size bytes and stores that pointer in pp. Returns
  1160. // STATUS_SUCCESS or another STATUS failure code.
  1161. //
  1162. //
  1163. //NTSTATUS
  1164. //kmxlAllocMem(
  1165. // IN PVOID *pp, // Pointer to put the new memory in
  1166. // IN ULONG size, // The number of bytes to allocate
  1167. // IN ULONG ultag
  1168. //);
  1169. ///////////////////////////////////////////////////////////////////////
  1170. //
  1171. // kmxlAllocDeviceInfo
  1172. //
  1173. NTSTATUS kmxlAllocDeviceInfo(
  1174. OUT LPDEVICEINFO *pp,
  1175. PCWSTR DeviceInterface,
  1176. DWORD dwFlags,
  1177. ULONG ultag
  1178. );
  1179. ///////////////////////////////////////////////////////////////////////
  1180. //
  1181. // kmxlFreeMem
  1182. //
  1183. //
  1184. // Frees the memory pointed to by p. Does nothing if p is NULL.
  1185. //
  1186. //
  1187. //VOID
  1188. //kmxlFreeMem(
  1189. // IN PVOID p // The pointer to the buffer to free
  1190. //);
  1191. ///////////////////////////////////////////////////////////////////////
  1192. //
  1193. // kmxlFreePeerList
  1194. //
  1195. // Loops through a peer list freeing all the peer nodes.
  1196. //
  1197. //
  1198. VOID
  1199. kmxlFreePeerList(
  1200. IN PEERLIST list // The PeerList to free
  1201. );
  1202. ///////////////////////////////////////////////////////////////////////
  1203. //
  1204. // kmxlAllocateControl
  1205. //
  1206. // Allocates and zero fills a new MXLCONTROL structure.
  1207. //
  1208. //
  1209. MXLCONTROL*
  1210. kmxlAllocateControl(
  1211. IN ULONG ultag
  1212. );
  1213. VOID kmxlFreeControl(
  1214. IN PMXLCONTROL pControl
  1215. );
  1216. ///////////////////////////////////////////////////////////////////////
  1217. //
  1218. // kmxlAllocateLine
  1219. //
  1220. // Allocates and zero filles a new MXLLINE structure.
  1221. //
  1222. //
  1223. MXLLINE*
  1224. kmxlAllocateLine(
  1225. IN ULONG ultag
  1226. );
  1227. ///////////////////////////////////////////////////////////////////////
  1228. //
  1229. // kmxlAllocateNode
  1230. //
  1231. // Allocates and zero filles a new MXLNODE structure.
  1232. //
  1233. //
  1234. MXLNODE*
  1235. kmxlAllocateNode(
  1236. IN ULONG ultag
  1237. );
  1238. ///////////////////////////////////////////////////////////////////////
  1239. //
  1240. // kmxlAllocatePeerNode
  1241. //
  1242. // Allocates and zero fills a new PEERNODE structure.
  1243. //
  1244. //
  1245. PEERNODE*
  1246. kmxlAllocatePeerNode(
  1247. IN PMXLNODE pNode OPTIONAL, // The node to associate with the peer
  1248. IN ULONG ultag
  1249. );
  1250. ///////////////////////////////////////////////////////////////////////
  1251. ///////////////////////////////////////////////////////////////////////
  1252. // //
  1253. // P E R S I S T A N C E F U N C T I O N S //
  1254. // //
  1255. ///////////////////////////////////////////////////////////////////////
  1256. ///////////////////////////////////////////////////////////////////////
  1257. NTSTATUS
  1258. kmxlOpenInterfaceKey(
  1259. IN PFILE_OBJECT pfo,
  1260. IN ULONG Device,
  1261. OUT HANDLE* phKey
  1262. );
  1263. NTSTATUS
  1264. kmxlRegQueryValue(
  1265. IN HANDLE hKey,
  1266. IN PWCHAR szValueName,
  1267. IN PVOID pData,
  1268. IN ULONG cbData,
  1269. OUT PULONG pResultLength
  1270. );
  1271. ///////////////////////////////////////////////////////////////////////
  1272. //
  1273. // kmxlRegCloseKey
  1274. //
  1275. // Closes the given key and NULLs the pointer.
  1276. //
  1277. //
  1278. #define kmxlRegCloseKey( hKey ) \
  1279. { \
  1280. ZwClose( hKey ); \
  1281. hKey = NULL; \
  1282. }
  1283. ///////////////////////////////////////////////////////////////////////
  1284. //
  1285. // PinCategoryToString
  1286. //
  1287. // Translates a PinCategory GUID into a string.
  1288. //
  1289. //
  1290. const char*
  1291. PinCategoryToString
  1292. (
  1293. IN CONST GUID* NodeType // The node to translate
  1294. );
  1295. ///////////////////////////////////////////////////////////////////////
  1296. //
  1297. // NodeTypeToString
  1298. //
  1299. // Translates a NodeType GUID to a string.
  1300. //
  1301. //
  1302. const char*
  1303. NodeTypeToString
  1304. (
  1305. IN CONST GUID* NodeType // The node to translate
  1306. );
  1307. #define ControlTypeToString( dwType ) \
  1308. (dwType) == MIXERCONTROL_CONTROLTYPE_BOOLEAN ? "Boolean" : \
  1309. (dwType) == MIXERCONTROL_CONTROLTYPE_ONOFF ? "On Off" : \
  1310. (dwType) == MIXERCONTROL_CONTROLTYPE_MUTE ? "Mute" : \
  1311. (dwType) == MIXERCONTROL_CONTROLTYPE_MONO ? "Mono" : \
  1312. (dwType) == MIXERCONTROL_CONTROLTYPE_LOUDNESS ? "Loudness" : \
  1313. (dwType) == MIXERCONTROL_CONTROLTYPE_STEREOENH ? "Stereo Enhance" : \
  1314. (dwType) == MIXERCONTROL_CONTROLTYPE_VOLUME ? "Volume" : \
  1315. (dwType) == MIXERCONTROL_CONTROLTYPE_BASS ? "Bass" : \
  1316. (dwType) == MIXERCONTROL_CONTROLTYPE_TREBLE ? "Treble" : \
  1317. (dwType) == MIXERCONTROL_CONTROLTYPE_BASS_BOOST ? "Bass Boost" : \
  1318. (dwType) == MIXERCONTROL_CONTROLTYPE_PEAKMETER ? "Peakmeter" : \
  1319. (dwType) == MIXERCONTROL_CONTROLTYPE_MUX ? "Mux" : \
  1320. (dwType) == MIXERCONTROL_CONTROLTYPE_MIXER ? "Mixer" : \
  1321. "Unknown ControlType"
  1322. ///////////////////////////////////////////////////////////////////////
  1323. //
  1324. // ComponentTypeToString
  1325. //
  1326. // Translates one of the MIXERLINE_COMPONENTTYPE constants to a string.
  1327. //
  1328. //
  1329. #define ComponentTypeToString( dwType ) \
  1330. (dwType) == MIXERLINE_COMPONENTTYPE_DST_DIGITAL ? "Digital line" : \
  1331. (dwType) == MIXERLINE_COMPONENTTYPE_DST_HEADPHONES ? "Headphones" : \
  1332. (dwType) == MIXERLINE_COMPONENTTYPE_DST_LINE ? "Line" : \
  1333. (dwType) == MIXERLINE_COMPONENTTYPE_DST_MONITOR ? "Monitor" : \
  1334. (dwType) == MIXERLINE_COMPONENTTYPE_DST_SPEAKERS ? "Speakers" : \
  1335. (dwType) == MIXERLINE_COMPONENTTYPE_DST_TELEPHONE ? "Telephone" : \
  1336. (dwType) == MIXERLINE_COMPONENTTYPE_DST_UNDEFINED ? "Undefined" : \
  1337. (dwType) == MIXERLINE_COMPONENTTYPE_DST_VOICEIN ? "Voicein" : \
  1338. (dwType) == MIXERLINE_COMPONENTTYPE_DST_WAVEIN ? "Wavein" : \
  1339. (dwType) == MIXERLINE_COMPONENTTYPE_SRC_ANALOG ? "Analog line" : \
  1340. (dwType) == MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY ? "Auxiliary" : \
  1341. (dwType) == MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC ? "Compact disc" : \
  1342. (dwType) == MIXERLINE_COMPONENTTYPE_SRC_DIGITAL ? "Digital line" : \
  1343. (dwType) == MIXERLINE_COMPONENTTYPE_SRC_LINE ? "Line" : \
  1344. (dwType) == MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE ? "Microphone" : \
  1345. (dwType) == MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER ? "PC Speaker" : \
  1346. (dwType) == MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER ? "Synthesizer" : \
  1347. (dwType) == MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE ? "Telephone" : \
  1348. (dwType) == MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED ? "Undefined" : \
  1349. (dwType) == MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT ? "Waveout" : \
  1350. "Unknown ComponentType"
  1351. ///////////////////////////////////////////////////////////////////////
  1352. //
  1353. // TargetTypeToString
  1354. //
  1355. // Translates one of hte MIXERLINE_TARGETTYPE constants to a string.
  1356. //
  1357. //
  1358. #define TargetTypeToString( dwType ) \
  1359. (dwType) == MIXERLINE_TARGETTYPE_AUX ? "Aux" : \
  1360. (dwType) == MIXERLINE_TARGETTYPE_MIDIIN ? "MidiIn" : \
  1361. (dwType) == MIXERLINE_TARGETTYPE_MIDIOUT ? "MidiOut" : \
  1362. (dwType) == MIXERLINE_TARGETTYPE_UNDEFINED ? "Undefined" : \
  1363. (dwType) == MIXERLINE_TARGETTYPE_WAVEIN ? "WaveIn" : \
  1364. (dwType) == MIXERLINE_TARGETTYPE_WAVEOUT ? "WaveOut" : \
  1365. "Unknown TargetType"
  1366. ///////////////////////////////////////////////////////////////////////
  1367. ///////////////////////////////////////////////////////////////////////
  1368. // //
  1369. // D E B U G O N L Y F U N C T I O N S //
  1370. // //
  1371. ///////////////////////////////////////////////////////////////////////
  1372. ///////////////////////////////////////////////////////////////////////
  1373. #ifdef DEBUG
  1374. ///////////////////////////////////////////////////////////////////////
  1375. //
  1376. // LineFlagsToString
  1377. //
  1378. // Converts on of the MIXERLINE_LINEF flags to a string.
  1379. //
  1380. //
  1381. #define LineFlagsToString( fdwFlags ) \
  1382. ( fdwFlags & MIXERLINE_LINEF_ACTIVE ) ? "ACTIVE " : \
  1383. ( fdwFlags & MIXERLINE_LINEF_DISCONNECTED ) ? "DISCONNECTED " : \
  1384. ( fdwFlags & MIXERLINE_LINEF_SOURCE ) ? "SOURCE " : \
  1385. "Unknown"
  1386. ///////////////////////////////////////////////////////////////////////
  1387. //
  1388. // DumpChildGraph
  1389. //
  1390. // For a given node, it dumps the child of that node onto the debug
  1391. // monitor. CurrentIndent is the number of spaces to indent before
  1392. // display.
  1393. //
  1394. //
  1395. VOID
  1396. DumpChildGraph(
  1397. IN PMXLNODE pNode, // The node to display the children of
  1398. IN ULONG CurrentIndent // The number of spaces to ident
  1399. );
  1400. ///////////////////////////////////////////////////////////////////////
  1401. //
  1402. // DumpMemList
  1403. //
  1404. // Dumps the list of currently allocated memory blocks.
  1405. //
  1406. //
  1407. VOID
  1408. DumpMemList(
  1409. );
  1410. #endif // DEBUG
  1411. VOID GetHardwareEventData(LPDEVICEINFO pDeviceInfo);
  1412. #endif // _MIXER_H_INCLUDED