IAudioStreamVolume.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 an audio stream.
  25. /// </summary>
  26. /// <remarks>
  27. /// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370977.aspx
  28. /// </remarks>
  29. public partial interface IAudioStreamVolume
  30. {
  31. /// <summary>
  32. /// Retrieves the number of channels contained in the audio stream.
  33. /// </summary>
  34. /// <param name="count">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 count);
  39. /// <summary>
  40. /// Sets the volume level for the specified channel in the audio stream.
  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. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  45. [PreserveSig]
  46. int SetChannelVolume(
  47. [In] [MarshalAs(UnmanagedType.U4)] UInt32 index,
  48. [In] [MarshalAs(UnmanagedType.R4)] float level);
  49. /// <summary>
  50. /// Retrieves the volume level for the specified channel in the audio stream.
  51. /// </summary>
  52. /// <param name="index">The zero-based channel index.</param>
  53. /// <param name="level">Receives the volume level expressed as a normalized value between 0.0 and 1.0.</param>
  54. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  55. [PreserveSig]
  56. int GetChannelVolume(
  57. [In] [MarshalAs(UnmanagedType.U4)] UInt32 index,
  58. [Out] [MarshalAs(UnmanagedType.R4)] out float level);
  59. /// <summary>
  60. /// Sets the individual volume levels for all the channels in the audio stream.
  61. /// </summary>
  62. /// <param name="count">The number of channels in the audio stream. This must match the volume level array length.</param>
  63. /// <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>
  64. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  65. [PreserveSig]
  66. int SetAllVolumes(
  67. [In] [MarshalAs(UnmanagedType.U4)] UInt32 count,
  68. [In] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.R4)] float[] levels);
  69. /// <summary>
  70. /// Retrieves the volume levels for all the channels in the audio stream.
  71. /// </summary>
  72. /// <param name="length">The number of elements in the volumes array.</param>
  73. /// <param name="volumes">Receives an array of volume levels for the channels in the audio stream.</param>
  74. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  75. [PreserveSig]
  76. int GetAllVolumes(
  77. [In] [MarshalAs(UnmanagedType.U4)] UInt32 length,
  78. [In, Out] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.R4)] float[] volumes);
  79. }
  80. }