public static void SetSystemSoundsVolume(float level) { Interfaces.ISimpleAudioVolume volume = GetSystemSoundsVolumeObject(); if (volume == null) { throw new Exception("No session found for system sounds"); } Guid guid = Guid.Empty; volume.SetMasterVolume(level / 100, guid); Marshal.ReleaseComObject(volume); }
public static void SetApplicationVolume(int pid, float level) { Interfaces.ISimpleAudioVolume volume = GetVolumeObject(pid); if (volume == null) { throw new Exception("No application found for pid"); } Guid guid = Guid.Empty; volume.SetMasterVolume(level / 100, guid); Marshal.ReleaseComObject(volume); }