Ejemplo n.º 1
0
        public static void MuteApp(int processId)
        {
            if (processId < 0)
            {
                throw new Exception("Proccess must have an ID value greater than 0");
            }

            if (processId != 0)
            {
                foreach (var ctl in AudioLibrary.EnumerateApplications())
                {
                    ctl.GetProcessId(out uint pId);
                    if (pId == processId)
                    {
                        AudioLibrary.MuteApp(ctl);
                        break;
                    }
                }
            }
            else
            {
                AudioLibrary.MuteMaster();
            }
        }