コード例 #1
0
        public static void singleAppVolumeControl()
        {
            AudioSessionManager ASM = new AudioSessionManager();
            int    ans     = 99;
            int    tPid    = 99;
            string proceed = "n";

            ASM.updateActiveAudioSessions();
            ASM.displayActiveAudioSessions();
            do
            {
                Console.Write("enter application number from above list: ");
            } while (!(int.TryParse(Console.ReadLine(), out ans)));
            tPid = ASM.getActiveAudioSessions().ElementAt(ans).ProcessId;
            float vol;

            do
            {
                Console.Write("enter the volume as a percentage(0-100): ");
            } while (!(float.TryParse(Console.ReadLine(), NumberStyles.Number, CultureInfo.InvariantCulture.NumberFormat, out vol)));
            VolumeMixer.SetApplicationVolume(tPid, vol);
            Console.WriteLine("Volume has been Set!");
            Console.Write("Press Enter to continue......");
            proceed = Console.ReadLine();
        }
コード例 #2
0
        public static void singleAppVolumeControl()
        {
            AudioSessionManager ASM = new AudioSessionManager();
            int ans = 99;
            int tPid = 99;
            string proceed = "n";

            ASM.updateActiveAudioSessions();
            ASM.displayActiveAudioSessions();
            do
            {
                Console.Write("enter application number from above list: ");
            } while (!(int.TryParse(Console.ReadLine(), out ans)));
            tPid = ASM.getActiveAudioSessions().ElementAt(ans).ProcessId;
            float vol;
            do
            {
                Console.Write("enter the volume as a percentage(0-100): ");
            } while (!(float.TryParse(Console.ReadLine(), NumberStyles.Number, CultureInfo.InvariantCulture.NumberFormat, out vol)));
            VolumeMixer.SetApplicationVolume(tPid, vol);
            Console.WriteLine("Volume has been Set!");
            Console.Write("Press Enter to continue......");
            proceed = Console.ReadLine();
        }