Beispiel #1
0
        public static float?GetApplicationPeak(int pid)
        {
            IAudioMeterInformation meter = VolumeMixer.GetCoreAudioObject <IAudioMeterInformation>(pid);

            if (meter == null)
            {
                return(null);
            }

            float peak;

            meter.GetPeakValue(out peak);
            return(peak);
        }
Beispiel #2
0
        public static void SetApplicationMute(int pid, bool mute)
        {
            ISimpleAudioVolume volume = VolumeMixer.GetCoreAudioObject <ISimpleAudioVolume>(pid);

            if (volume == null)
            {
                return;
            }

            Guid guid = Guid.Empty;

            volume.SetMute(mute, ref guid);
            Marshal.ReleaseComObject(volume);
        }
Beispiel #3
0
        public static void SetApplicationVolume(int pid, float level)
        {
            ISimpleAudioVolume volume = VolumeMixer.GetCoreAudioObject <ISimpleAudioVolume>(pid);

            if (volume == null)
            {
                return;
            }

            Guid guid = Guid.Empty;

            volume.SetMasterVolume(level / 100, ref guid);
            Marshal.ReleaseComObject(volume);
        }
Beispiel #4
0
        public static bool?GetApplicationMute(int pid)
        {
            ISimpleAudioVolume volume = VolumeMixer.GetCoreAudioObject <ISimpleAudioVolume>(pid);

            if (volume == null)
            {
                return(null);
            }

            bool mute;

            volume.GetMute(out mute);
            Marshal.ReleaseComObject(volume);
            return(mute);
        }
Beispiel #5
0
        public static float?GetApplicationVolume(int pid)
        {
            ISimpleAudioVolume volume = VolumeMixer.GetCoreAudioObject <ISimpleAudioVolume>(pid);

            if (volume == null)
            {
                return(null);
            }

            float level;

            volume.GetMasterVolume(out level);
            Marshal.ReleaseComObject(volume);
            return(level * 100);
        }