ISimpleAudioVolume.cs 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 the master volume level of an audio session.
  25. /// </summary>
  26. /// <remarks>
  27. /// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd316531.aspx
  28. /// </remarks>
  29. public partial interface ISimpleAudioVolume
  30. {
  31. /// <summary>
  32. /// Sets the master volume level for the audio session.
  33. /// </summary>
  34. /// <param name="levelNorm">The new volume level expressed as a normalized value between 0.0 and 1.0.</param>
  35. /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
  36. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  37. [PreserveSig]
  38. int SetMasterVolume(
  39. [In] [MarshalAs(UnmanagedType.R4)] float levelNorm,
  40. [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
  41. /// <summary>
  42. /// Retrieves the client volume level for the audio session.
  43. /// </summary>
  44. /// <param name="levelNorm">Receives the volume level expressed as a normalized value between 0.0 and 1.0. </param>
  45. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  46. [PreserveSig]
  47. int GetMasterVolume(
  48. [Out] [MarshalAs(UnmanagedType.R4)] out float levelNorm);
  49. /// <summary>
  50. /// Sets the muting state for the audio session.
  51. /// </summary>
  52. /// <param name="isMuted">The new muting state.</param>
  53. /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
  54. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  55. [PreserveSig]
  56. int SetMute(
  57. [In] [MarshalAs(UnmanagedType.Bool)] bool isMuted,
  58. [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
  59. /// <summary>
  60. /// Retrieves the current muting state for the audio session.
  61. /// </summary>
  62. /// <param name="isMuted">Receives the muting state.</param>
  63. /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
  64. [PreserveSig]
  65. int GetMute(
  66. [Out] [MarshalAs(UnmanagedType.Bool)] out bool isMuted);
  67. }
  68. }