// ----------------------------------------- // 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; using Vannatech.CoreAudio.Enumerations; namespace Vannatech.CoreAudio.Interfaces { /// /// Used by a client to get information about the audio session. /// /// /// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd368248.aspx /// public partial interface IAudioSessionControl2 { // Note: We can't derive from IAudioSessionControl, as that will produce the wrong vtable. #region IAudioSessionControl Members /// /// Retrieves the current state of the audio session. /// /// Receives the current session state. /// An HRESULT code indicating whether the operation succeeded of failed. [PreserveSig] int GetState( [Out] out AudioSessionState state); /// /// Retrieves the display name for the audio session. /// /// Receives a string that contains the display name. /// An HRESULT code indicating whether the operation succeeded of failed. [PreserveSig] int GetDisplayName( [Out] [MarshalAs(UnmanagedType.LPWStr)] out string displayName); /// /// Assigns a display name to the current audio session. /// /// A string that contains the new display name for the session. /// A user context value that is passed to the notification callback. /// An HRESULT code indicating whether the operation succeeded of failed. [PreserveSig] int SetDisplayName( [In] [MarshalAs(UnmanagedType.LPWStr)] string displayName, [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext); /// /// Retrieves the path for the display icon for the audio session. /// /// Receives a string that specifies the fully qualified path of the file that contains the icon. /// An HRESULT code indicating whether the operation succeeded of failed. [PreserveSig] int GetIconPath( [Out] [MarshalAs(UnmanagedType.LPWStr)] out string iconPath); /// /// Assigns a display icon to the current session. /// /// A string that specifies the fully qualified path of the file that contains the new icon. /// A user context value that is passed to the notification callback. /// An HRESULT code indicating whether the operation succeeded of failed. [PreserveSig] int SetIconPath( [In] [MarshalAs(UnmanagedType.LPWStr)] string iconPath, [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext); /// /// Retrieves the grouping parameter of the audio session. /// /// Receives the grouping parameter ID. /// An HRESULT code indicating whether the operation succeeded of failed. [PreserveSig] int GetGroupingParam( [Out] out Guid groupingId); /// /// Assigns a session to a grouping of sessions. /// /// The new grouping parameter ID. /// A user context value that is passed to the notification callback. /// An HRESULT code indicating whether the operation succeeded of failed. [PreserveSig] int SetGroupingParam( [In] [MarshalAs(UnmanagedType.LPStruct)] Guid groupingId, [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext); /// /// Registers the client to receive notifications of session events, including changes in the session state. /// /// A client-implemented interface. /// An HRESULT code indicating whether the operation succeeded of failed. [PreserveSig] int RegisterAudioSessionNotification( [In] IAudioSessionEvents client); /// /// Deletes a previous registration by the client to receive notifications. /// /// A client-implemented interface. /// An HRESULT code indicating whether the operation succeeded of failed. [PreserveSig] int UnregisterAudioSessionNotification( [In] IAudioSessionEvents client); #endregion /// /// Retrieves the session identifier. /// /// Receives the audio session identifier. /// An HRESULT code indicating whether the operation succeeded of failed. [PreserveSig] int GetSessionIdentifier( [Out] [MarshalAs(UnmanagedType.LPWStr)] out string sessionId); /// /// Retrieves the identifier of the session instance. /// /// Receives the identifier of a particular instance of the audio session. /// An HRESULT code indicating whether the operation succeeded of failed. [PreserveSig] int GetSessionInstanceIdentifier( [Out] [MarshalAs(UnmanagedType.LPWStr)] out string instanceId); /// /// Retrieves the process identifier of the session. /// /// Receives the process identifier of the audio session. /// An HRESULT code indicating whether the operation succeeded of failed. [PreserveSig] int GetProcessId( [Out] [MarshalAs(UnmanagedType.U4)] out UInt32 processId); /// /// Indicates whether the session is a system sounds session. /// /// An HRESULT code returning S_OK (0x0) or S_FALSE (0x1), indicating whether or not the session is a system sounds session. [PreserveSig] int IsSystemSoundsSession(); /// /// Enables or disables the default stream attenuation experience (auto-ducking) provided by the system. /// /// True to disable system auto-ducking, or false to enable. /// An HRESULT code indicating whether the operation succeeded of failed. [PreserveSig] int SetDuckingPreference( [In] [MarshalAs(UnmanagedType.Bool)] bool optOut); } }