Example #1
0
            /// <summary>
            ///     Determines whether the specified application is muted.
            /// </summary>
            /// <param name="name">
            ///     The name of the application.
            /// </param>
            public static bool?GetApplicationMute(string name)
            {
                var volume = ComImports.GetVolumeObject(name);

                if (volume == null)
                {
                    return(null);
                }
                _ = volume.GetMute(out var mute);
                return(mute);
            }
Example #2
0
            /// <summary>
            ///     Retrieves the volume of the specified application.
            /// </summary>
            /// <param name="name">
            ///     The name of the application.
            /// </param>
            public static float?GetApplicationVolume(string name)
            {
                var volume = ComImports.GetVolumeObject(name);

                if (volume == null)
                {
                    return(null);
                }
                _ = volume.GetMasterVolume(out var level);
                return(level * 0x64);
            }
Example #3
0
            /// <summary>
            ///     Mutes the volume of the specified application.
            /// </summary>
            /// <param name="name">
            ///     The name of the application to change.
            /// </param>
            /// <param name="mute">
            ///     true to mute; otherwise, false to unmute.
            /// </param>
            public static void SetApplicationMute(string name, bool mute)
            {
                var volume = ComImports.GetVolumeObject(name);

                if (volume == null)
                {
                    return;
                }
                var guid = Guid.Empty;

                _ = volume.SetMute(mute, ref guid);
            }
Example #4
0
            /// <summary>
            ///     Sets the volume of the specified application.
            /// </summary>
            /// <param name="name">
            ///     The name of the application to change.
            /// </param>
            /// <param name="level">
            ///     The volume level to set.
            /// </param>
            public static void SetApplicationVolume(string name, float level)
            {
                var volume = ComImports.GetVolumeObject(name);

                if (volume == null)
                {
                    return;
                }
                var guid = Guid.Empty;

                _ = volume.SetMasterVolume(level / 0x64, ref guid);
            }