// ----------------------------------------- // SoundScribe (TM) and related software. // // Copyright (C) 2007-2011 Vannatech // http://www.vannatech.com // All rights reserved. // // This source code is subject to the MIT License. // http://www.opensource.org/licenses/mit-license.php // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // ----------------------------------------- using System; using System.Runtime.InteropServices; namespace Vannatech.CoreAudio.Interfaces { /// /// Represents the volume controls on the audio stream to or from an audio endpoint device. /// /// /// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370892.aspx /// public partial interface IAudioEndpointVolume { // Note: Any changes to this interface should be repeated in IAudioEndpointVolumeEx. /// /// Registers a client's notification callback interface. /// /// The interface that is registering for notification callbacks. /// An HRESULT code indicating whether the operation passed of failed. [PreserveSig] int RegisterControlChangeNotify( [In] [MarshalAs(UnmanagedType.Interface)] IAudioEndpointVolumeCallback client); /// /// Deletes the registration of a client's notification callback interface. /// /// The interface that previously registered for notification callbacks. /// An HRESULT code indicating whether the operation passed of failed. [PreserveSig] int UnregisterControlChangeNotify( [In] [MarshalAs(UnmanagedType.Interface)] IAudioEndpointVolumeCallback client); /// /// Gets a count of the channels in the audio stream. /// /// The number of channels. /// An HRESULT code indicating whether the operation passed of failed. [PreserveSig] int GetChannelCount( [Out] [MarshalAs(UnmanagedType.U4)] out UInt32 channelCount); /// /// Sets the master volume level of the audio stream, in decibels. /// /// The new master volume level in decibels. /// A user context value that is passed to the notification callback. /// An HRESULT code indicating whether the operation passed of failed. [PreserveSig] int SetMasterVolumeLevel( [In] [MarshalAs(UnmanagedType.R4)] float level, [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext); /// /// Sets the master volume level, expressed as a normalized, audio-tapered value. /// /// The new master volume level expressed as a normalized value between 0.0 and 1.0. /// A user context value that is passed to the notification callback. /// An HRESULT code indicating whether the operation passed of failed. [PreserveSig] int SetMasterVolumeLevelScalar( [In] [MarshalAs(UnmanagedType.R4)] float level, [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext); /// /// Gets the master volume level of the audio stream, in decibels. /// /// The volume level in decibels. /// An HRESULT code indicating whether the operation passed of failed. [PreserveSig] int GetMasterVolumeLevel( [Out] [MarshalAs(UnmanagedType.R4)] out float level); /// /// Gets the master volume level, expressed as a normalized, audio-tapered value. /// /// The volume level expressed as a normalized value between 0.0 and 1.0. /// An HRESULT code indicating whether the operation passed of failed. [PreserveSig] int GetMasterVolumeLevelScalar( [Out] [MarshalAs(UnmanagedType.R4)] out float level); /// /// Sets the volume level, in decibels, of the specified channel of the audio stream. /// /// The channel number. /// The new volume level in decibels. /// A user context value that is passed to the notification callback. /// An HRESULT code indicating whether the operation passed of failed. [PreserveSig] int SetChannelVolumeLevel( [In] [MarshalAs(UnmanagedType.U4)] UInt32 channelNumber, [In] [MarshalAs(UnmanagedType.R4)] float level, [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext); /// /// Sets the normalized, audio-tapered volume level of the specified channel in the audio stream. /// /// The channel number. /// The new master volume level expressed as a normalized value between 0.0 and 1.0. /// A user context value that is passed to the notification callback. /// An HRESULT code indicating whether the operation passed of failed. [PreserveSig] int SetChannelVolumeLevelScalar( [In] [MarshalAs(UnmanagedType.U4)] UInt32 channelNumber, [In] [MarshalAs(UnmanagedType.R4)] float level, [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext); /// /// Gets the volume level, in decibels, of the specified channel in the audio stream. /// /// The zero-based channel number. /// The volume level in decibels. /// An HRESULT code indicating whether the operation passed of failed. [PreserveSig] int GetChannelVolumeLevel( [In] [MarshalAs(UnmanagedType.U4)] UInt32 channelNumber, [Out] [MarshalAs(UnmanagedType.R4)] out float level); /// /// Gets the normalized, audio-tapered volume level of the specified channel of the audio stream. /// /// The zero-based channel number. /// The volume level expressed as a normalized value between 0.0 and 1.0. /// An HRESULT code indicating whether the operation passed of failed. [PreserveSig] int GetChannelVolumeLevelScalar( [In] [MarshalAs(UnmanagedType.U4)] UInt32 channelNumber, [Out] [MarshalAs(UnmanagedType.R4)] out float level); /// /// Sets the muting state of the audio stream. /// /// True to mute the stream, or false to unmute the stream. /// A user context value that is passed to the notification callback. /// An HRESULT code indicating whether the operation passed of failed. [PreserveSig] int SetMute( [In] [MarshalAs(UnmanagedType.Bool)] Boolean isMuted, [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext); /// /// Gets the muting state of the audio stream. /// /// The muting state. True if the stream is muted, false otherwise. /// An HRESULT code indicating whether the operation passed of failed. [PreserveSig] int GetMute( [Out] [MarshalAs(UnmanagedType.Bool)] out Boolean isMuted); /// /// Gets information about the current step in the volume range. /// /// The current zero-based step index. /// The total number of steps in the volume range. /// An HRESULT code indicating whether the operation passed of failed. [PreserveSig] int GetVolumeStepInfo( [Out] [MarshalAs(UnmanagedType.U4)] out UInt32 step, [Out] [MarshalAs(UnmanagedType.U4)] out UInt32 stepCount); /// /// Increases the volume level by one step. /// /// A user context value that is passed to the notification callback. /// An HRESULT code indicating whether the operation passed of failed. [PreserveSig] int VolumeStepUp( [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext); /// /// Decreases the volume level by one step. /// /// A user context value that is passed to the notification callback. /// An HRESULT code indicating whether the operation passed of failed. [PreserveSig] int VolumeStepDown( [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext); /// /// Queries the audio endpoint device for its hardware-supported functions. /// /// A hardware support mask that indicates the capabilities of the endpoint. /// An HRESULT code indicating whether the operation passed of failed. [PreserveSig] int QueryHardwareSupport( [Out] [MarshalAs(UnmanagedType.U4)] out UInt32 hardwareSupportMask); /// /// Gets the volume range of the audio stream, in decibels. /// /// The minimum volume level in decibels. /// The maximum volume level in decibels. /// The volume increment level in decibels. /// An HRESULT code indicating whether the operation passed of failed. [PreserveSig] int GetVolumeRange( [Out] [MarshalAs(UnmanagedType.R4)] out float volumeMin, [Out] [MarshalAs(UnmanagedType.R4)] out float volumeMax, [Out] [MarshalAs(UnmanagedType.R4)] out float volumeStep); } }