public static void SetSystemSoundsMute(bool mute) { Interfaces.ISimpleAudioVolume volume = GetSystemSoundsVolumeObject(); if (volume == null) { throw new Exception("No session found for system sounds"); } Guid guid = Guid.Empty; volume.SetMute(mute, guid); Marshal.ReleaseComObject(volume); }
public static void SetApplicationMute(int pid, bool mute) { Interfaces.ISimpleAudioVolume volume = GetVolumeObject(pid); if (volume == null) { throw new Exception("No application found for pid"); } Guid guid = Guid.Empty; volume.SetMute(mute, guid); Marshal.ReleaseComObject(volume); }