// ----------------------------------------- // 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 { /// /// Provides volume controls on the audio stream to or from a device endpoint. /// /// /// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370899.aspx /// public partial interface IAudioEndpointVolumeEx { // Note: We can't derive from IAudioEndpointVolume, as that will produce the wrong vtable. #region IAudioEndpointVolume Methods /// /// 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] 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] IAudioEndpointVolumeCallback clientCallback); /// /// 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] ref 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] ref 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.SysUInt)] UIntPtr channelNumber, [In] [MarshalAs(UnmanagedType.R4)] float level, [In] ref 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.SysUInt)] UIntPtr channelNumber, [In] [MarshalAs(UnmanagedType.R4)] float level, [In] ref 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.SysUInt)] UIntPtr 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.SysUInt)] UIntPtr 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] ref 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.SysUInt)] out UIntPtr step, [Out] [MarshalAs(UnmanagedType.SysUInt)] out UIntPtr 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] ref 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] ref 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); #endregion /// /// Gets the volume range for a specified channel. /// /// The channel number for which to get the volume range. /// The minimum volume level for the channel, in decibels. /// The maximum volume level for the channel, in decibels. /// The volume increment for the channel, in decibels. /// An HRESULT code indicating whether the operation passed of failed. [PreserveSig] int GetVolumeRangeChannel( [In] [MarshalAs(UnmanagedType.U4)] UInt32 channelNumber, [Out] [MarshalAs(UnmanagedType.R4)] out float volumeMin, [Out] [MarshalAs(UnmanagedType.R4)] out float volumeMax, [Out] [MarshalAs(UnmanagedType.R4)] out float volumeStep); } }