IChannelAudioVolume.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 a client to control and monitor the volume levels for all of the channels in the audio session.
  25. /// </summary>
  26. /// <remarks>
  27. /// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd371023.aspx
  28. /// </remarks>
  29. public partial interface IChannelAudioVolume
  30. {
  31. /// <summary>
  32. /// Retrieves the number of channels contained in the session.
  33. /// </summary>
  34. /// <param name="channelCount">Receives the channel count.</param>
  35. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  36. [PreserveSig]
  37. int GetChannelCount(
  38. [Out] [MarshalAs(UnmanagedType.U4)] out UInt32 channelCount);
  39. /// <summary>
  40. /// Sets the volume level for the specified channel in the session.
  41. /// </summary>
  42. /// <param name="index">The zero-based index of the channel.</param>
  43. /// <param name="level">The new volume level expressed as a normalized value between 0.0 and 1.0.</param>
  44. /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
  45. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  46. [PreserveSig]
  47. int SetChannelVolume(
  48. [In] [MarshalAs(UnmanagedType.U4)] UInt32 index,
  49. [In] [MarshalAs(UnmanagedType.R4)] float level,
  50. [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
  51. /// <summary>
  52. /// Retrieves the volume level for the specified channel in the session.
  53. /// </summary>
  54. /// <param name="index">The zero-based channel index.</param>
  55. /// <param name="level">Receives the volume level expressed as a normalized value between 0.0 and 1.0.</param>
  56. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  57. [PreserveSig]
  58. int GetChannelVolume(
  59. [In] [MarshalAs(UnmanagedType.U4)] UInt32 index,
  60. [Out] [MarshalAs(UnmanagedType.R4)] out float level);
  61. /// <summary>
  62. /// Sets the individual volume levels for all the channels in the session.
  63. /// </summary>
  64. /// <param name="channelCount">The number of channels in the audio stream. This must match the volume level array length.</param>
  65. /// <param name="levels">The new volume levels for each channel in the audio stream, expressed as normalized values between 0.0 and 1.0.</param>
  66. /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
  67. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  68. [PreserveSig]
  69. int SetAllVolumes(
  70. [In] [MarshalAs(UnmanagedType.U4)] UInt32 channelCount,
  71. [In] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.R4)] float[] levels,
  72. [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
  73. /// <summary>
  74. /// Retrieves the volume levels for all the channels in the session.
  75. /// </summary>
  76. /// <param name="length">The number of elements in the volumes array.</param>
  77. /// <param name="volumes">Receives an array of volume levels for the channels in the audio stream.</param>
  78. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  79. [PreserveSig]
  80. int GetAllVolumes(
  81. [In] [MarshalAs(UnmanagedType.U4)] UInt32 length,
  82. [In, Out] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.R4)] float[] volumes);
  83. }
  84. }