IPerChannelDbLevel.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. /// Represents a generic subunit control interface that provides per-channel control over the
  25. /// volume level, in decibels, of an audio stream or of a frequency band in an audio stream.
  26. /// </summary>
  27. /// <remarks>
  28. /// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd371447.aspx
  29. /// </remarks>
  30. public partial interface IPerChannelDbLevel
  31. {
  32. /// <summary>
  33. /// Gets the number of channels in the audio stream.
  34. /// </summary>
  35. /// <param name="channelCount">Receives the number of channels in the audio stream.</param>
  36. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  37. [PreserveSig]
  38. int GetChannelCount(
  39. [Out] [MarshalAs(UnmanagedType.U4)] out UInt32 channelCount);
  40. /// <summary>
  41. /// Gets the range, in decibels, of the volume level of the specified channel.
  42. /// </summary>
  43. /// <param name="index">The zero-based channel index.</param>
  44. /// <param name="volumeMin">Receives the minimum volume level in decibels.</param>
  45. /// <param name="volumeMax">Receives the maximum volume level in decibels.</param>
  46. /// <param name="volumeStep">Receives the volume increment level in decibels.</param>
  47. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  48. [PreserveSig]
  49. int GetLevelRange(
  50. [In] [MarshalAs(UnmanagedType.U4)] UInt32 index,
  51. [Out] [MarshalAs(UnmanagedType.R4)] out float volumeMin,
  52. [Out] [MarshalAs(UnmanagedType.R4)] out float volumeMax,
  53. [Out] [MarshalAs(UnmanagedType.R4)] out float volumeStep);
  54. /// <summary>
  55. /// Gets the volume level, in decibels, of the specified channel.
  56. /// </summary>
  57. /// <param name="index">The zero-based channel index.</param>
  58. /// <param name="level">Receives the volume level, in decibels, of the specified channel.</param>
  59. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  60. [PreserveSig]
  61. int GetLevel(
  62. [In] [MarshalAs(UnmanagedType.U4)] UInt32 index,
  63. [Out] [MarshalAs(UnmanagedType.R4)] out float level);
  64. /// <summary>
  65. /// Sets the volume level, in decibels, of the specified channel.
  66. /// </summary>
  67. /// <param name="index">The zero-based channel index.</param>
  68. /// <param name="level">The new volume level, in decibels, of the specified channel.</param>
  69. /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
  70. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  71. [PreserveSig]
  72. int SetLevel(
  73. [In] [MarshalAs(UnmanagedType.U4)] UInt32 index,
  74. [In] [MarshalAs(UnmanagedType.R4)] float level,
  75. [In, Optional] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
  76. /// <summary>
  77. /// Sets all channels in the audio stream to the same uniform volume level, in decibels.
  78. /// </summary>
  79. /// <param name="level">The new uniform level in decibels.</param>
  80. /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
  81. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  82. [PreserveSig]
  83. int SetLevelUniform(
  84. [In] [MarshalAs(UnmanagedType.R4)] float level,
  85. [In, Optional] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
  86. /// <summary>
  87. /// Sets the volume levels, in decibels, of all the channels in the audio stream.
  88. /// </summary>
  89. /// <param name="levels">An array of new volume levels, per channel, in decibels.</param>
  90. /// <param name="channelCount">The number of channels in the audio stream. This must match the array length.</param>
  91. /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
  92. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  93. [PreserveSig]
  94. int SetLevelAllChannels(
  95. [In] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.R4, SizeParamIndex = 2)] float[] levels,
  96. [In] [MarshalAs(UnmanagedType.U4)] UInt32 channelCount,
  97. [In, Optional] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
  98. }
  99. }