IPart.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. // -----------------------------------------
  2. // SoundScribe (TM) and related software.
  3. //
  4. // Copyright (C) 2007-2011 Vannatech
  5. // http://www.vannatech.com
  6. // All rights reserved.
  7. //
  8. // This source code is subject to the MIT License.
  9. // http://www.opensource.org/licenses/mit-license.php
  10. //
  11. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17. // THE SOFTWARE.
  18. // -----------------------------------------
  19. using System;
  20. using System.Runtime.InteropServices;
  21. using Vannatech.CoreAudio.Enumerations;
  22. namespace Vannatech.CoreAudio.Interfaces
  23. {
  24. /// <summary>
  25. /// Represents a part (connector or subunit) of a device topology.
  26. /// </summary>
  27. /// <remarks>
  28. /// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd371429.aspx
  29. /// </remarks>
  30. public partial interface IPart
  31. {
  32. /// <summary>
  33. /// Gets the friendly name of this part.
  34. /// </summary>
  35. /// <param name="name">Receives the friendly name of this part.</param>
  36. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  37. [PreserveSig]
  38. int GetName(
  39. [Out] [MarshalAs(UnmanagedType.LPWStr)] out string name);
  40. /// <summary>
  41. /// Gets the local ID of this part.
  42. /// </summary>
  43. /// <param name="localId">Receives the local ID of this part.</param>
  44. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  45. [PreserveSig]
  46. int GetLocalId(
  47. [Out] [MarshalAs(UnmanagedType.U4)] out UInt32 localId);
  48. /// <summary>
  49. /// Gets the global ID of this part.
  50. /// </summary>
  51. /// <param name="globalId">Receives a string that contains the global ID.</param>
  52. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  53. [PreserveSig]
  54. int GetGlobalId(
  55. [Out] [MarshalAs(UnmanagedType.LPWStr)] out string globalId);
  56. /// <summary>
  57. /// Gets the part type of this part.
  58. /// </summary>
  59. /// <param name="partType">Receives the method writes the part type.</param>
  60. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  61. [PreserveSig]
  62. int GetPartType(
  63. [Out] out PartType partType);
  64. /// <summary>
  65. /// Gets the part subtype of this part.
  66. /// </summary>
  67. /// <param name="subType">Receives the subtype ID for this part.</param>
  68. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  69. [PreserveSig]
  70. int GetSubType(
  71. [Out] out Guid subType);
  72. /// <summary>
  73. /// Gets the number of control interfaces that this part supports.
  74. /// </summary>
  75. /// <param name="count">Receives the number of control interfaces on this part.</param>
  76. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  77. [PreserveSig]
  78. int GetControlInterfaceCount(
  79. [Out] [MarshalAs(UnmanagedType.U4)] out UInt32 count);
  80. /// <summary>
  81. /// Gets a reference to the specified control interface, if this part supports it.
  82. /// </summary>
  83. /// <param name="index">The zero-based index of the control interface.</param>
  84. /// <param name="control">Receives the <see cref="IControlInterface"/> interface of the specified audio function.</param>
  85. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  86. [PreserveSig]
  87. int GetControlInterface(
  88. [In] [MarshalAs(UnmanagedType.U4)] UInt32 index,
  89. [Out] [MarshalAs(UnmanagedType.Interface)] out IControlInterface control);
  90. /// <summary>
  91. /// Retrieves a list of all the parts that reside on data paths that are upstream from this part.
  92. /// </summary>
  93. /// <param name="partList">Receives an <see cref="IPartsList"/> interface that encapsulates the list of parts that are immediately upstream from this part.</param>
  94. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  95. [PreserveSig]
  96. int EnumPartsIncoming(
  97. [Out] [MarshalAs(UnmanagedType.Interface)] out IPartsList partList);
  98. /// <summary>
  99. /// Retrieves a list of all the parts that reside on data paths that are downstream from this part.
  100. /// </summary>
  101. /// <param name="partList">Receives an <see cref="IPartsList"/> interface that encapsulates the list of parts that are immediately downstream from this part.</param>
  102. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  103. [PreserveSig]
  104. int EnumPartsOutgoing(
  105. [Out] [MarshalAs(UnmanagedType.Interface)] out IPartsList partList);
  106. /// <summary>
  107. /// Gets a reference to the <see cref="IDeviceTopology"/> interface of the device topology object that contains this part.
  108. /// </summary>
  109. /// <param name="deviceTopology">Receives the <see cref="IDeviceTopology"/> interface of the device topology object.</param>
  110. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  111. [PreserveSig]
  112. int GetTopologyObject(
  113. [Out] [MarshalAs(UnmanagedType.Interface)] out IDeviceTopology deviceTopology);
  114. /// <summary>
  115. /// Activates an interface on a connector or subunit.
  116. /// </summary>
  117. /// <param name="classContext">The execution context in which the code that manages the newly created object will run.</param>
  118. /// <param name="interfaceId">The interface ID for the requested control function.</param>
  119. /// <param name="instancePtr">Receives the address of an instance implementing the interface specified by the interfaceId parameter.</param>
  120. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  121. [PreserveSig]
  122. int Activate(
  123. [In] UInt32 classContext,
  124. [In] ref Guid interfaceId,
  125. [Out, Optional] [MarshalAs(UnmanagedType.IUnknown)] out object instancePtr);
  126. /// <summary>
  127. /// Registers the <see cref="IControlChangeNotify"/> interface, which the client implements to receive notifications of status changes in this part.
  128. /// </summary>
  129. /// <param name="interfaceId">The function-specific control interface that is to be monitored for control changes.</param>
  130. /// <param name="client">A client object that implements the <see cref="IControlChangeNotify"/> interface.</param>
  131. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  132. [PreserveSig]
  133. int RegisterControlChangeCallback(
  134. [In] ref Guid interfaceId,
  135. [In] IControlChangeNotify client);
  136. /// <summary>
  137. /// Removes a previous registration of an <see cref="IControlChangeNotify"/> interface.
  138. /// </summary>
  139. /// <param name="client">The client whose registration is to be removed.</param>
  140. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  141. [PreserveSig]
  142. int UnregisterControlChangeCallback(
  143. [In] IControlChangeNotify client);
  144. }
  145. }