IAudioSessionManager2.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. namespace Vannatech.CoreAudio.Interfaces
  22. {
  23. /// <summary>
  24. /// Enables an application to manage submixes for the audio device.
  25. /// </summary>
  26. /// <remarks>
  27. /// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370950.aspx
  28. /// </remarks>
  29. public partial interface IAudioSessionManager2
  30. {
  31. // Note: We can't derive from IAudioSessionControl, as that will produce the wrong vtable.
  32. #region IAudioSessionManager Methods
  33. /// <summary>
  34. /// Retrieves an audio session control.
  35. /// </summary>
  36. /// <param name="sessionId">A new or existing session ID.</param>
  37. /// <param name="streamFlags">Audio session flags.</param>
  38. /// <param name="sessionControl">Receives an <see cref="IAudioSessionControl"/> interface for the audio session.</param>
  39. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  40. [PreserveSig]
  41. int GetAudioSessionControl(
  42. [In, Optional] [MarshalAs(UnmanagedType.LPStruct)] Guid sessionId,
  43. [In] [MarshalAs(UnmanagedType.U4)] UInt32 streamFlags,
  44. [Out] [MarshalAs(UnmanagedType.Interface)] out IAudioSessionControl sessionControl);
  45. /// <summary>
  46. /// Retrieves a simple audio volume control.
  47. /// </summary>
  48. /// <param name="sessionId">A new or existing session ID.</param>
  49. /// <param name="streamFlags">Audio session flags.</param>
  50. /// <param name="audioVolume">Receives an <see cref="ISimpleAudioVolume"/> interface for the audio session.</param>
  51. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  52. [PreserveSig]
  53. int GetSimpleAudioVolume(
  54. [In, Optional] [MarshalAs(UnmanagedType.LPStruct)] Guid sessionId,
  55. [In] [MarshalAs(UnmanagedType.U4)] UInt32 streamFlags,
  56. [Out] [MarshalAs(UnmanagedType.Interface)] out ISimpleAudioVolume audioVolume);
  57. #endregion
  58. /// <summary>
  59. /// Gets a pointer to the audio session enumerator object used to enumerate sessions.
  60. /// </summary>
  61. /// <param name="sessionList">Receives the session enumerator object that the client can use to enumerate audio sessions on the audio device.</param>
  62. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  63. [PreserveSig]
  64. int GetSessionEnumerator(
  65. [Out] [MarshalAs(UnmanagedType.Interface)] out IAudioSessionEnumerator sessionList);
  66. /// <summary>
  67. /// Registers the application to receive a notification when a session is created.
  68. /// </summary>
  69. /// <param name="client">The client to be called when session events are raised.</param>
  70. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  71. [PreserveSig]
  72. int RegisterSessionNotification(
  73. [In] IAudioSessionNotification client);
  74. /// <summary>
  75. /// Deletes the registration to receive a notification when a session is created.
  76. /// </summary>
  77. /// <param name="client">Removes the client from the callback list for session events.</param>
  78. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  79. [PreserveSig]
  80. int UnregisterSessionNotification(
  81. [In] IAudioSessionNotification client);
  82. /// <summary>
  83. /// Registers the application to receive ducking notifications.
  84. /// </summary>
  85. /// <param name="sessionId">A session instance identifier.</param>
  86. /// <param name="client">The client to be called when ducking events are raised.</param>
  87. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  88. [PreserveSig]
  89. int RegisterDuckNotification(
  90. [In] [MarshalAs(UnmanagedType.LPWStr)] string sessionId,
  91. [In] IAudioVolumeDuckNotification client);
  92. /// <summary>
  93. /// Deletes the registration to receive ducking notifications.
  94. /// </summary>
  95. /// <param name="client">Removes the client from the callback list for ducking events.</param>
  96. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  97. [PreserveSig]
  98. int UnregisterDuckNotification(
  99. [In] IAudioVolumeDuckNotification client);
  100. }
  101. }