IAudioSessionEvents.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. /// Provides notifications of session-related events such as changes in the volume level, display name, and session state.
  26. /// </summary>
  27. /// <remarks>
  28. /// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd368289.aspx
  29. /// </remarks>
  30. public partial interface IAudioSessionEvents
  31. {
  32. /// <summary>
  33. /// Notifies the client that the display name for the session has changed.
  34. /// </summary>
  35. /// <param name="displayName">The new display name for the session.</param>
  36. /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
  37. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  38. [PreserveSig]
  39. int OnDisplayNameChanged(
  40. [In] [MarshalAs(UnmanagedType.LPWStr)] string displayName,
  41. [In] ref Guid eventContext);
  42. /// <summary>
  43. /// Notifies the client that the display icon for the session has changed.
  44. /// </summary>
  45. /// <param name="iconPath">The path for the new display icon for the session.</param>
  46. /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
  47. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  48. [PreserveSig]
  49. int OnIconPathChanged(
  50. [In] [MarshalAs(UnmanagedType.LPWStr)] string iconPath,
  51. [In] ref Guid eventContext);
  52. /// <summary>
  53. /// Notifies the client that the volume level or muting state of the session has changed.
  54. /// </summary>
  55. /// <param name="volume">The new volume level for the audio session.</param>
  56. /// <param name="isMuted">The new muting state.</param>
  57. /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
  58. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  59. [PreserveSig]
  60. int OnSimpleVolumeChanged(
  61. [In] [MarshalAs(UnmanagedType.R4)] float volume,
  62. [In] [MarshalAs(UnmanagedType.Bool)] bool isMuted,
  63. [In] ref Guid eventContext);
  64. /// <summary>
  65. /// Notifies the client that the volume level of an audio channel in the session submix has changed.
  66. /// </summary>
  67. /// <param name="channelCount">The channel count.</param>
  68. /// <param name="newVolumes">An array of volumnes cooresponding with each channel index.</param>
  69. /// <param name="channelIndex">The number of the channel whose volume level changed.</param>
  70. /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
  71. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  72. [PreserveSig]
  73. int OnChannelVolumeChanged(
  74. [In] [MarshalAs(UnmanagedType.U4)] UInt32 channelCount,
  75. [In] [MarshalAs(UnmanagedType.SysInt)] IntPtr newVolumes, // Pointer to float array
  76. [In] [MarshalAs(UnmanagedType.U4)] UInt32 channelIndex,
  77. [In] ref Guid eventContext);
  78. /// <summary>
  79. /// Notifies the client that the grouping parameter for the session has changed.
  80. /// </summary>
  81. /// <param name="groupingId">The new grouping parameter for the session.</param>
  82. /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
  83. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  84. [PreserveSig]
  85. int OnGroupingParamChanged(
  86. [In] ref Guid groupingId,
  87. [In] ref Guid eventContext);
  88. /// <summary>
  89. /// Notifies the client that the stream-activity state of the session has changed.
  90. /// </summary>
  91. /// <param name="state">The new session state.</param>
  92. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  93. [PreserveSig]
  94. int OnStateChanged(
  95. [In] AudioSessionState state);
  96. /// <summary>
  97. /// Notifies the client that the session has been disconnected.
  98. /// </summary>
  99. /// <param name="disconnectReason">The reason that the audio session was disconnected.</param>
  100. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  101. [PreserveSig]
  102. int OnSessionDisconnected(
  103. [In] AudioSessionDisconnectReason disconnectReason);
  104. }
  105. }